Skip to content

Commit

Permalink
removed uneccessary aiodns req
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhiteh4t committed May 18, 2024
1 parent 2c7c14e commit fd6c220
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 32 deletions.
4 changes: 2 additions & 2 deletions conf/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"common": {
"timeout": 30
"timeout": 30,
"dns_servers": "8.8.8.8, 8.8.4.4, 1.1.1.1, 1.0.0.1"
},
"ssl_cert": {
"ssl_port": 443
Expand All @@ -12,7 +13,6 @@
"threads": 50,
"redirect": false,
"verify_ssl": false,
"dns_server": "8.8.8.8, 8.8.4.4, 1.1.1.1, 1.0.0.1",
"extension": ""
},
"export": {
Expand Down
10 changes: 5 additions & 5 deletions finalrecon.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
r=config.dir_enum_redirect,
s=config.dir_enum_sslv,
sp=config.ssl_port,
d=config.dir_enum_dns,
d=config.custom_dns,
e=config.dir_enum_ext,
o=config.export_fmt,
cd=config.usr_data
Expand Down Expand Up @@ -251,12 +251,12 @@ def save_key(key_string):
headers(target, out_settings, data)
cert(hostname, sslp, out_settings, data)
whois_lookup(domain, domain_suffix, path_to_script, out_settings, data)
dnsrec(hostname, out_settings, data)
dnsrec(hostname, dserv, out_settings, data)
if not type_ip and not private_ip:
subdomains(hostname, tout, out_settings, data, conf_path)
scan(ip, out_settings, data, pscan_threads)
crawler(target, protocol, netloc, out_settings, data)
hammer(target, threads, tout, wdlist, redir, sslv, dserv, out_settings, data, filext)
hammer(target, threads, tout, wdlist, redir, sslv, out_settings, data, filext)
timetravel(target, data, out_settings)

if headinfo:
Expand All @@ -282,7 +282,7 @@ def save_key(key_string):
if dns:
from modules.dns import dnsrec
log_writer('Starting DNS enum...')
dnsrec(hostname, out_settings, data)
dnsrec(hostname, dserv, out_settings, data)

if subd and not type_ip and not private_ip:
from modules.subdom import subdomains
Expand All @@ -307,7 +307,7 @@ def save_key(key_string):
if dirrec:
from modules.dirrec import hammer
log_writer('Starting dir enum...')
hammer(target, threads, tout, wdlist, redir, sslv, dserv, out_settings, data, filext)
hammer(target, threads, tout, wdlist, redir, sslv, out_settings, data, filext)

if not any([full, headinfo, sslinfo, whois, crawl, dns, subd, wback, pscan, dirrec]):
print(f'\n{R}[-] Error : {C}At least One Argument is Required with URL{W}')
Expand Down
10 changes: 4 additions & 6 deletions modules/dirrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ async def consumer(queue, target, session, redir, total_num_words):
print(f'{Y}[!] {C}Requests : {W}{count}/{total_num_words}', end='\r')


async def run(target, threads, tout, wdlist, redir, sslv, dserv, filext, total_num_words):
async def run(target, threads, tout, wdlist, redir, sslv, filext, total_num_words):
queue = asyncio.Queue(maxsize=threads)

resolver = aiohttp.AsyncResolver(nameservers=dserv.split(', '))
conn = aiohttp.TCPConnector(limit=threads, resolver=resolver, family=socket.AF_INET, verify_ssl=sslv)
conn = aiohttp.TCPConnector(limit=threads, family=socket.AF_INET, verify_ssl=sslv)
timeout = aiohttp.ClientTimeout(total=None, sock_connect=tout, sock_read=tout)
async with aiohttp.ClientSession(connector=conn, timeout=timeout) as session:
distrib = asyncio.create_task(insert(queue, filext, target, wdlist, redir))
Expand Down Expand Up @@ -131,14 +130,13 @@ def dir_output(output, data):
export(output, data)


def hammer(target, threads, tout, wdlist, redir, sslv, dserv, output, data, filext):
def hammer(target, threads, tout, wdlist, redir, sslv, output, data, filext):
print(f'\n{Y}[!] Starting Directory Enum...{W}\n')
print(f'{G}[+] {C}Threads : {W}{threads}')
print(f'{G}[+] {C}Timeout : {W}{tout}')
print(f'{G}[+] {C}Wordlist : {W}{wdlist}')
print(f'{G}[+] {C}Allow Redirects : {W}{redir}')
print(f'{G}[+] {C}SSL Verification : {W}{sslv}')
print(f'{G}[+] {C}DNS Servers : {W}{dserv}')
with open(wdlist, 'r') as wordlist:
num_words = sum(1 for i in wordlist)
print(f'{G}[+] {C}Wordlist Size : {W}{num_words}')
Expand All @@ -150,7 +148,7 @@ def hammer(target, threads, tout, wdlist, redir, sslv, dserv, output, data, file

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(run(target, threads, tout, wdlist, redir, sslv, dserv, filext, total_num_words))
loop.run_until_complete(run(target, threads, tout, wdlist, redir, sslv, filext, total_num_words))
dir_output(output, data)
loop.close()
log_writer('[dirrec] Completed')
4 changes: 2 additions & 2 deletions modules/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Y = '\033[33m' # yellow


def dnsrec(domain, output, data):
def dnsrec(domain, dns_servers, output, data):
result = {}
print(f'\n{Y}[!] Starting DNS Enumeration...{W}\n')
dns_records = ['A', 'AAAA', 'AFSDB', 'APL', 'CAA', 'CDNSKEY', 'CDS', 'CERT',
Expand All @@ -24,7 +24,7 @@ def dnsrec(domain, output, data):
full_ans = []

res = dns.asyncresolver.Resolver(configure=False)
res.nameservers = ['1.1.1.1', '1.0.0.1', '8.8.8.8', '8.8.4.4', '9.9.9.9', '149.112.112.112']
res.nameservers = dns_servers


async def fetch_records(res, domain, record):
Expand Down
38 changes: 21 additions & 17 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,24 @@
if not path.exists(usr_data):
makedirs(usr_data, exist_ok=True)

with open(conf_file_path, 'r') as config_file:
config_read = config_file.read()
config_json = loads(config_read)
timeout = config_json['common']['timeout']

ssl_port = config_json['ssl_cert']['ssl_port']

port_scan_th = config_json['port_scan']['threads']

dir_enum_th = config_json['dir_enum']['threads']
dir_enum_redirect = config_json['dir_enum']['redirect']
dir_enum_sslv = config_json['dir_enum']['verify_ssl']
dir_enum_dns = config_json['dir_enum']['dns_server']
dir_enum_ext = config_json['dir_enum']['extension']
dir_enum_wlist = f'{path_to_script}/wordlists/dirb_common.txt'

export_fmt = config_json['export']['format']
while True:
with open(conf_file_path, 'r') as config_file:
config_read = config_file.read()
config_json = loads(config_read)

try:
timeout = config_json['common']['timeout']
custom_dns = config_json['common']['dns_servers'].split(', ')
ssl_port = config_json['ssl_cert']['ssl_port']
port_scan_th = config_json['port_scan']['threads']
dir_enum_th = config_json['dir_enum']['threads']
dir_enum_redirect = config_json['dir_enum']['redirect']
dir_enum_sslv = config_json['dir_enum']['verify_ssl']
dir_enum_ext = config_json['dir_enum']['extension']
dir_enum_wlist = f'{path_to_script}/wordlists/dirb_common.txt'
export_fmt = config_json['export']['format']
except KeyError:
# reset conf.json
copytree(src_conf_path, conf_path, dirs_exist_ok=True)
else:
break

0 comments on commit fd6c220

Please sign in to comment.