This commit is contained in:
Dionysus 2025-02-11 21:25:47 -05:00
parent ef115eb3da
commit d5ce06ed1e
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
4 changed files with 21 additions and 18 deletions

View File

@ -6,4 +6,4 @@ from .scanner import HTTPZScanner
from .colors import Colors from .colors import Colors
__version__ = '2.0.4' __version__ = '2.0.5'

View File

@ -148,14 +148,19 @@ async def main():
shard=args.shard shard=args.shard
) )
# Run the scanner and handle output in ONE place # Run the scanner and handle ALL output here
count = 0
async for result in scanner.scan(args.file): async for result in scanner.scan(args.file):
# Write to output file if specified # Write to output file if specified
if args.output: if args.output:
with open(args.output, 'a') as f: with open(args.output, 'a') as f:
f.write(json.dumps(result) + '\n') f.write(json.dumps(result) + '\n')
# Print to console based on format # Console output
if args.progress:
count += 1
info(f"[{count}] {format_console_output(result, args.debug, show_fields, args.match_codes, args.exclude_codes)}")
else:
if args.jsonl: if args.jsonl:
print(json.dumps(result)) print(json.dumps(result))
else: else:

View File

@ -179,13 +179,6 @@ class HTTPZScanner:
return result return result
async def process_result(self, result):
'''Process a scan result'''
if self.show_progress:
self.progress_count += 1
info(f'[{self.progress_count}] {format_console_output(result, self.debug_mode, self.show_fields, self.match_codes, self.exclude_codes)}')
async def scan(self, input_source): async def scan(self, input_source):
''' '''
Scan domains from a file, stdin, or async generator Scan domains from a file, stdin, or async generator
@ -203,6 +196,7 @@ class HTTPZScanner:
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session: async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
tasks = set() tasks = set()
count = 0 # Move counter here since that's all process_result was doing
# Handle different input types # Handle different input types
if isinstance(input_source, str): if isinstance(input_source, str):
@ -215,7 +209,8 @@ class HTTPZScanner:
) )
for task in done: for task in done:
result = await task result = await task
await self.process_result(result) if self.show_progress:
count += 1 # Increment counter here
yield result yield result
task = asyncio.create_task(self.check_domain(session, domain)) task = asyncio.create_task(self.check_domain(session, domain))
@ -231,7 +226,8 @@ class HTTPZScanner:
) )
for task in done: for task in done:
result = await task result = await task
await self.process_result(result) if self.show_progress:
count += 1
yield result yield result
task = asyncio.create_task(self.check_domain(session, domain)) task = asyncio.create_task(self.check_domain(session, domain))
@ -252,7 +248,8 @@ class HTTPZScanner:
) )
for task in done: for task in done:
result = await task result = await task
await self.process_result(result) if self.show_progress:
count += 1
yield result yield result
task = asyncio.create_task(self.check_domain(session, domain)) task = asyncio.create_task(self.check_domain(session, domain))
@ -264,5 +261,6 @@ class HTTPZScanner:
done, _ = await asyncio.wait(tasks) done, _ = await asyncio.wait(tasks)
for task in done: for task in done:
result = await task result = await task
await self.process_result(result) if self.show_progress:
count += 1
yield result yield result

View File

@ -10,7 +10,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
setup( setup(
name='httpz_scanner', name='httpz_scanner',
version='2.0.4', version='2.0.5',
author='acidvegas', author='acidvegas',
author_email='acid.vegas@acid.vegas', author_email='acid.vegas@acid.vegas',
description='Hyper-fast HTTP Scraping Tool', description='Hyper-fast HTTP Scraping Tool',