This commit is contained in:
Dionysus 2025-02-11 21:21:45 -05:00
parent 1819c7dc48
commit ef115eb3da
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
4 changed files with 14 additions and 31 deletions

View File

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

View File

@ -132,7 +132,6 @@ async def main():
show_fields = {k: True for k in show_fields}
try:
# Create scanner instance
scanner = HTTPZScanner(
concurrent_limit=args.concurrent,
timeout=args.timeout,
@ -149,8 +148,14 @@ async def main():
shard=args.shard
)
# Run the scanner and process results
# Run the scanner and handle output in ONE place
async for result in scanner.scan(args.file):
# Write to output file if specified
if args.output:
with open(args.output, 'a') as f:
f.write(json.dumps(result) + '\n')
# Print to console based on format
if args.jsonl:
print(json.dumps(result))
else:

View File

@ -74,6 +74,7 @@ class HTTPZScanner:
self.exclude_codes = exclude_codes
self.resolvers = None
self.processed_domains = 0
self.progress_count = 0
async def init(self):
@ -179,33 +180,10 @@ class HTTPZScanner:
async def process_result(self, result):
'''
Process and output a single result
:param result: result to process
'''
formatted = format_console_output(result, self.debug_mode, self.show_fields, self.match_codes, self.exclude_codes)
if formatted:
# Write to file if specified
if self.output_file:
if (not self.match_codes or result['status'] in self.match_codes) and \
(not self.exclude_codes or result['status'] not in self.exclude_codes):
async with aiohttp.ClientSession() as session:
with open(self.output_file, 'a') as f:
json.dump(result, f, ensure_ascii=False)
f.write('\n')
# Console output
if self.jsonl_output:
print(json.dumps(result))
else:
self.processed_domains += 1
'''Process a scan result'''
if self.show_progress:
info(f"{Colors.GRAY}[{self.processed_domains:,}]{Colors.RESET} {formatted}")
else:
info(formatted)
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):

View File

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