Skip to content

Commit ac67d69

Browse files
authored
Create StatusCode.py
1 parent a52588f commit ac67d69

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

StatusCode.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env python3
2+
3+
from concurrent.futures import ThreadPoolExecutor as executor # sudo pip install future
4+
import argparse, requests, sys
5+
6+
yellow = "\033[93m"
7+
green = "\033[92m"
8+
blue = "\033[94m"
9+
red = "\033[91m"
10+
bold = "\033[1m"
11+
end = "\033[0m"
12+
13+
14+
def printer(url):
15+
sys.stdout.write(url+" \r")
16+
sys.stdout.flush()
17+
return True
18+
19+
20+
def check(out, url):
21+
#print("hell")
22+
printer("Testing: " + url)
23+
link = 'https://' + url
24+
try:
25+
req = requests.head(link, timeout=10)
26+
scode = str(req.status_code)
27+
if scode.startswith("2"):
28+
print(blue+"["+bold+green+str(scode)+end+blue+"]"+end+" | "+str(url))
29+
elif scode.startswith("3"):
30+
print(blue+"["+bold+yellow+str(scode)+end+blue+"]"+end+" | "+str(url))
31+
elif scode.startswith("4"):
32+
print(blue+"["+bold+red+str(scode)+end+blue+"]"+end+" | "+str(url))
33+
else:
34+
print(blue+"["+end+str(scode)+blue+"]"+end+" | "+str(url))
35+
36+
if out != 'None':
37+
with open(out, 'a') as f:
38+
f.write(str(scode)+" | "+url+"\n")
39+
f.close()
40+
41+
return True
42+
43+
except Exception:
44+
return False
45+
46+
47+
def main():
48+
parser = argparse.ArgumentParser()
49+
parser.add_argument("-w", "--wordlist", help="Domains List File", type=str, required=True)
50+
parser.add_argument("-t", "--thread", help="Theads Number - (Default: 10)", type=int)
51+
parser.add_argument("-o", "--output", help="Save Results In a File", type=str) #action='store_true'
52+
53+
args = parser.parse_args()
54+
55+
wlist = str(args.wordlist)
56+
threads = str(args.thread)
57+
out = str(args.output)
58+
59+
if threads == 'None':
60+
threads = 10
61+
else:
62+
threads = threads
63+
64+
lines = len(open(wlist).readlines())
65+
print(blue +"["+red+"+"+blue+"] File: " + end + wlist)
66+
print(blue +"["+red+"+"+blue+"] Length: " + end + str(lines))
67+
print(blue +"["+red+"+"+blue+"] Threads: " + end + str(threads))
68+
print(blue +"["+red+"+"+blue+"] Output: " + end + str(out))
69+
print(red+bold+"\n[+] Results:\n"+end)
70+
71+
urls = open(wlist, 'r')
72+
73+
with executor(max_workers=int(threads)) as exe:
74+
[exe.submit(check, out, url.strip('\n')) for url in urls]
75+
76+
77+
if __name__=='__main__':
78+
main()

0 commit comments

Comments
 (0)