-
Notifications
You must be signed in to change notification settings - Fork 1
/
xss_result.py
25 lines (22 loc) · 953 Bytes
/
xss_result.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
from selenium import webdriver
class XSSresult:
def __init__(self, params, res):
self.par = params
self.res = res
def FindPayload(self):
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(chrome_options=chrome_options,executable_path='C:/chromedriver.exe')
try:
html = self.res.text
html = "<script>location.reload = () => {}; window.testSuccess = false; window.executeTest = () => testSuccess = true;</script>" + html
driver.get("data:text/html;charset=utf-8,{html_content}".format(html_content=html))
ret = driver.execute_script('return window.testSuccess')
if ret:
return 'OK'
else:
return 'NO'
except:
return 'NO'
finally:
driver.quit()