patch for an issue where the current URL could not be pulled due to a present alert (issue #81)

This commit is contained in:
ekultek 2017-10-12 17:53:45 -05:00
parent c2ac3ee10a
commit 307751e14f
2 changed files with 11 additions and 2 deletions

View file

@ -22,7 +22,7 @@ except NameError:
# clone link
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.0.41"
VERSION = "1.0.42.aeb1"
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
# version string formatting

View file

@ -17,6 +17,7 @@ from selenium import webdriver
from pyvirtualdisplay import Display
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.proxy import *
from selenium.webdriver.remote.errorhandler import UnexpectedAlertPresentException
from var.auto_issue.github import request_issue_creation
from lib.core.settings import (
@ -140,7 +141,15 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs):
logger.debug(set_color(
"obtaining URL from selenium..."
))
retval = browser.current_url
try:
retval = browser.current_url
except UnexpectedAlertPresentException:
logger.warning(set_color(
"alert present, closing...", level=30
))
alert = browser.switch_to.alert
alert.accept()
retval = browser.current_url
ban_url_schema = ["http://ipv6.google.com", "http://ipv4.google.com"]
if any(u in retval for u in ban_url_schema): # if you got IP banned
logger.warning(set_color(