Skip to content

Commit

Permalink
read api keys from env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhiteh4t committed Jun 22, 2024
1 parent 37d5d85 commit 724714c
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 71 deletions.
8 changes: 4 additions & 4 deletions modules/subdomain_modules/anubis_subs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python3

from json import loads
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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer


async def anubisdb(hostname, session):
print(f'{Y}[!] {C}Requesting {G}AnubisDB{W}')
Expand Down
41 changes: 23 additions & 18 deletions modules/subdomain_modules/bevigil_subs.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
#!/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

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


async def bevigil(hostname, conf_path, session):
with open(f'{conf_path}/keys.json', 'r') as keyfile:
json_read = keyfile.read()

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

if not bevigil_key:
log_writer('[bevigil_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:
bevigil_key = json_load['bevigil']
except KeyError:
log_writer('[bevigil_subs] key missing in keys.json')
with open(f'{conf_path}/keys.json', 'w') as outfile:
json_load['bevigil'] = None
bevigil_key = None
outfile.write(
dumps(json_load, sort_keys=True, indent=4)
)

if bevigil_key is not None:
print(f'{Y}[!] {C}Requesting {G}BeVigil{W}')
Expand Down
8 changes: 4 additions & 4 deletions modules/subdomain_modules/certspot_subs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python3

from json import loads
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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer


async def certspot(hostname, session):
print(f'{Y}[!] {C}Requesting {G}CertSpotter{W}')
Expand Down
7 changes: 4 additions & 3 deletions modules/subdomain_modules/crtsh_subs.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env python3

from json import loads
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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer

async def crtsh(hostname, session):
print(f'{Y}[!] {C}Requesting {G}crt.sh{W}')
Expand Down
30 changes: 22 additions & 8 deletions modules/subdomain_modules/fb_subs.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
#!/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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer


async def fb_cert(hostname, conf_path, session):
with open(f'{conf_path}/keys.json', 'r') as keyfile:
json_read = keyfile.read()
fb_key = environ.get('FR_FB_KEY')

json_load = loads(json_read)
fb_key = json_load['facebook']
if not fb_key:
log_writer('[fb_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:
fb_key = json_load['facebook']
except KeyError:
log_writer('[fb_subs] key missing in keys.json')
with open(f'{conf_path}/keys.json', 'w') as outfile:
json_load['facebook'] = None
fb_key = None
outfile.write(
dumps(json_load, sort_keys=True, indent=4)
)

if fb_key is not None:
print(f'{Y}[!] {C}Requesting {G}Facebook{W}')
Expand Down
6 changes: 3 additions & 3 deletions modules/subdomain_modules/htarget_subs.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python3

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

import modules.subdom as parent
from modules.write_log import log_writer


async def hackertgt(hostname, session):
print(f'{Y}[!] {C}Requesting {G}HackerTarget{W}')
Expand Down
30 changes: 22 additions & 8 deletions modules/subdomain_modules/shodan_subs.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
#!/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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer


async def shodan(hostname, conf_path, session):
with open(f'{conf_path}/keys.json', 'r') as keyfile:
json_read = keyfile.read()
sho_key = environ.get('FR_SHODAN_KEY')

json_load = loads(json_read)
sho_key = json_load['shodan']
if not sho_key:
log_writer('[shodan_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:
sho_key = json_load['shodan']
except KeyError:
log_writer('[shodan_subs] key missing in keys.json')
with open(f'{conf_path}/keys.json', 'w') as outfile:
json_load['shodan'] = None
sho_key = None
outfile.write(
dumps(json_load, sort_keys=True, indent=4)
)

if sho_key is not None:
print(f'{Y}[!] {C}Requesting {G}Shodan{W}')
Expand Down
8 changes: 4 additions & 4 deletions modules/subdomain_modules/sonar_subs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python3

from json import loads
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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer


async def sonar(hostname, session):
print(f'{Y}[!] {C}Requesting {G}Sonar{W}')
Expand Down
8 changes: 4 additions & 4 deletions modules/subdomain_modules/thcrowd_subs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python3

from json import loads
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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer


async def thcrowd(hostname, session):
print(f'{Y}[!] {C}Requesting {G}ThreatCrowd{W}')
Expand Down
8 changes: 4 additions & 4 deletions modules/subdomain_modules/thminer_subs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python3

from json import loads
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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer


async def thminer(hostname, session):
print(f'{Y}[!] {C}Requesting {G}ThreatMiner{W}')
Expand Down
30 changes: 22 additions & 8 deletions modules/subdomain_modules/virustotal_subs.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
#!/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

from json import loads
import modules.subdom as parent
from modules.write_log import log_writer


async def virust(hostname, conf_path, session):
with open(f'{conf_path}/keys.json', 'r') as keyfile:
json_read = keyfile.read()
vt_key = environ.get('FR_VT_KEY')

json_load = loads(json_read)
vt_key = json_load['virustotal']
if not vt_key:
log_writer('[virustotal_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:
vt_key = json_load['virustotal']
except KeyError:
log_writer('[virustotal_subs] key missing in keys.json')
with open(f'{conf_path}/keys.json', 'w') as outfile:
json_load['virustotal'] = None
vt_key = None
outfile.write(
dumps(json_load, sort_keys=True, indent=4)
)

if vt_key is not None:
print(f'{Y}[!] {C}Requesting {G}VirusTotal{W}')
Expand Down
6 changes: 3 additions & 3 deletions modules/subdomain_modules/wayback_subs.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python3

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

import modules.subdom as parent
from modules.write_log import log_writer


async def machine(hostname, session):
print(f'{Y}[!] {C}Requesting {G}Wayback{W}')
Expand Down

0 comments on commit 724714c

Please sign in to comment.