diff --git a/cme/cli.py b/cme/cli.py index 12738d8a..f3aae380 100755 --- a/cme/cli.py +++ b/cme/cli.py @@ -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("--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("--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("--verbose", action='store_true', help="enable verbose output") parser.add_argument("--debug", action='store_true', help="enable debug level information") diff --git a/cme/crackmapexec.py b/cme/crackmapexec.py index f4e8f58b..29bca2a7 100755 --- a/cme/crackmapexec.py +++ b/cme/crackmapexec.py @@ -56,17 +56,22 @@ def create_db_engine(db_path): async def start_run(protocol_obj, args, db, targets): - with Progress(console=cme_console) as progress: cme_logger.debug(f"Creating ThreadPoolExecutor") - with ThreadPoolExecutor(max_workers=args.threads + 1) as executor: - current = 0 - 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) + if args.no_progress: + with ThreadPoolExecutor(max_workers=args.threads + 1) as executor: + cme_logger.debug(f"Creating thread for {protocol_obj}") + _ = [executor.submit(protocol_obj, args, db, target) for target in targets] + else: + with Progress(console=cme_console) as progress: + with ThreadPoolExecutor(max_workers=args.threads + 1) as executor: + current = 0 + 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():