make the browser static so we don't have to initialize it each execution.
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
from core.config import xsschecker
|
||||
from core.utils import writer
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.firefox.options import Options
|
||||
from selenium.common.exceptions import UnexpectedAlertPresentException
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
|
||||
options = Options()
|
||||
options.add_argument('--headless')
|
||||
browser = webdriver.Firefox(options=options)
|
||||
|
||||
def browserEngine(response):
|
||||
options = Options()
|
||||
options.add_argument('--headless')
|
||||
browser = webdriver.Firefox(options=options)
|
||||
response = re.sub(r'<script.*?src=.*?>', '<script src=#>', response, re.I)
|
||||
response = re.sub(r'href=.*?>', 'href=#>', response, re.I)
|
||||
writer(response, 'test.html')
|
||||
@@ -28,7 +27,6 @@ def browserEngine(response):
|
||||
popUp = True
|
||||
browser.quit()
|
||||
|
||||
|
||||
except UnexpectedAlertPresentException:
|
||||
popUp = True
|
||||
browser.quit()
|
||||
|
||||
Reference in New Issue
Block a user