Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //DumpKeyToConsole.dll - extracts the key from keydat and prints it to the console.
- #include <Windows.h>
- #include <string>
- using namespace std;
- typedef char* (__cdecl* GetKeyFromDatFn)(char key[]);
- static GetKeyFromDatFn GetKeyFromDat;
- typedef void (__cdecl *PrintfFn)(const char* format, ...);
- static PrintfFn PrintToConsole;
- bool DataCmp(const BYTE* data, const BYTE* mask, const char* mask_char)
- {
- for(; *mask_char; ++mask_char, ++data, ++mask)
- {
- if(*mask_char == 'x' && *data != *mask)
- {
- return false;
- }
- }
- return (*mask_char) == NULL;
- }
- DWORD FindPattern(DWORD Addr, DWORD Len, BYTE* mask, char* mask_char)
- {
- for(DWORD i = NULL; i < Len; i++)
- {
- if(DataCmp((BYTE*)(Addr + i), mask, mask_char))
- {
- return (DWORD)(Addr + i);
- }
- }
- return 0;
- }
- DWORD BLSigScan(char* pattern, char* mask)
- {
- static DWORD ClientBase = (DWORD)GetModuleHandleA("Blockland.exe");
- if(ClientBase == NULL)
- {
- return -1;
- }
- return FindPattern(ClientBase, 0x640000, (PBYTE)pattern, mask);
- }
- DWORD WINAPI Initialize(LPVOID Args)
- {
- PrintToConsole = (PrintfFn)BLSigScan("\x8B\x4C\x24\x04\x8D\x44\x24\x08\x50\x6A\x00\x6A\x00\xE8\x00\x00\x00\x00\x83\xC4\x0C\xC3", "xxxxxxxxxxxxxx????xxxx");
- GetKeyFromDat = (GetKeyFromDatFn)BLSigScan("\x55\x8B\xEC\x83\xE4\xF8\xB8\x00\x00\x00\x00\xE8\x00\x00\x00\x00\xA1\x00\x00\x00\x00\x8B\x0D\x00\x00\x00\x00\x33\xC5\x53\x89\x84\x24\x00\x00\x00\x00\xA1\x00\x00\x00\x00\x56\x8B\x75\x08", "xxxxxxx????x????x????xx????xxxxxx????x????xxxx");
- char buffer[17];
- GetKeyFromDat(buffer);
- PrintToConsole("Your key is: %s", buffer);
- return 0;
- }
- int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
- {
- if(dwReason == DLL_PROCESS_ATTACH)
- {
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Initialize, NULL, 0, NULL);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement