|
3 | 3 | # https://github.com/r3nt0n/multicat |
4 | 4 | # multicat - multithread reverse shell listener |
5 | 5 |
|
6 | | -import socket, threading, time, sys, argparse |
| 6 | +import socket, threading, time, argparse, os |
7 | 7 |
|
8 | 8 | name = 'multicat' |
9 | 9 | desc = 'Multithread reverse shell listener' |
@@ -80,15 +80,13 @@ def listenToClient(self, client_object): |
80 | 80 | except UnicodeDecodeError: |
81 | 81 | print(output.decode('latin-1'), end='') |
82 | 82 |
|
83 | | - #command = input('') + '\n' |
84 | 83 | command = input('') |
85 | 84 | if command.upper() in ('HELP', '?'): |
86 | 85 | print(f'\n{color.BOLD}COMMAND\t\tDESCRIPTION{color.END}') |
87 | 86 | print(f'------------------------------------') |
88 | 87 | print('STOP\t\tStop interacting with the current session') |
89 | 88 | print('CLOSE \t\tClose the current connection') |
90 | 89 | command = '' |
91 | | - #if command.rstrip('\n').upper() == 'STOP': |
92 | 90 | if command.upper() == 'STOP': |
93 | 91 | if input(f'\n{color.ORANGE}[?]{color.END} Do you want to {color.ORANGE}stop{color.END} this session? [y/N] ').lower() == 'y': |
94 | 92 | print() |
@@ -136,8 +134,11 @@ def menu(self): |
136 | 134 | print('SESSIONS\tList established sessions') |
137 | 135 | print('START <id>\tInteract with a client') |
138 | 136 | print('CLOSE <id>\tClose an specific connection') |
| 137 | + print('EXIT / QUIT\tExit the entire application') |
139 | 138 | print() |
140 | | - #elif user_input.upper().startswith('HELP'): |
| 139 | + |
| 140 | + elif user_input.upper() in ('EXIT', 'QUIT'): |
| 141 | + os._exit(0) |
141 | 142 |
|
142 | 143 | elif user_input.upper().startswith('SESSIONS'): |
143 | 144 | print(f'\n{color.BOLD}ID\tRemote address\tRemote port{color.END}') |
@@ -179,22 +180,15 @@ def run(self): |
179 | 180 | thread.start() |
180 | 181 | return |
181 | 182 |
|
182 | | -if __name__ == "__main__": |
183 | 183 |
|
| 184 | +def main(): |
184 | 185 | print(f'\n{name} by r3nt0n - https://github.com/r3nt0n/multicat\n') |
185 | | - # |
186 | | - # if len(sys.argv) == 2: |
187 | | - # port_num = sys.argv[1] |
188 | | - # try: |
189 | | - # port_num = int(port_num) |
190 | | - # if port_num < 0: |
191 | | - # raise ValueError |
192 | | - # except ValueError: |
193 | | - # print(f'{color.RED}[!]{color.END} ERROR: Invalid listening port') |
194 | | - # sys.exit(1) |
195 | | - #ThreadedServer('', port_num).run() |
196 | 186 | port, max_clients, timeout = process_args() |
197 | 187 | ThreadedServer('', port, max_clients, timeout).run() |
198 | | - # else: |
199 | | - # print(f'Usage: {sys.argv[0]} <listening-port>') |
| 188 | + |
| 189 | + |
| 190 | +if __name__ == "__main__": |
| 191 | + main() |
| 192 | + |
| 193 | + |
200 | 194 |
|
0 commit comments