Skip to content

Commit

Permalink
Merge pull request #46 from Hackndo/2.1.3
Browse files Browse the repository at this point in the history
2.1.3 - Limit number of processes
  • Loading branch information
Hackndo authored Oct 13, 2020
2 parents effc87f + 432ae87 commit 45c1808
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# lsassy

[![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)
[![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)

![Example](https://github.com/Hackndo/lsassy/raw/master/assets/example.png)

Expand Down
11 changes: 10 additions & 1 deletion lsassy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# https://beta.hackndo.com

from multiprocessing import Process, RLock
import time

from lsassy.modules.dumper import Dumper
from lsassy.modules.impacketconnection import ImpacketConnection
Expand Down Expand Up @@ -221,13 +222,21 @@ def run(self):

def run():
targets = get_targets(get_args().target)
# Maximum 256 processes because maximum 256 opened files in python by default
processes = min(get_args().threads, 256)

if len(targets) == 1:
return CLI(targets[0]).run().error_code

jobs = [Process(target=CLI(target).run) for target in targets]
try:
for job in jobs:
# Checking running processes to avoid reaching --threads limit
while True:
counter = sum(1 for j in jobs if j.is_alive())
if counter >= processes:
time.sleep(1)
else:
break
job.start()
except KeyboardInterrupt as e:
print("\nQuitting gracefully...")
Expand Down
3 changes: 2 additions & 1 deletion lsassy/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def get_args():
group_dump.add_argument('--dumpname', action='store', help='Name given to lsass dump (Default: Random)')
group_dump.add_argument('--procdump', action='store', help='Procdump path')
group_dump.add_argument('--dumpert', action='store', help='dumpert path')
group_dump.add_argument('--threads', default=32, type=int, action='store', help='Threads number')
group_dump.add_argument('--timeout', default=10, type=int, action='store',
help='Timeout before considering lsass was not dumped successfully')

Expand Down Expand Up @@ -163,4 +164,4 @@ def terminate_jobs(jobs):
try:
job.terminate()
except Exception as e:
pass
pass
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setup(
name="lsassy",
version="2.1.2",
version="2.1.3",
author="Pixis",
author_email="[email protected]",
description="Python library to parse remote lsass dumps",
Expand Down

0 comments on commit 45c1808

Please sign in to comment.