Skip to content

Commit cc1a126

Browse files
debug resume mode and better args
1 parent acb6f5f commit cc1a126

File tree

5 files changed

+63
-49
lines changed

5 files changed

+63
-49
lines changed

lib/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def load(self):
106106
logger.info("[*] Info: Proxy activated")
107107
# logger.info("[*] Testing proxy...")
108108
for link, type in self.config["Proxy"]["links"].items():
109-
try :
109+
try:
110110
for line in requests.get(link).text.splitlines():
111111
if type == "http":
112112
self.http_proxy.append(line)

main.py

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,36 @@ def main():
8585
exit()
8686

8787
# Set the input type and name based on the user's input
88+
89+
if not args.resume:
90+
logger.info("[*] Starting tools to run before AS scan")
91+
8892
if args.domain:
8993
name = args.domain
9094
res.metadata["input"] = name
9195
res.metadata["input_type"] = "domain"
96+
AS_scan.main(config, res, name)
97+
fqdn_scanner(args.domain, config, res, args.recursive)
9298

9399
elif args.ip:
94100
name = args.ip
95101
res.metadata["input"] = name
96102
res.metadata["input_type"] = "ip"
103+
AS_scan.main(config, res, name)
104+
ip_scanner(args.ip, config, res, args.recursive)
97105

98106
elif args.network:
99107
name = args.network
100108
res.metadata["input"] = name
101109
name = name.replace("/", "_")
110+
AS_scan.main(config, res, name)
111+
logger.info("[*] Scanning network")
112+
this_network = ip_lib.network(args.network)
113+
this_network.get_ip_from_network()
114+
for ip in this_network.ips:
115+
ip_scanner(ip, config, res, args.recursive)
102116

103117
elif args.resume:
104-
name = res.metadata["input"]
105-
106-
logger.info("[*] Starting tools to run before AS scan")
107-
108-
# Check if the user wants to resume a previous scan
109-
if args.resume:
110118
if ":" in args.resume:
111119
# if more than one : in the resume argument
112120
if args.resume.count(":") > 1:
@@ -116,18 +124,8 @@ def main():
116124
else:
117125
tool = args.resume.split(":")[1]
118126
resume_file = args.resume.split(":")[0]
119-
if not ":" in args.resume:
127+
else:
120128
resume_file = args.resume
121-
if "last_tool" in res.metadata:
122-
tool = res.metadata["last_tool"]
123-
else:
124-
logger.error(f"[*] Error: no tool specified")
125-
exit(1)
126-
127-
# Check if the specified tool exists
128-
if tool != "export" and not os.path.exists(f"tools/{tool}.py"):
129-
logger.error(f"[*] Error: tool {tool} does not exist")
130-
exit(1)
131129

132130
# Check if the specified export file exists
133131
if not os.path.exists(resume_file):
@@ -151,7 +149,19 @@ def main():
151149

152150
# Move the metadata from the data dictionary to the result metadata
153151
res.metadata = data.pop("metadata")
154-
152+
name = res.metadata["input"]
153+
if not ":" in args.resume:
154+
resume_file = args.resume
155+
if "last_tool" in res.metadata:
156+
tool = res.metadata["last_tool"]
157+
else:
158+
logger.error(f"[*] Error: no tool specified")
159+
exit(1)
160+
161+
# Check if the specified tool exists
162+
if tool != "export" and not os.path.exists(f"tools/{tool}.py"):
163+
logger.error(f"[*] Error: tool {tool} does not exist")
164+
exit(1)
155165
# Convert the IP addresses to IP objects
156166
for ip in data:
157167
new[ip_lib.ip(ip, config)] = data[ip]
@@ -179,40 +189,26 @@ def main():
179189
fqdn_scanner(res.metadata["input"], config, res, args.recursive)
180190
elif res.metadata["input_type"] == "ip":
181191
ip_scanner(res.metadata["input"], config, res, args.recursive)
192+
elif res.metadata["input_type"] == "network":
193+
logger.info("[*] Scanning network")
194+
this_network = ip_lib.network(args.network)
195+
this_network.get_ip_from_network()
196+
for ip in this_network.ips:
197+
ip_scanner(ip, config, res, args.recursive)
182198
else:
183-
resume = False
184-
185-
logger.info("[*]")
186-
187-
# If the user provided a domain, scan it
188-
elif args.domain:
189-
AS_scan.main(config, res, name)
190-
fqdn_scanner(args.domain, config, res, args.recursive)
191-
192-
# If the user provided an IP address, scan it
193-
elif args.ip:
194-
AS_scan.main(config, res, name)
195-
ip_scanner(args.ip, config, res, args.recursive)
196-
197-
# If the user provided a network, scan it
198-
elif args.network:
199-
AS_scan.main(config, res, name)
200-
logger.info("[*] Scanning network")
201-
this_network = ip_lib.network(args.network)
202-
this_network.get_ip_from_network()
203-
for ip in this_network.ips:
204-
ip_scanner(ip, config, res, args.recursive)
199+
logger.info("[*] Resuming scan but after AS scan")
205200

