@@ -85,28 +85,36 @@ def main():
85
85
exit ()
86
86
87
87
# 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
+
88
92
if args .domain :
89
93
name = args .domain
90
94
res .metadata ["input" ] = name
91
95
res .metadata ["input_type" ] = "domain"
96
+ AS_scan .main (config , res , name )
97
+ fqdn_scanner (args .domain , config , res , args .recursive )
92
98
93
99
elif args .ip :
94
100
name = args .ip
95
101
res .metadata ["input" ] = name
96
102
res .metadata ["input_type" ] = "ip"
103
+ AS_scan .main (config , res , name )
104
+ ip_scanner (args .ip , config , res , args .recursive )
97
105
98
106
elif args .network :
99
107
name = args .network
100
108
res .metadata ["input" ] = name
101
109
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 )
102
116
103
117
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 :
110
118
if ":" in args .resume :
111
119
# if more than one : in the resume argument
112
120
if args .resume .count (":" ) > 1 :
@@ -116,18 +124,8 @@ def main():
116
124
else :
117
125
tool = args .resume .split (":" )[1 ]
118
126
resume_file = args .resume .split (":" )[0 ]
119
- if not ":" in args . resume :
127
+ else :
120
128
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 )
131
129
132
130
# Check if the specified export file exists
133
131
if not os .path .exists (resume_file ):
@@ -151,7 +149,19 @@ def main():
151
149
152
150
# Move the metadata from the data dictionary to the result metadata
153
151
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 )
155
165
# Convert the IP addresses to IP objects
156
166
for ip in data :
157
167
new [ip_lib .ip (ip , config )] = data [ip ]
@@ -179,40 +189,26 @@ def main():
179
189
fqdn_scanner (res .metadata ["input" ], config , res , args .recursive )
180
190
elif res .metadata ["input_type" ] == "ip" :
181
191
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 )
182
198
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" )
205
200
206
201
# Print the result status and scan completion message
207
202
res .status ()
208
- logger .info ("[*] Attack Surface scan finished" )
209
203
res .printer ()
210
204
211
205
# If we're not resuming a scan, run the after scan tools
212
206
if not resume :
207
+ logger .info ("[*] Attack Surface scan finished" )
213
208
after_AS_scan .main (config , res , name )
214
- else :
209
+ elif resume :
215
210
if resume == "export" :
211
+ logger .info ("[*] Resuming scan from export" )
216
212
pass
217
213
else :
218
214
after_AS_scan .main (config , res , name , resume )
0 commit comments