Skip to content

Commit 5d5ecf9

Browse files
committed
- Add command to properly exit the entire application
- Improving docs - Code cleaning - Creating Pypi package files
1 parent bb27306 commit 5d5ecf9

File tree

5 files changed

+81
-20
lines changed

5 files changed

+81
-20
lines changed

MANIFEST.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include LICENSE
2+
include *.in
3+
include *.py
4+
include multicat/*.cfg
5+
global-exclude *.pyc *.pyo *~
6+
global-exclude *test*
7+
global-exclude *tmp*
8+
prune __pycache__
9+
prune */__pycache__
10+
prune build
11+
prune dist
12+
prune multicat/tests

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,32 @@ Sometimes you have to spread the same payload to multiple targets and don't know
2121
<p align="right">(<a href="#top">back to top</a>)</p>
2222

2323

24+
<!-- INSTALLATION -->
25+
## Installation
26+
```commandline
27+
pip install multicat
28+
```
29+
2430
<!-- USAGE EXAMPLES -->
2531
## Usage
32+
33+
To start listening on the port of your choice:
2634
```commandline
35+
mc -p 1234
36+
```
37+
38+
### Arguments
2739

28-
Usage: mc.py [-h] [-p] [-m] [-t]
40+
```commandline
41+
Usage: mc [-h] [-p] [-m] [-t]
2942
3043
-h, --help show this help message and exit
3144
-p , --port port to listen (default: 28000)
3245
-m , --max-clients max number of new clients to queue before establish connection (default: 5)
3346
-t , --timeout connections timeout (default: 10)
34-
3547
```
3648

49+
### Commands
3750
Available commands in general menu context:
3851
```commandline
3952
COMMAND DESCRIPTION
@@ -42,6 +55,7 @@ HELP List available commands
4255
SESSIONS List established sessions
4356
START <id> Interact with a client
4457
CLOSE <id> Close an specific connection
58+
EXIT / QUIT Exit the entire application
4559
```
4660

4761
Available commands in session context:

mc.py renamed to multicat/mc.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://github.com/r3nt0n/multicat
44
# multicat - multithread reverse shell listener
55

6-
import socket, threading, time, sys, argparse
6+
import socket, threading, time, argparse, os
77

88
name = 'multicat'
99
desc = 'Multithread reverse shell listener'
@@ -80,15 +80,13 @@ def listenToClient(self, client_object):
8080
except UnicodeDecodeError:
8181
print(output.decode('latin-1'), end='')
8282

83-
#command = input('') + '\n'
8483
command = input('')
8584
if command.upper() in ('HELP', '?'):
8685
print(f'\n{color.BOLD}COMMAND\t\tDESCRIPTION{color.END}')
8786
print(f'------------------------------------')
8887
print('STOP\t\tStop interacting with the current session')
8988
print('CLOSE \t\tClose the current connection')
9089
command = ''
91-
#if command.rstrip('\n').upper() == 'STOP':
9290
if command.upper() == 'STOP':
9391
if input(f'\n{color.ORANGE}[?]{color.END} Do you want to {color.ORANGE}stop{color.END} this session? [y/N] ').lower() == 'y':
9492
print()
@@ -136,8 +134,11 @@ def menu(self):
136134
print('SESSIONS\tList established sessions')
137135
print('START <id>\tInteract with a client')
138136
print('CLOSE <id>\tClose an specific connection')
137+
print('EXIT / QUIT\tExit the entire application')
139138
print()
140-
#elif user_input.upper().startswith('HELP'):
139+
140+
elif user_input.upper() in ('EXIT', 'QUIT'):
141+
os._exit(0)
141142

142143
elif user_input.upper().startswith('SESSIONS'):
143144
print(f'\n{color.BOLD}ID\tRemote address\tRemote port{color.END}')
@@ -179,22 +180,15 @@ def run(self):
179180
thread.start()
180181
return
181182

182-
if __name__ == "__main__":
183183

184+
def main():
184185
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()
196186
port, max_clients, timeout = process_args()
197187
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+
200194

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[metadata]
2+
description-file=README.md
3+
license_files=LICENSE

setup.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
# https://github.com/r3nt0n/multicat
4+
5+
# packages with python3 setup.py -v sdist
6+
7+
from setuptools import setup, find_packages
8+
from multicat.mc import __version__, desc
9+
10+
# Read project description
11+
with open('README.md', 'r') as f:
12+
long_desc = f.read()
13+
14+
setup(
15+
name='multicat',
16+
version=__version__,
17+
author='r3nt0n',
18+
author_email='r3nt0n@protonmail.com',
19+
url='https://github.com/r3nt0n/multicat',
20+
license='GNU General Public License v3.0',
21+
description=desc,
22+
long_description=long_desc,
23+
long_description_content_type="text/markdown",
24+
include_package_data=True,
25+
package_data={
26+
# If any package contains *.cfg files, include them
27+
'': ['*.cfg'],
28+
},
29+
#packages=['modules',],
30+
#packages=find_packages(),
31+
packages=['multicat'],
32+
#install_requires=[],
33+
entry_points = {
34+
'console_scripts':[
35+
'mc = multicat.mc:main'
36+
]
37+
}
38+
)

0 commit comments

Comments
 (0)