patch for a reported issue (private) where if there are no URL's left it will keep going until it hits the max page, will now stop

This commit is contained in:
ekultek 2017-11-11 16:30:03 -06:00
parent cec5a4c7c5
commit 1eb861ae16
3 changed files with 23 additions and 13 deletions

View file

@ -50,10 +50,10 @@ d8fab18b15d1546f6585fe926c27868f ./lib/attacks/whois_lookup/whois.py
21faf4679cdeaa731029a48f8963d6e7 ./lib/attacks/nmap_scan/nmap_opts.py
1faa2b5dfad6eb538bbfe42942d2a9da ./lib/core/errors.py
d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py
7dfba7fabe755c6d9946097b41426458 ./lib/core/settings.py
3dbc63c72d9e6b75630899561f333ab4 ./lib/core/settings.py
ad6622a5170e4ec74b5172f12ddcba9f ./lib/header_check/__init__.py
d41d8cd98f00b204e9800998ecf8427e ./var/google_search/__init__.py
049b8a1cc93dc44b12dd93efdf785412 ./var/google_search/search.py
670fb7fa0c618ce9712e0f73f7752925 ./var/google_search/search.py
d41d8cd98f00b204e9800998ecf8427e ./var/__init__.py
d41d8cd98f00b204e9800998ecf8427e ./var/auto_issue/__init__.py
dadca85c232153021ba9ff253d8ee1d9 ./var/auto_issue/github.py

View file

@ -52,7 +52,7 @@ PATCH_ID = str(subprocess.check_output(["git", "rev-parse", "origin/master"]))[:
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.2.6".format(PATCH_ID)
VERSION = "1.2.7.{}".format(PATCH_ID)
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
@ -177,6 +177,9 @@ URL_QUERY_REGEX = re.compile(r"(.*)[?|#](.*){1}\=(.*)")
# regex to recognize a URL
URL_REGEX = re.compile(r"((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)")
# regex to discover if there are any results on the page
NO_RESULTS_REGEX = re.compile("did not match with any results.", re.IGNORECASE)
# search engines that the application can use
AUTHORIZED_SEARCH_ENGINES = {
"aol": "http://aol.com",

View file

@ -43,7 +43,8 @@ from lib.core.settings import (
create_random_ip,
rewrite_all_paths,
AUTHORIZED_SEARCH_ENGINES,
MAX_PAGE_NUMBER
MAX_PAGE_NUMBER,
NO_RESULTS_REGEX
)
try:
@ -588,17 +589,23 @@ def search_multiple_pages(query, link_amount, verbose=False, **kwargs):
if page_request.status_code == 200:
html_page = page_request.content
soup = BeautifulSoup(html_page, "html.parser")
for link in soup.findAll(attrib):
redirect = link.get(desc)
if redirect is not None:
if not any(ex in redirect for ex in URL_EXCLUDES):
if URL_REGEX.match(redirect):
retval.add(redirect)
if page_number < MAX_PAGE_NUMBER:
page_number += 1
if not NO_RESULTS_REGEX.findall(str(soup)):
for link in soup.findAll(attrib):
redirect = link.get(desc)
if redirect is not None:
if not any(ex in redirect for ex in URL_EXCLUDES):
if URL_REGEX.match(redirect):
retval.add(redirect)
if page_number < MAX_PAGE_NUMBER:
page_number += 1
else:
logger.warning(set_color(
"hit max page number {}...".format(MAX_PAGE_NUMBER), level=30
))
break
else:
logger.warning(set_color(
"hit max page number {}...".format(MAX_PAGE_NUMBER), level=30
"no more results found for given query '{}'...".format(query), level=30
))
break
except KeyboardInterrupt: