DWORD __fastcall SendHook(void* thisPTR, void* /* dummy */, void* param1, void* param2) { DWORD buffer = *(DWORD*)((DWORD)param1 + 4); DWORD packetOcode = *(DWORD*)buffer; DWORD packetSize = *(DWORD*)((DWORD)param1 + 16); // totalLength, writePos // dumps the packet PacketDump::DumpPacket(logPath, binPath, PacketDump::PACKET_TYPE_C2S, packetOcode, packetSize - 4, buffer); // unhooks the send function HookManager::UnHook(sendAddress, defaultMachineCodeSend); // now let's call client's function // so it can send the packet to the server DWORD returnValue = SendProto(sendAddress)(thisPTR, param1, param2); // hooks again to catch the next outgoing packets also HookManager::ReHook(sendAddress, machineCodeHookSend); if (!sendHookGood) { printf("Send hook is working.\n"); sendHookGood = true; } return 0; }
void FileSendDialog::send () { const int idx = Ui_.TransferMethod_->currentIndex (); if (Pos2Sharer_.contains (idx)) SendSharer (Pos2Sharer_ [idx]); else if (AccSupportsFT_) SendProto (); else QMessageBox::critical (this, "LeechCraft", tr ("No file transfer methods available.")); }
DWORD __fastcall SendHook(void* thisPTR, void* /* dummy */, void* param1, void* param2) { WORD packetOpcodeSize = 4; // 4 bytes for all versions DWORD buffer = *(DWORD*)((DWORD)param1 + 4); DWORD packetOcode = *(DWORD*)buffer; // packetOpcodeSize DWORD packetSize = *(DWORD*)((DWORD)param1 + 16); // totalLength, writePos WORD initialReadOffset = packetOpcodeSize; // dumps the packet PacketDump::DumpPacket(logPath, binPath, PacketDump::PACKET_TYPE_C2S, packetOcode, packetSize - packetOpcodeSize, buffer, initialReadOffset); // unhooks the send function HookManager::UnHook(sendAddress, defaultMachineCodeSend); // now let's call client's function // so it can send the packet to the server DWORD returnValue = SendProto(sendAddress)(thisPTR, param1, param2); // something wrong with the file opening if (!PacketDump::binaryDumpFile || (PacketDump::IsUserFriendlyLogEnabled() && !PacketDump::userFriendlyDumpFile)) { isSigIntOccured = true; return returnValue; } // hooks again to catch the next outgoing packets also HookManager::ReHook(sendAddress, machineCodeHookSend); if (!sendHookGood) { printf("Send hook is working.\n"); sendHookGood = true; } return returnValue; }
DWORD __fastcall SendHook(void* thisPTR, void* /* dummy */, CDataStore* dataStore, void* param2) { // dumps the packet DumpPacket(CMSG, 0, 4, dataStore); // unhooks the send function HookManager::UnHook(sendAddress, defaultMachineCodeSend); // now let's call client's function // so it can send the packet to the server (connection, CDataStore*, 2) DWORD returnValue = SendProto(sendAddress)(thisPTR, dataStore, param2); // hooks again to catch the next outgoing packets also HookManager::ReHook(sendAddress, machineCodeHookSend); if (!sendHookGood) { printf("Send hook is working.\n"); sendHookGood = true; } return 0; }