fuck
This commit is contained in:
parent
1819c7dc48
commit
ef115eb3da
@ -6,4 +6,4 @@ from .scanner import HTTPZScanner
|
||||
from .colors import Colors
|
||||
|
||||
|
||||
__version__ = '2.0.3'
|
||||
__version__ = '2.0.4'
|
@ -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:
|
||||
|
@ -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
|
||||
if self.show_progress:
|
||||
info(f"{Colors.GRAY}[{self.processed_domains:,}]{Colors.RESET} {formatted}")
|
||||
else:
|
||||
info(formatted)
|
||||
'''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):
|
||||
|
Loading…
Reference in New Issue
Block a user