add --no-progress to disable progress bar

main
famos0 2023-03-30 18:37:11 +02:00
parent 53b745b1b2
commit 1e3cf8f986
2 changed files with 16 additions and 11 deletions

View File

@ -40,7 +40,7 @@ def gen_cli_args():
parser.add_argument("-t", type=int, dest="threads", default=100, help="set how many concurrent threads to use (default: 100)") parser.add_argument("-t", type=int, dest="threads", default=100, help="set how many concurrent threads to use (default: 100)")
parser.add_argument("--timeout", default=None, type=int, help='max timeout in seconds of each thread (default: None)') parser.add_argument("--timeout", default=None, type=int, help='max timeout in seconds of each thread (default: None)')
parser.add_argument("--jitter", metavar='INTERVAL', type=str, help='sets a random delay between each connection (default: None)') parser.add_argument("--jitter", metavar='INTERVAL', type=str, help='sets a random delay between each connection (default: None)')
parser.add_argument("--progress", default=True, action='store_false', help='display progress bar during scan') parser.add_argument("--no-progress", action='store_true', help='Not displaying progress bar during scan')
parser.add_argument("--darrell", action='store_true', help='give Darrell a hand') parser.add_argument("--darrell", action='store_true', help='give Darrell a hand')
parser.add_argument("--verbose", action='store_true', help="enable verbose output") parser.add_argument("--verbose", action='store_true', help="enable verbose output")
parser.add_argument("--debug", action='store_true', help="enable debug level information") parser.add_argument("--debug", action='store_true', help="enable debug level information")

View File

@ -56,17 +56,22 @@ def create_db_engine(db_path):
async def start_run(protocol_obj, args, db, targets): async def start_run(protocol_obj, args, db, targets):
with Progress(console=cme_console) as progress:
cme_logger.debug(f"Creating ThreadPoolExecutor") cme_logger.debug(f"Creating ThreadPoolExecutor")
with ThreadPoolExecutor(max_workers=args.threads + 1) as executor: if args.no_progress:
current = 0 with ThreadPoolExecutor(max_workers=args.threads + 1) as executor:
total = len(targets) cme_logger.debug(f"Creating thread for {protocol_obj}")
tasks = progress.add_task(f"[green]Running CME against {total} {'target' if total == 1 else 'targets'}", total=total) _ = [executor.submit(protocol_obj, args, db, target) for target in targets]
cme_logger.debug(f"Creating thread for {protocol_obj}") else:
futures = [executor.submit(protocol_obj, args, db, target) for target in targets] with Progress(console=cme_console) as progress:
for future in concurrent.futures.as_completed(futures): with ThreadPoolExecutor(max_workers=args.threads + 1) as executor:
current += 1 current = 0
progress.update(tasks, completed=current) total = len(targets)
tasks = progress.add_task(f"[green]Running CME against {total} {'target' if total == 1 else 'targets'}", total=total)
cme_logger.debug(f"Creating thread for {protocol_obj}")
futures = [executor.submit(protocol_obj, args, db, target) for target in targets]
for future in concurrent.futures.as_completed(futures):
current += 1
progress.update(tasks, completed=current)
def main(): def main():