text
stringlengths 1
93.6k
|
|---|
self.urls.append(x.strip())
|
else:
|
print("Please provide a single URL or a list either! (-u or -U)\n")
|
sys.exit()
|
def checkDir(self):
|
if self.dir:
|
if not self.dir.startswith("/"):
|
self.dir = "/" + self.dir
|
if self.dir.endswith("/") and self.dir != "/":
|
self.dir = self.dir.rstrip("/")
|
self.dirs.append(self.dir)
|
elif self.dirlist:
|
if not os.path.exists(self.dirlist):
|
print("The specified path to directory list does not exist! Exitting...\n")
|
sys.exit()
|
with open(self.dirlist, 'r') as file:
|
temp = file.readlines()
|
for x in temp:
|
self.dirs.append(x.strip())
|
else:
|
self.dir = "/"
|
class PathRepository():
|
def __init__(self, path):
|
self.path = path
|
self.newPaths = []
|
self.newHeaders = []
|
self.rewriteHeaders = []
|
self.createNewPaths()
|
self.createNewHeaders()
|
def createNewPaths(self):
|
self.newPaths.append(self.path)
|
pairs = [["/", "//"], ["/.", "/./"]]
|
leadings = ["/%2e"]
|
trailings = ["/", "..;/", "/..;/", "%20", "%09", "%00",
|
".json", ".css", ".html", "?", "??", "???",
|
"?testparam", "#", "#test", "/."]
|
for pair in pairs:
|
self.newPaths.append(pair[0] + self.path + pair[1])
|
for leading in leadings:
|
self.newPaths.append(leading + self.path)
|
for trailing in trailings:
|
self.newPaths.append(self.path + trailing)
|
def createNewHeaders(self):
|
headers_overwrite = ["X-Original-URL", "X-Rewrite-URL"]
|
headers = ["X-Custom-IP-Authorization", "X-Forwarded-For",
|
"X-Forward-For", "X-Remote-IP", "X-Originating-IP",
|
"X-Remote-Addr", "X-Client-IP", "X-Real-IP"]
|
values = ["localhost", "localhost:80", "localhost:443",
|
"127.0.0.1", "127.0.0.1:80", "127.0.0.1:443",
|
"2130706433", "0x7F000001", "0177.0000.0000.0001",
|
"0", "127.1", "10.0.0.0", "10.0.0.1", "172.16.0.0",
|
"172.16.0.1", "192.168.1.0", "192.168.1.1"]
|
for header in headers:
|
for value in values:
|
self.newHeaders.append({header : value})
|
for element in headers_overwrite:
|
self.rewriteHeaders.append({element : self.path})
|
class Query():
|
def __init__(self, url, dir, dirObject):
|
self.url = url
|
self.dir = dir # call pathrepo by this
|
self.dirObject = dirObject
|
self.domain = tldextract.extract(self.url).domain
|
def checkStatusCode(self, status_code):
|
if status_code == 200 or status_code == 201:
|
colour = Fore.GREEN + Style.BRIGHT
|
elif status_code == 301 or status_code == 302:
|
colour = Fore.BLUE + Style.BRIGHT
|
elif status_code == 403 or status_code == 404:
|
colour = Fore.MAGENTA + Style.BRIGHT
|
elif status_code == 500:
|
colour = Fore.RED + Style.BRIGHT
|
else:
|
colour = Fore.WHITE + Style.BRIGHT
|
return colour
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.