修复aiobrute中没有传semaphore参数问题

This commit is contained in:
shmilylty
2019-08-05 22:28:17 +08:00
parent a651c2148c
commit e3f9d5e149
2 changed files with 5 additions and 1 deletions
+2
View File
@@ -14,6 +14,7 @@ import queue
import secrets
import signal
import time
from functools import partial
import aiomultiprocess
import exrex
@@ -209,6 +210,7 @@ class AIOBrute(Module):
self.enable_wildcard, self.wildcard_ips, self.wildcard_ttl = detect_wildcard(domain)
tasks = self.gen_tasks(domain)
logger.log('INFOR', f'正在爆破{domain}的域名')
sem = asyncio.Semaphore(utils.get_semaphore())
for task in tqdm.tqdm(tasks, desc='Progress', smoothing=1.0, ncols=True):
async with aiomultiprocess.Pool(processes=self.processes, initializer=init_worker,
childconcurrency=self.coroutine) as pool:
+3 -1
View File
@@ -39,7 +39,7 @@ def aiodns_resolver():
timeout=config.resolver_timeout)
async def aiodns_query_a(hostname, semaphore):
async def aiodns_query_a(hostname, semaphore=None):
"""
异步查询A记录
@@ -47,6 +47,8 @@ async def aiodns_query_a(hostname, semaphore):
:param semaphore: 并发查询数量
:return: 主机名或查询结果或查询异常
"""
if semaphore is None:
semaphore = utils.get_semaphore()
async with semaphore:
resolver = aiodns_resolver()
answers = await resolver.query(hostname, 'A')