-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathsubchecker.py
95 lines (66 loc) · 2.51 KB
/
subchecker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python
yellow = "\033[93m"
green = "\033[92m"
blue = "\033[94m"
red = "\033[91m"
bold = "\033[1m"
end = "\033[0m"
print(blue+bold+"""
____ _ ____ _ _
/ ___| _ _| |__ / ___| |__ ___ ___| | _____ _ __
\___ \| | | | '_ \| | | '_ \ / _ \/ __| |/ / _ \ '__|
___) | |_| | |_) | |___| | | | __/ (__| < __/ |
|____/ \__,_|_.__/ \____|_| |_|\___|\___|_|\_\___|_|
Coded by: Bingo
---------------
"""+end)
from concurrent.futures import ThreadPoolExecutor as executor # sudo pip install futures
import sys, requests, argparse
def printer(url):
sys.stdout.write(url+" \r")
sys.stdout.flush()
return True
def check(out, url):
printer("Testing: " + url)
url = 'http://' + url
try:
req = requests.head(url, timeout=10)
scode = str(req.status_code)
if scode.startswith("2"):
print(green + "[+] "+scode+" | Found: " + end + "[ " + url + " ]")
elif scode.startswith("3"):
link = req.headers['Location']
print(yellow + "[*] "+scode+" | Redirection: " + end + "[ " + url + " ]" + yellow + " -> " + end + "[ " + link + " ]")
elif st.startswith("4"):
print(blue+"[!] "+scode+" | Check: " + end + "[ " + url + " ]")
if out != 'None':
with open(out, 'a') as f:
f.write(url+"\n")
f.close()
return True
except Exception:
return False
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--wordlist", help="Domains List File", type=str, required=True)
parser.add_argument("-t", "--thread", help="Theads Number - (Default: 10)", type=int)
parser.add_argument("-o", "--output", help="Save Results In a File", type=str) #action='store_true'
args = parser.parse_args()
wlist = str(args.wordlist)
threads = str(args.thread)
out = str(args.output)
if threads == 'None':
threads = 10
else:
threads = threads
lines = len(open(wlist).readlines())
print(blue +"["+red+"+"+blue+"] File: " + end + wlist)
print(blue +"["+red+"+"+blue+"] Length: " + end + str(lines))
print(blue +"["+red+"+"+blue+"] Threads: " + end + str(threads))
print(blue +"["+red+"+"+blue+"] Output: " + end + str(out))
print(red+bold+"\n[+] Results:\n"+end)
urls = open(wlist, 'r')
with executor(max_workers=int(threads)) as exe:
[exe.submit(check, out, url.strip('\n')) for url in urls]
if __name__=='__main__':
main()