-
Notifications
You must be signed in to change notification settings - Fork 0
/
xss.py
28 lines (24 loc) · 1.17 KB
/
xss.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
import requests, os
class Xss():
def __init__(self, folder_name, xss):
self.folder_name = folder_name
self.xss = xss
def detectXSS(self):
with open(os.path.join(self.folder_name, "gau_results_uro.txt"), "r") as file:
with open(os.path.join(self.folder_name, "xss_replace.txt"), "w") as output:
for url in file:
domain = str(url.strip())
replaced_url = re.sub(r"=[^?\|&]*", '=' + str(self.xss), str(domain) + '\n')
if xss in replaced_url:
output.write(replaced_url + '\n')
def reflectedXSS(self):
with open(os.path.join(self.folder_name, "xss_reflected.txt"), "w") as output:
with open(os.path.join(self.folder_name, "xss_replace.txt"), "r") as file:
for url in file:
url = url.strip()
try:
r = requests.get(url = url)
if self.xss in r.text:
output.write(url)
except requests.exceptions.RequestException as e:
print("Error en: {} \n\n" .format(url))