55from concurrent .futures import ThreadPoolExecutor as executor
66from optparse import OptionParser
77
8+
89def printer (word ):
910 sys .stdout .write (word + " \r " )
1011 sys .stdout .flush ()
1112 return True
1213
14+
1315yellow = "\033 [93m"
1416green = "\033 [92m"
1517blue = "\033 [94m"
1618red = "\033 [91m"
1719bold = "\033 [1m"
1820end = "\033 [0m"
1921
22+
2023def check_status (domain , url ):
2124 if not url or url .startswith ("#" ) or len (url ) > 30 :
2225 return False
23-
26+
2427 printer ("Testing: " + domain + url )
2528 try :
2629 link = domain + url
2730 req = requests .head (link )
2831 st = str (req .status_code )
2932 if st .startswith (("2" , "1" )):
30- print (green + "[+] " + st + " | Found: " + end + "[ " + url + " ]" + " \r " )
33+ print (green + "[+] " + st + " | Found: " + end + "[ " + url +
34+ " ]" + " \r " )
3135 elif st .startswith ("3" ):
3236 link = req .headers ['Location' ]
33- print (yellow + "[*] " + st + " | Redirection From: " + end + "[ " + url + " ]" + yellow + " -> " + end + "[ " + link + " ]" + " \r " )
37+ print (yellow + "[*] " + st + " | Redirection From: " + end + "[ " + url + " ]" + yellow +
38+ " -> " + end + "[ " + link + " ]" + " \r " )
3439 elif st .startswith ("4" ):
3540 if st != '404' :
36- print (blue + "[!] " + st + " | Found: " + end + "[ " + url + " ]" + " \r " )
41+ print (blue + "[!] " + st + " | Found: " + end + "[ " + url +
42+ " ]" + " \r " )
3743 return True
3844 except Exception :
3945 return False
4046
47+
4148def presearch (domain , ext , url ):
4249 if ext == 'Null' or ext == 'None' :
4350 check_status (domain , url )
@@ -47,6 +54,7 @@ def presearch(domain, ext, url):
4754 link = url if not i else url + "." + str (i )
4855 check_status (domain , link )
4956
57+
5058def main ():
5159 parser = OptionParser (green + """
5260#Usage:""" + yellow + """
@@ -60,10 +68,14 @@ def main():
6068""" + end )
6169
6270 try :
63- parser .add_option ("-t" , dest = "target" , type = "string" , help = "the target domain" )
64- parser .add_option ("-w" , dest = "wordlist" , type = "string" , help = "wordlist file" )
65- parser .add_option ("-d" , dest = "thread" , type = "int" , help = "the thread number" )
66- parser .add_option ("-e" , dest = "extension" , type = "string" , help = "the extensions" )
71+ parser .add_option ("-t" , dest = "target" , type = "string" ,
72+ help = "the target domain" )
73+ parser .add_option ("-w" , dest = "wordlist" ,
74+ type = "string" , help = "wordlist file" )
75+ parser .add_option ("-d" , dest = "thread" , type = "int" ,
76+ help = "the thread number" )
77+ parser .add_option ("-e" , dest = "extension" ,
78+ type = "string" , help = "the extensions" )
6779 (options , _ ) = parser .parse_args ()
6880
6981 if not options .target or not options .wordlist :
@@ -88,17 +100,20 @@ def main():
88100 ext_list = ext .split ("," ) if ext != "Null" else ["Null" ]
89101 with open (wordlist , 'r' ) as urls :
90102 with executor (max_workers = int (thread )) as exe :
91- jobs = [exe .submit (presearch , target , ext , url .strip ('\n ' )) for url in urls ]
103+ jobs = [exe .submit (presearch , target , ext ,
104+ url .strip ('\n ' )) for url in urls ]
92105
93106 took = (time .time () - start ) / 60
94- print (red + "Took: " + end + f"{ round (took , 2 )} m" + " \r " )
107+ print (red + "Took: " + end +
108+ f"{ round (took , 2 )} m" + " \r " )
95109
96110 print ("\n \t * Happy Hacking *" )
97111
98112 except Exception as e :
99113 print (red + "#Error: " + end + str (e ))
100114 exit (1 )
101115
116+
102117if __name__ == '__main__' :
103118 start = time .time ()
104119 main ()
0 commit comments