fuck
This commit is contained in:
parent
1819c7dc48
commit
ef115eb3da
@ -6,4 +6,4 @@ from .scanner import HTTPZScanner
|
|||||||
from .colors import Colors
|
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}
|
show_fields = {k: True for k in show_fields}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create scanner instance
|
|
||||||
scanner = HTTPZScanner(
|
scanner = HTTPZScanner(
|
||||||
concurrent_limit=args.concurrent,
|
concurrent_limit=args.concurrent,
|
||||||
timeout=args.timeout,
|
timeout=args.timeout,
|
||||||
@ -149,8 +148,14 @@ async def main():
|
|||||||
shard=args.shard
|
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):
|
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:
|
if args.jsonl:
|
||||||
print(json.dumps(result))
|
print(json.dumps(result))
|
||||||
else:
|
else:
|
||||||
|
@ -74,6 +74,7 @@ class HTTPZScanner:
|
|||||||
self.exclude_codes = exclude_codes
|
self.exclude_codes = exclude_codes
|
||||||
self.resolvers = None
|
self.resolvers = None
|
||||||
self.processed_domains = 0
|
self.processed_domains = 0
|
||||||
|
self.progress_count = 0
|
||||||
|
|
||||||
|
|
||||||
async def init(self):
|
async def init(self):
|
||||||
@ -179,33 +180,10 @@ class HTTPZScanner:
|
|||||||
|
|
||||||
|
|
||||||
async def process_result(self, result):
|
async def process_result(self, result):
|
||||||
'''
|
'''Process a scan 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:
|
if self.show_progress:
|
||||||
info(f"{Colors.GRAY}[{self.processed_domains:,}]{Colors.RESET} {formatted}")
|
self.progress_count += 1
|
||||||
else:
|
info(f'[{self.progress_count}] {format_console_output(result, self.debug_mode, self.show_fields, self.match_codes, self.exclude_codes)}')
|
||||||
info(formatted)
|
|
||||||
|
|
||||||
|
|
||||||
async def scan(self, input_source):
|
async def scan(self, input_source):
|
||||||
|
2
setup.py
2
setup.py
@ -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.3',
|
version='2.0.4',
|
||||||
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',
|
||||||
|
Loading…
Reference in New Issue
Block a user