PDA

Просмотр полной версии : Send packet back


wongerlt
26.08.2016, 15:08
Hello all,
Im all do like in this thread http://coderx.ru/showthread.php?t=11604
all work fine, i get packets from server, but how send it back?
example here:
int __fastcall new_AddNetworkQueue(unsigned int This, unsigned int EDX, TNetworkPacket *NetworkPacket)
{
if (NetworkPacket->subid == 0xFFFF)
{
switch (NetworkPacket->id)
{
case 0x2E:
decodeKey(NetworkPacket->data + 1);
break;
case 0x74:
// reply ?
Logger("Get from server.");
break;
default:
Logger("Get from server other");
break;
}
}

return true_AddNetworkQueue(This, EDX, NetworkPacket);
}
i want reply to 0x74 packet, how to do it?
Thanks. :)

Yegor
26.08.2016, 17:20
Which chronicles the client?

Smwr
26.08.2016, 18:00
Try do it like it implemented in UNetworkHandler::RequestXXX (see your engine.dll for details)


void(__cdecl *_sendPacket)(void *self, char *format, ...) = NULL;
void *_clientSocket = NULL;

int __fastcall AddNetworkQueueHook(NetworkHandler* self, int, NetworkPacket *packet) {

if (SendPacket == NULL) {
__asm {
mov ebx, ecx
mov ecx, [ebx + 0x48] ; see offset in disassembler
mov edx, [ecx]
mov _clientSocket, ecx
mov ecx, [edx + 0x6C]; in disassembler too
mov _sendPacket, ecx;
}
}

//do smth

return result;
}



and use it e.g. _sendPacket(_clientSocket, "cddc", 0x39, 0xE2, 0, 0);

wongerlt
26.08.2016, 18:45
Its interlude.
Thanks i will try this and reply result :)

Добавлено через 10 минут
it seems im still to noob for it

Smwr
26.08.2016, 19:04
for interlude will 0x68 instead 0x6C.
this should work

wongerlt
26.08.2016, 19:42
Yes, i use 68.
I receive packets and etc, but now i want send packet to server from this place:

int __fastcall new_AddNetworkQueue(unsigned int This, unsigned int EDX, TNetworkPacket *NetworkPacket)
{
if ((*(unsigned int*) (KiUserExceptDispADR + 10) + KiUserExceptDispADR < hNtDllStart) || (*(unsigned int*) (KiUserExceptDispADR + 10) + KiUserExceptDispADR > hNtDllEnd))
ErrorExit("Bot Program Detected #0!");

unsigned int retAddr = *((unsigned int*) &NetworkPacket - 1);

if ((retAddr < hEngineStart) || (retAddr > hEngineEnd))
ErrorExit("Bot Program Detected #1!");

if (NetworkPacket->subid == 0xFFFF)
{
switch (NetworkPacket->id)
{
case 0x2E:
decodeKey(NetworkPacket->data + 1);
break;
case 0x74:
// this place send packet..?
break;
}
}

return true_AddNetworkQueue(This, EDX, NetworkPacket);
}
i want send packet with type 0x68.
what function to use?

Smwr
26.08.2016, 20:47
void(__cdecl *_sendPacket)(void *self, char *format, ...) = NULL;
void *_clientSocket = NULL;

int __fastcall new_AddNetworkQueue(unsigned int This, unsigned int EDX, TNetworkPacket *NetworkPacket)
{

if (SendPacket == NULL) {
__asm {
mov ebx, ecx
mov ecx, [ebx + 0x48] ; see offset in disassembler
mov edx, [ecx]
mov _clientSocket, ecx
mov ecx, [edx + 0x6C]; in disassembler too
mov _sendPacket, ecx;
}
}

if ((*(unsigned int*) (KiUserExceptDispADR + 10) + KiUserExceptDispADR < hNtDllStart) || (*(unsigned int*) (KiUserExceptDispADR + 10) + KiUserExceptDispADR > hNtDllEnd))
ErrorExit("Bot Program Detected #0!");

unsigned int retAddr = *((unsigned int*) &NetworkPacket - 1);

if ((retAddr < hEngineStart) || (retAddr > hEngineEnd))
ErrorExit("Bot Program Detected #1!");

if (NetworkPacket->subid == 0xFFFF)
{
switch (NetworkPacket->id)
{
case 0x2E:
decodeKey(NetworkPacket->data + 1);
break;
case 0x74:
_sendPacket(_clientSocket, .....);
break;
}
}

return true_AddNetworkQueue(This, EDX, NetworkPacket);
}

wongerlt
27.08.2016, 19:10
Thanks you!!!!!! work perfect :)
and this
SendPacket
im set as int SendPacket = NULL; is good or no? but it work and with it.

Добавлено через 22 часа 10 минут
Now i want send string to server.
im use:
_sendPacket(_clientSocket, "cs", 0xF9,"Test");
in l2j i use:
ReadS();
and i get in log this error:
Too many buffer underflow exceptions.

How to send text?

Smwr
28.08.2016, 09:22
maybe
_sendPacket(_clientSocket, "cS", 0xF9,L"Test");

wongerlt
28.08.2016, 14:27
Thanks you, work :)

wongerlt
29.08.2016, 21:01
Other question, how read next data, example
i send to client:
writeD(5);
writeD(6);
writeD(7);
now only first i can read in client with
NetworkPacket->data[0]
how read next?
im try with
NetworkPacket->data[1]
but result is 0

ScythLab
29.08.2016, 23:10
check NetworkPacket->size and all data:

for (int i = 0; i < NetworkPacket->size; i++)
{
... = NetworkPacket->data[i];
}

wongerlt
29.08.2016, 23:30
Ok i check it and write result :)
And im try make it: send to client gg query with random string like: hkcd68;!*_,!*(_@* and send back it encoded sha1 with strong 'salt' and check in server its correct or no. Its good for check gg?

p.s every time send different random string.

wongerlt
31.08.2016, 04:20
check NetworkPacket->size and all data:

for (int i = 0; i < NetworkPacket->size; i++)
{
... = NetworkPacket->data[i];
}


All work great, thanks.

New question:
How to check what packet are from server and what packet are from client at
AddNetworkQueue?
Thanks.

Smwr
31.08.2016, 07:22
All work great, thanks.

New question:
How to check what packet are from server and what packet are from client at
AddNetworkQueue?
Thanks.

from server in AddNetworkQueue, from client in SendPacket

wongerlt
21.12.2016, 14:27
Hello,
What can be wrong in this dll, because in windows xp got graphic lag in other windows 7/8/10 all fine.

antonis
03.05.2017, 23:36
hello all !

how can send packet on login server ?

wongerlt
12.02.2020, 21:40
any one know offset for H5?
__asm {
mov ebx, ecx
mov ecx, [ebx + 0x48] ; see offset in disassembler
mov edx, [ecx]
mov _clientSocket, ecx
mov ecx, [edx + 0x6C]; in disassembler too
mov _sendPacket, ecx;
}

ScythLab
15.02.2020, 11:13
wongerlt, 0x48 и 0x6C

wongerlt
29.05.2022, 14:38
hello again,
maybe some one have idea how send packet to client? or idea how to communicate with game interface?

wongerlt
31.05.2022, 21:05
all fixed. thanks.