Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char* swag;
- DWORD MagicMemoryLocation;
- __declspec(naked) void ourFunct(SOCKET s, const char* buf, int len, int flags)
- {
- __asm
- {
- push ebp
- mov ebp, esp
- mov eax, [ebp + 0x0C]
- mov swag, eax
- jmp [MagicMemoryLocation]
- }
- }
- int main()
- {
- MagicMemoryLocation = (DWORD)send + 5;
- DWORD dwOld;
- VirtualProtect(send, 5, PAGE_EXECUTE_READWRITE, &dwOld);
- *reinterpret_cast<BYTE*>(send) = 0xE9;
- *reinterpret_cast<DWORD*>(reinterpret_cast<DWORD>(send)+1) = reinterpret_cast<DWORD>(ourFunct)-reinterpret_cast<DWORD>(send)-5;
- VirtualProtect(send, 5, dwOld, &dwOld);
- send(2, "ehueuhe", 5, 0);
- std::cout << swag;
- Sleep(-1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement