1616from enum_tools import aws_checks
1717from enum_tools import azure_checks
1818from enum_tools import gcp_checks
19+ from enum_tools import utils
1920
2021BANNER = '''
2122##########################
2526
2627'''
2728
29+ LOGFILE = False
30+
2831def parse_arguments ():
2932 """
3033 Handles user-passed parameters
@@ -64,6 +67,9 @@ def parse_arguments():
6467 default = '8.8.8.8' ,
6568 help = 'DNS server to use in brute-force.' )
6669
70+ parser .add_argument ('-l' , '--logfile' , type = str , action = 'store' ,
71+ help = 'Will APPEND found items to specified file.' )
72+
6773 parser .add_argument ('--disable-aws' , action = 'store_true' ,
6874 help = 'Disable Amazon checks.' )
6975
@@ -96,6 +102,25 @@ def parse_arguments():
96102 with open (args .keyfile ) as infile :
97103 args .keyword = [keyword .strip () for keyword in infile ]
98104
105+ # Ensure log file is writeable
106+ if args .logfile :
107+ if os .path .isdir (args .logfile ):
108+ print ("[!] Can't specify a directory as the logfile, exiting." )
109+ sys .exit ()
110+ if os .path .isfile (args .logfile ):
111+ target = args .logfile
112+ else :
113+ target = os .path .dirname (args .logfile )
114+ if target == '' :
115+ target = '.'
116+
117+ if not os .access (target , os .W_OK ):
118+ print ("[!] Cannot write to log file, exiting" )
119+ sys .exit ()
120+
121+ # Set the global in the utils file, where logging needs to happen
122+ utils .init_logfile (args .logfile )
123+
99124 return args
100125
101126def print_status (args ):
@@ -163,9 +188,6 @@ def main():
163188 Main program function.
164189 """
165190 args = parse_arguments ()
166-
167-
168-
169191 print (BANNER )
170192
171193 # Generate a basic status on targets and parameters
@@ -176,12 +198,16 @@ def main():
176198 names = build_names (args .keyword , mutations )
177199
178200 # All the work is done in the individual modules
179- if not args .disable_aws :
180- aws_checks .run_all (names , args .threads )
181- if not args .disable_azure :
182- azure_checks .run_all (names , args .brute , args .threads , args .nameserver )
183- if not args .disable_gcp :
184- gcp_checks .run_all (names , args .threads )
201+ try :
202+ if not args .disable_aws :
203+ aws_checks .run_all (names , args )
204+ if not args .disable_azure :
205+ azure_checks .run_all (names , args )
206+ if not args .disable_gcp :
207+ gcp_checks .run_all (names , args )
208+ except KeyboardInterrupt :
209+ print ("Thanks for playing!" )
210+ sys .exit ()
185211
186212 # Best of luck to you!
187213 print ("\n [+] All done, happy hacking!\n " )
0 commit comments