Skip to content

Commit cb6e333

Browse files
debug fqdn_scanner
1 parent 43158f4 commit cb6e333

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

api/global_parser.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ def main(domain: str, config: configuration):
3838
warn = ""
3939
logger.info(f"[*] No subdomains of {domain} found from {os_file}")
4040
else:
41-
#remove duplicates
41+
# remove duplicates
4242
results = list(dict.fromkeys(results))
43-
logger.info(
44-
f"[*] {len(results)} subdomains of {domain} found"
45-
)
43+
logger.info(f"[*] {len(results)} subdomains of {domain} found")
4644
except Exception as e:
4745
logger.error(f"Impossible to get subdomains of {domain} from {os_file}")
4846
continue

api/hackertarget.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ def main(domain, handler: handler, key: str):
99
# get all the subdomain of the domain from hackertarget
1010
# the url is https://api.hackertarget.com/hostsearch/?q={domain}
1111
# key is the api key
12-
if key :
13-
url = (
14-
"https://api.hackertarget.com/hostsearch/?q="
15-
+ domain
16-
+ "&apikey="
17-
+ key
18-
)
12+
if key:
13+
url = "https://api.hackertarget.com/hostsearch/?q=" + domain + "&apikey=" + key
1914
else:
2015
url = "https://api.hackertarget.com/hostsearch/?q=" + domain
2116
try:

configuration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Proxy :
2-
activate: False
2+
activate: True
33
file: null #path to file, one proxy per line
44
links:
55
https://raw.githubusercontent.com/mertguvencli/http-proxy-list/main/proxy-list/data.txt : "http"

lib/generics.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def clear_screen():
3535
os.system("cls" if os.name == "nt" else "clear")
3636

3737

38-
def fqdn_scanner(main_fqdn: str, config: configuration, res: result, recursive: int = 0):
38+
def fqdn_scanner(
39+
main_fqdn: str, config: configuration, res: result, recursive: int = 0
40+
):
3941
logger.info("[*] Scanning fqdn {}".format(main_fqdn))
4042
main_domain = domain(main_fqdn, config)
4143
if main_domain.ip == "Dead":
@@ -100,7 +102,10 @@ def fqdn_scanner(main_fqdn: str, config: configuration, res: result, recursive:
100102
sub_domain_future = executor.submit(domain, fqdn, config)
101103
futures_domain_recursive[fqdn] = sub_domain_future
102104
futures_get_subs.append(
103-
executor.submit(sub_domain_future.result().get_subs, config.ip_trough_proxy)
105+
executor.submit(
106+
sub_domain_future.result().get_subs,
107+
config.ip_trough_proxy,
108+
)
104109
)
105110
logger.info(
106111
"[*] Waiting for {} threads to finish to getting subs".format(
@@ -115,7 +120,11 @@ def fqdn_scanner(main_fqdn: str, config: configuration, res: result, recursive:
115120
# remove duplicates
116121
subs = list(dict.fromkeys(subs))
117122
for fqdn in tqdm(subs, desc="Processing subdomains", ncols=100):
118-
if fqdn == "localhost" or config.is_there_scope() or fqdn not in futures_domain_recursive and not futures_scope[fqdn] :
123+
if (
124+
fqdn == "localhost"
125+
or config.is_there_scope()
126+
or fqdn not in futures_domain_recursive
127+
):
119128
continue
120129
sub_domain = futures_domain_recursive[fqdn].result()
121130
if sub_domain.ip == "Dead":
@@ -132,8 +141,6 @@ def fqdn_scanner(main_fqdn: str, config: configuration, res: result, recursive:
132141
res.status()
133142

134143

135-
136-
137144
def ip_scanner(ip: str, config: configuration, res: result, recursive: int = 0):
138145
ip_obj = ip_lib.ip(ip, config)
139146
res.add_ip(ip_obj)

lib/handler.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ def get(self, url, params=None, headers=None, redirect=True, until_ok=False):
101101
while True:
102102
if not self.there_is_proxy():
103103
try:
104-
data = http.request("GET", url, headers=headers, timeout=3.0, redirect=redirect)
104+
data = http.request(
105+
"GET", url, headers=headers, timeout=3.0, redirect=redirect
106+
)
105107
except:
106108
data = None
107109
return data
@@ -131,12 +133,17 @@ def get(self, url, params=None, headers=None, redirect=True, until_ok=False):
131133
)
132134
try:
133135
# don't use proxy
134-
data = http.request("GET", url, headers=headers, timeout=3.0, redirect=redirect)
136+
data = http.request(
137+
"GET",
138+
url,
139+
headers=headers,
140+
timeout=3.0,
141+
redirect=redirect,
142+
)
135143
except:
136144
data = None
137145
return data
138146

139-
140147
def connect(self, ip: str, port: int):
141148
"""Connect to the port using a random socks proxy"""
142149
if self.socks5_proxy == []:

0 commit comments

Comments
 (0)