206201
# Print the result status and scan completion message
207202
res.status()
208-
logger.info("[*] Attack Surface scan finished")
209203
res.printer()
210204

211205
# If we're not resuming a scan, run the after scan tools
212206
if not resume:
207+
logger.info("[*] Attack Surface scan finished")
213208
after_AS_scan.main(config, res, name)
214-
else:
209+
elif resume:
215210
if resume == "export":
211+
logger.info("[*] Resuming scan from export")
216212
pass
217213
else:
218214
after_AS_scan.main(config, res, name, resume)

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "V3.1.3",
2+
"version": "V3.1.4",
33
"configuration_file_version": "2.0.1"
44
}

tools/AS_scan/brute_subs.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
import lib.custom_logger as custom_logger
88
import time
99
import uuid
10+
1011
logger = custom_logger.logger
1112

1213
ips = set()
14+
15+
1316
def is_wildcard(fqdn: str) -> bool:
1417
"""
1518
Checks if the fqdn is a wildcard.
@@ -30,9 +33,11 @@ def is_wildcard(fqdn: str) -> bool:
3033
return True
3134
else:
3235
return False
33-
36+
3437
except:
3538
return False
39+
40+
3641
def resolve_and_store(
3742
resolver: dns.resolver.Resolver,
3843
subdomain: str,
@@ -92,7 +97,7 @@ def main(config: gen.configuration, res: result, name: str) -> result:
9297
if is_wildcard(name):
9398
logger.info(f"[*] {name} is a wildcard")
9499
wildcard = True
95-
100+
96101
# get wordlist inside tools/worldlists
97102
wordlist = f"tools/wordlists/{this_tool_config['wordlist_name']}"
98103
# get resolver inside tools/resolvers
@@ -112,7 +117,14 @@ def main(config: gen.configuration, res: result, name: str) -> result:
112117
with tqdm(total=len(subdomains), leave=False) as pbar:
113118
futures = [
114119
executor.submit(
115-
resolve_and_store, resolver, subdomain, fqdn, config, res, pbar, wildcard
120+
resolve_and_store,
121+
resolver,
122+
subdomain,
123+
fqdn,
124+
config,
125+
res,
126+
pbar,
127+
wildcard,
116128
)
117129
for subdomain in subdomains
118130
]

tools/after_AS_scan/nuclei.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,18 @@ def nuclei_scan(hosts: list, domain: str, vulnconf: str, headless=False) -> dict
6363
# Update Nuclei
6464
logger.info("Updating Nuclei")
6565
subprocess.run(
66-
["nuclei", "-update"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True
66+
["nuclei", "-update"],
67+
stdout=subprocess.DEVNULL,
68+
stderr=subprocess.DEVNULL,
69+
check=True,
6770
)
6871
# Update Nuclei templates
6972
logger.info("Updating Nuclei templates")
7073
subprocess.run(
71-
["nuclei", "-ut"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True
74+
["nuclei", "-ut"],
75+
stdout=subprocess.DEVNULL,
76+
stderr=subprocess.DEVNULL,
77+
check=True,
7278
)
7379

7480
# Run Nuclei and save the results in a JSON file

0 commit comments

Comments
 (0)