This repository has been archived by the owner on Jan 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdom-red.py
98 lines (75 loc) · 3.31 KB
/
dom-red.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
95
96
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import sys
import urllib3
import argparse
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
RED = "\033[91m"
BLUE = "\033[36m"
WHITE = '\033[37m'
END = "\033[0m"
def banner():
print("""
________ ________ _________
___ __ \____________ ___ ___ __ \__________ /
__ / / / __ \_ __ `__ \ __ /_/ / _ \ __ /
_ /_/ // /_/ / / / / / / _ _, _// __/ /_/ /
/_____/ \____//_/ /_/ /_/ /_/ |_| \___/\__,_/
Author {}::{} Naategh
""".format(RED, END))
def main():
with open(file) as f:
print("")
for line in f:
with open(payloads) as p:
for payload in p:
try:
line2 = line.strip()
if 'http://' in line2:
pass
elif 'https://' in line2:
pass
else:
line2 = 'http://' + line2
if args.include:
URL = line2 + "/" + payload
else:
URL = line2 + payload
response = requests.get(URL, verify=False, timeout=5)
if args.verbose:
print(URL.replace("\n", "") + RED + " ++> " + str(response.status_code) + "\n" + END)
else:
pass
try:
if response.history and not str(response.url).startswith(line2):
for resp in response.history:
print("Redirect Found: " + WHITE + resp.url + END)
print("Final Destination: " + BLUE + response.url + "\n" + END)
if output:
res.write(resp.url + " ++> " + response.url + "\n\n")
else:
pass
except Exception as e:
print("Connection Error: ", e)
except requests.exceptions.RequestException:
print(RED + "Requests error: " + URL + "\nContinue...\n" + END)
continue
except KeyboardInterrupt:
print(RED + "Shutdown..." + END)
exit(0)
if __name__ == '__main__':
banner()
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--domain', help='Path of domains list', required=True)
parser.add_argument('-p', '--payload', help='Path of payloads list', required=True)
parser.add_argument('-i', '--include', help="Include a slash at end of URLs", action='store_true')
parser.add_argument('-v', '--verbose', help="Show more results", action="store_true")
parser.add_argument('-o', '--output', help="Output file, ex: res.txt")
args = parser.parse_args()
file = args.domain
payloads = args.payload
output = args.output
if output:
res = open(output, "a+")
main()