{"id":26720866,"url":"https://github.com/amr-khaled-ahmed/python-reverse-shell-with-persistence","last_synced_at":"2025-10-06T08:18:48.846Z","repository":{"id":284227244,"uuid":"861034890","full_name":"Amr-Khaled-Ahmed/python-reverse-shell-with-persistence","owner":"Amr-Khaled-Ahmed","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-24T19:50:17.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T20:34:57.073Z","etag":null,"topics":["malware","malware-analysis","malware-samples","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Amr-Khaled-Ahmed.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}},"created_at":"2024-09-21T20:28:27.000Z","updated_at":"2025-03-24T19:50:21.000Z","dependencies_parsed_at":"2025-03-24T20:45:03.127Z","dependency_job_id":null,"html_url":"https://github.com/Amr-Khaled-Ahmed/python-reverse-shell-with-persistence","commit_stats":null,"previous_names":["amr-khaled-ahmed/python-reverse-shell-with-persistence"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Amr-Khaled-Ahmed/python-reverse-shell-with-persistence","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amr-Khaled-Ahmed%2Fpython-reverse-shell-with-persistence","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amr-Khaled-Ahmed%2Fpython-reverse-shell-with-persistence/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amr-Khaled-Ahmed%2Fpython-reverse-shell-with-persistence/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amr-Khaled-Ahmed%2Fpython-reverse-shell-with-persistence/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amr-Khaled-Ahmed","download_url":"https://codeload.github.com/Amr-Khaled-Ahmed/python-reverse-shell-with-persistence/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amr-Khaled-Ahmed%2Fpython-reverse-shell-with-persistence/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278578121,"owners_count":26009738,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["malware","malware-analysis","malware-samples","python"],"created_at":"2025-03-27T19:34:42.834Z","updated_at":"2025-10-06T08:18:48.809Z","avatar_url":"https://github.com/Amr-Khaled-Ahmed.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Reverse Shell with Windows Registry Persistence\n\n## Overview\n\nThis project is a **Python-based reverse shell** with **Windows registry persistence**, designed for **malware analysis**, **cybersecurity research**, and **educational purposes**. It demonstrates common techniques used by attackers to gain control of compromised machines, execute arbitrary commands, and maintain persistence across system reboots.\n\n**⚠️ Disclaimer:** This script is for educational and research purposes **only**. Unauthorized use of this code in live environments without permission is illegal. The author is not responsible for any misuse or malicious intent involving this script.\n\n---\n\n## Features\n\n### 🔑 **Reverse Shell**\n- Establishes a connection from the victim machine to an attacker's server (using a socket connection).\n- Receives and executes shell commands remotely.\n- Handles both directory changes (`cd` commands) and standard shell command execution, sending output back to the attacker.\n\n### 🗝️ **Windows Registry Persistence**\n- The script adds itself to the Windows Registry under `HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run`.\n- This ensures that the script runs every time the system starts, simulating a common persistence technique found in real-world malware.\n\n### ⏳ **Command Execution Loop**\n- The reverse shell continuously attempts to connect to the attacker machine until successful.\n- Upon connection, it waits to receive commands, execute them, and send the results back.\n\n---\n\n## How It Works\n\n1. **Socket Creation**: The script creates a socket connection to a specified IP and port (configured as `any IP` and `any port` by default). You can modify these settings based on your testing environment.\n   \n2. **Command Reception \u0026 Execution**: After a connection is established, the attacker can send commands. The script executes these commands on the victim machine and returns the output or error back to the attacker.\n\n3. **Persistence Setup**: The script automatically registers itself in the Windows startup registry, ensuring it runs after a system reboot. This is achieved using the `ctypes` library to interact with Windows APIs for registry manipulation.\n\n---\n\n## Setup and Usage\n\n### Prerequisites\n\n- **Python 3.x**\n- **Windows OS** (for testing registry persistence)\n\n### Attacker Machine Setup\n\n1. Use a tool like **Netcat** to set up a listener on your attacker machine:\n   ```bash\n   nc -lvp (port num)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famr-khaled-ahmed%2Fpython-reverse-shell-with-persistence","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famr-khaled-ahmed%2Fpython-reverse-shell-with-persistence","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famr-khaled-ahmed%2Fpython-reverse-shell-with-persistence/lists"}