-
-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
binaryedge and zoomeye added in subdomain enum
- Loading branch information
1 parent
baa341b
commit 76c2a00
Showing
3 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |