@@ -132,11 +132,15 @@ def finds3(sitelist,cookies='',sub=0):
132132 return bucket
133133if __name__ == '__main__' :
134134 ap = argparse .ArgumentParser ()
135- ap .add_argument ("-u" , "--url" , required = True ,help = "Please enter target Url start with http or https" )
135+ ap .add_argument ("-u" , "--url" , required = False ,help = "Please enter target Url start with http or https" )
136+ ap .add_argument ("-b" , "--bucket" , required = False ,help = "Please enter Bucketname" )
136137 ap .add_argument ("-c" , "--cookie" , required = False ,help = "Paste ur cookie values for authentication purpose" )
137138 ap .add_argument ("-l" , "--list" , required = False ,help = "list of sites for testing Eg. sitelist.txt" )
138139 ap .add_argument ("-s" , "--subdomain" , required = False ,help = " True or False" )
139140 args = vars (ap .parse_args ())
141+ if args ['url' ]== None and args ['bucket' ]== None :
142+ print ('please give input like bucketname or url' )
143+ exit ()
140144 sitelist = []
141145 cookies = ''
142146 targeturl = args ['url' ]
@@ -145,23 +149,26 @@ def finds3(sitelist,cookies='',sub=0):
145149 cookies = args ['cookie' ]
146150 if args ['list' ]:
147151 sitelist = sitelist + open (args ['list' ],'r' ).readlines ()
148- s3urls = finds3 (sitelist ,cookies ,sub = args ['subdomain' ])
149- if s3urls [0 ]!= 'Bucket not found' :
150- bucketname = get_bucket_name (s3urls )
151- results = scan_s3 (bucketname ,silent = True )
152- for i in results :
153- print ("Bucket name: " + i [0 ])
154- if i [1 ]:
155- print (Fore .GREEN + "[*] S3 Bucket Lists Files for unauthenticated users [*]" )
156- if i [2 ]:
157- print (Fore .GREEN + "[*] S3 Bucket Lists Files for all aws authenticated users [*]" )
158- else :
159- print (Fore .RED + "[*] Directory Listings ... Access Denied [*]" )
160- if i [3 ]:
161- print (Fore .GREEN + "[*] File uploaded Successfully [*]" )
162- else :
163- print (Fore .RED + "[*] File Not Upload ... Access Denied [*]" )
164- if i [4 ]:
165- print (Fore .GREEN + "[*] Get acl read" )
166- else :
167- print (s3 [0 ])
152+ if args ['url' ]:
153+ s3urls = finds3 (sitelist ,cookies ,sub = args ['subdomain' ])
154+ if s3urls [0 ]!= 'Bucket not found' :
155+ bucketname = get_bucket_name (s3urls )
156+ results = scan_s3 (bucketname ,silent = True )
157+ else :
158+ print (results [0 ])
159+ if args ['bucket' ]:
160+ results = scan_s3 (args ['bucket' ],silent = True )
161+ for i in results :
162+ print ("Bucket name: " + i [0 ])
163+ if i [1 ]:
164+ print (Fore .GREEN + "[*] S3 Bucket Lists Files for unauthenticated users [*]" )
165+ if i [2 ]:
166+ print (Fore .GREEN + "[*] S3 Bucket Lists Files for all aws authenticated users [*]" )
167+ else :
168+ print (Fore .RED + "[*] Directory Listings ... Access Denied [*]" )
169+ if i [3 ]:
170+ print (Fore .GREEN + "[*] File uploaded Successfully [*]" )
171+ else :
172+ print (Fore .RED + "[*] File Not Upload ... Access Denied [*]" )
173+ if i [4 ]:
174+ print (Fore .GREEN + "[*] Get acl read" )
0 commit comments