Skip to content

Commit

Permalink
binaryedge and zoomeye added in subdomain enum
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhiteh4t committed Jun 24, 2024
1 parent baa341b commit 76c2a00
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/subdom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
from modules.subdomain_modules.virustotal_subs import virust
from modules.subdomain_modules.shodan_subs import shodan
from modules.subdomain_modules.certspot_subs import certspot
from modules.subdomain_modules.wayback_subs import machine
# from modules.subdomain_modules.wayback_subs import machine
from modules.subdomain_modules.crtsh_subs import crtsh
from modules.subdomain_modules.htarget_subs import hackertgt
from modules.subdomain_modules.binedge_subs import binedge
from modules.subdomain_modules.zoomeye_subs import zoomeye

R = '\033[31m' # red
G = '\033[32m' # green
Expand All @@ -36,9 +38,11 @@ async def query(hostname, tout, conf_path):
virust(hostname, conf_path, session),
shodan(hostname, conf_path, session),
certspot(hostname, session),
#machine(hostname, session),
# machine(hostname, session),
hackertgt(hostname, session),
crtsh(hostname, session)
crtsh(hostname, session),
binedge(hostname, conf_path, session),
zoomeye(hostname, conf_path, session)
)
await session.close()

Expand Down
58 changes: 58 additions & 0 deletions modules/subdomain_modules/binedge_subs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python3

from os import environ
from json import loads, dumps
import modules.subdom as parent
from modules.write_log import log_writer

R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' # white
Y = '\033[33m' # yellow


async def binedge(hostname, conf_path, session):
binedge_key = environ.get('FR_BINEDGE_KEY')

if not binedge_key:
log_writer('[binedge_subs] key missing in env')
with open(f'{conf_path}/keys.json', 'r') as keyfile:
json_read = keyfile.read()

json_load = loads(json_read)
try:
binedge_key = json_load['binedge']
except KeyError:
log_writer('[binedge_subs] key missing in keys.json')
with open(f'{conf_path}/keys.json', 'w') as outfile:
json_load['binedge'] = None
binedge_key = None
outfile.write(
dumps(json_load, sort_keys=True, indent=4)
)

if binedge_key is not None:
print(f'{Y}[!] {C}Requesting {G}BinaryEdge{W}')
url = f'https://api.binaryedge.io/v2/query/domains/subdomain/{hostname}'
header = {'X-key': binedge_key}

try:
async with session.get(url, headers=header) as resp:
status = resp.status
if status == 200:
json_data = await resp.json()
subdomains = json_data['events']
print(f'{G}[+] {Y}binedge {W}found {C}{len(subdomains)} {W}subdomains!')
parent.found.extend(subdomains)
else:
print(f'{R}[-] {C}binedge Status : {W}{status}')
log_writer(f'[binedge_subs] Status = {status}, expected 200')

except Exception as exc:
print(f'{R}[-] {C}binedge Exception : {W}{exc}')
log_writer(f'[binedge_subs] Exception = {exc}')
else:
print(f'{Y}[!] Skipping binedge : {W}API key not found!')
log_writer('[binedge_subs] API key not found')
log_writer('[binedge_subs] Completed')
62 changes: 62 additions & 0 deletions modules/subdomain_modules/zoomeye_subs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env python3

from os import environ
from json import loads, dumps
import modules.subdom as parent
from modules.write_log import log_writer

R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' # white
Y = '\033[33m' # yellow


async def zoomeye(hostname, conf_path, session):
zoomeye_key = environ.get('FR_ZOOMEYE_KEY')

if not zoomeye_key:
log_writer('[zoomeye_subs] key missing in env')
with open(f'{conf_path}/keys.json', 'r') as keyfile:
json_read = keyfile.read()

json_load = loads(json_read)
try:
zoomeye_key = json_load['zoomeye']
except KeyError:
log_writer('[zoomeye_subs] key missing in keys.json')
with open(f'{conf_path}/keys.json', 'w') as outfile:
json_load['zoomeye'] = None
zoomeye_key = None
outfile.write(
dumps(json_load, sort_keys=True, indent=4)
)

if zoomeye_key is not None:
print(f'{Y}[!] {C}Requesting {G}ZoomEye{W}')
url = f'https://api.zoomeye.hk/domain/search?q={hostname}&type=0'
header = {
'API-KEY': zoomeye_key,
'User-Agent': 'curl'
}

try:
async with session.get(url, headers=header) as resp:
status = resp.status
if status == 200:
json_data = await resp.json()
subdomain_list = json_data['list']
subdomains = [subd['name'] for subd in subdomain_list]
print(f'{G}[+] {Y}zoomeye {W}found {C}{len(subdomains)} {W}subdomains!')
parent.found.extend(subdomains)
else:
print(f'{R}[-] {C}zoomeye Status : {W}{status}')
log_writer(f'[zoomeye_subs] Status = {status}, expected 200')

except Exception as exc:
print(f'{R}[-] {C}zoomeye Exception : {W}{exc}')
log_writer(f'[zoomeye_subs] Exception = {exc}')
else:
print(f'{Y}[!] Skipping zoomeye : {W}API key not found!')
log_writer('[zoomeye_subs] API key not found')
log_writer('[zoomeye_subs] Completed')

0 comments on commit 76c2a00

Please sign in to comment.