Codebase list python-lsassy / 45c1808
Merge pull request #46 from Hackndo/2.1.3 2.1.3 - Limit number of processes Pixis authored 3 years ago GitHub committed 3 years ago
4 changed file(s) with 14 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
00 # lsassy
11
2 [![PyPI version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=py&type=6&v=2.1.2&x2=0)](https://pypi.org/project/lsassy/) [![Twitter](https://img.shields.io/twitter/follow/hackanddo?label=HackAndDo&style=social)](https://twitter.com/intent/follow?screen_name=hackanddo)
2 [![PyPI version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=py&type=6&v=2.1.3&x2=0)](https://pypi.org/project/lsassy/) [![Twitter](https://img.shields.io/twitter/follow/hackanddo?label=HackAndDo&style=social)](https://twitter.com/intent/follow?screen_name=hackanddo)
33
44 ![Example](https://github.com/Hackndo/lsassy/raw/master/assets/example.png)
55
44 # https://beta.hackndo.com
55
66 from multiprocessing import Process, RLock
7 import time
78
89 from lsassy.modules.dumper import Dumper
910 from lsassy.modules.impacketconnection import ImpacketConnection
220221
221222 def run():
222223 targets = get_targets(get_args().target)
224 # Maximum 256 processes because maximum 256 opened files in python by default
225 processes = min(get_args().threads, 256)
223226
224227 if len(targets) == 1:
225228 return CLI(targets[0]).run().error_code
226
227229 jobs = [Process(target=CLI(target).run) for target in targets]
228230 try:
229231 for job in jobs:
232 # Checking running processes to avoid reaching --threads limit
233 while True:
234 counter = sum(1 for j in jobs if j.is_alive())
235 if counter >= processes:
236 time.sleep(1)
237 else:
238 break
230239 job.start()
231240 except KeyboardInterrupt as e:
232241 print("\nQuitting gracefully...")
3737 group_dump.add_argument('--dumpname', action='store', help='Name given to lsass dump (Default: Random)')
3838 group_dump.add_argument('--procdump', action='store', help='Procdump path')
3939 group_dump.add_argument('--dumpert', action='store', help='dumpert path')
40 group_dump.add_argument('--threads', default=32, type=int, action='store', help='Threads number')
4041 group_dump.add_argument('--timeout', default=10, type=int, action='store',
4142 help='Timeout before considering lsass was not dumped successfully')
4243
162163 try:
163164 job.terminate()
164165 except Exception as e:
165 pass
166 pass
1212
1313 setup(
1414 name="lsassy",
15 version="2.1.2",
15 version="2.1.3",
1616 author="Pixis",
1717 author_email="[email protected]",
1818 description="Python library to parse remote lsass dumps",