created two new flags, one for parsing webcache, another for pulling all URLs. This will also produce more results per search.

This commit is contained in:
ekultek 2017-10-18 13:04:09 -05:00
parent fddeb7b774
commit 02a9f54544
4 changed files with 59 additions and 34 deletions

View file

@ -1,5 +1,5 @@
e6c13a69a5290cdb1a8e5e1c4dd19b7d ./requirements.txt
5a7b2d95ee736b8781ada9782598ba60 ./zeus.py
a33737127d83dd172ff5c563e92bb026 ./zeus.py
6ad5f22ec4a6f8324bfb1b01ab6d51ec ./etc/scripts/cleanup.sh
155c9482f690f1482f324a7ffd8b8098 ./etc/scripts/fix_pie.sh
642a77905d8bb4e5533e0e9c2137c0fa ./etc/agents.txt
@ -32,9 +32,9 @@ fc11145007c1c3f47cbda44ced93e73f ./lib/attacks/admin_panel_finder/__init__.py
c5ebb0c56c9ae3b9a72a14e3f05afa16 ./lib/attacks/intel_me/__init__.py
1faa2b5dfad6eb538bbfe42942d2a9da ./lib/core/errors.py
d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py
a7ca933b5fff483d26e0d30a12838100 ./lib/core/settings.py
6e0e9181f2ee8af956663e57ec7b5552 ./lib/core/settings.py
d41d8cd98f00b204e9800998ecf8427e ./var/google_search/__init__.py
e5457ee2e54bb4f4f823367818694596 ./var/google_search/search.py
b098737ac94451ae4cb2a1d8c07b91d4 ./var/google_search/search.py
d41d8cd98f00b204e9800998ecf8427e ./var/__init__.py
66b11aa388ea909de7b212341259a318 ./var/auto_issue/oauth
d41d8cd98f00b204e9800998ecf8427e ./var/auto_issue/__init__.py

View file

@ -24,7 +24,7 @@ except NameError:
# clone link
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.0.54.f2f8"
VERSION = "1.0.55"
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
# version string formatting
@ -122,8 +122,10 @@ SPIDER_EXT_EXCLUDE = (
)
# urls to exclude from being grabbed during the searching
URL_EXCLUDES = (
"www.google.com", "map.google.com", "mail.google.com", "drive.google.com",
"news.google.com", "accounts.google.com", "books.google.com"
"maps.google", "play.google", "youtube",
"drive.google", "books.google", "news.google",
"www.google", "mail.google", "accounts.google",
"schema.org", "www.<b" # this is some weird thing that pulls up?
)
# regular expressions used for DBMS recognition based on error message response
DBMS_ERRORS = {

View file

@ -2,6 +2,7 @@ import os
import re
import time
import subprocess
try:
from urllib import (
unquote,
@ -216,6 +217,7 @@ def parse_search_results(
retval = set()
query_url = None
parse_webcache, pull_all = kwargs.get("parse_webcache", False), kwargs.get("pull_all", False)
proxy_string, user_agent = kwargs.get("proxy", None), kwargs.get("agent", None)
if verbose:
@ -223,6 +225,15 @@ def parse_search_results(
"checking for user-agent and proxy configuration...", level=10
))
if not parse_webcache:
logger.warning(set_color(
"will not parse webcache URLs...", level=30
))
if not pull_all:
logger.warning(set_color(
"only pulling URLs with GET(query) parameters...", level=30
))
user_agent_info = "adjusting user-agent header to {}..."
if user_agent is not DEFAULT_USER_AGENT:
user_agent_info = user_agent_info.format(user_agent.strip())
@ -292,26 +303,18 @@ def parse_search_results(
logger.info(set_color(user_agent_info))
req.headers.update(headers)
found_urls = URL_REGEX.findall(req.text)
url_skip_schema = ("maps.google", "play.google", "youtube")
for urls in list(found_urls):
for url in list(urls):
url = unquote(url)
if not any(u in url for u in url_skip_schema):
if URL_QUERY_REGEX.match(url) and not any(l in url for l in URL_EXCLUDES):
if not any(u in url for u in URL_EXCLUDES):
if URL_REGEX.match(url):
if isinstance(url, unicode):
url = str(url).encode("utf-8")
if "webcache" in url:
logger.info(set_color(
"received webcache URL, extracting URL from webcache..."
))
webcache_url = url
url = extract_webcache_url(webcache_url)
if url is None:
logger.warning(set_color(
"unable to extract url from given webcache URL '{}'...".format(
webcache_url
), level=30
))
if pull_all:
retval.add(url.split(splitter)[0])
else:
if URL_QUERY_REGEX.match(url.split(splitter)[0]):
retval.add(url.split(splitter)[0])
if verbose:
try:
logger.debug(set_color(
@ -326,23 +329,39 @@ def parse_search_results(
"found '{}...".format(str(url)), level=10
))
if url is not None:
retval.add(url.split("&amp;")[0])
logger.info(set_color(
"found a total of {} URL's with a GET parameter...".format(len(retval))
))
if len(retval) != 0:
write_to_log_file(retval, URL_LOG_PATH, "url-log-{}.log")
retval.add(url.split(splitter)[0])
true_retval = set()
for url in list(retval):
if parse_webcache:
if "webcache" in url:
logger.info(set_color(
"found a webcache URL, extracting..."
))
url = extract_webcache_url(url)
if verbose:
logger.debug(set_color(
"found '{}'...".format(url), level=10
))
true_retval.add(url)
else:
true_retval.add(url)
else:
true_retval.add(url)
if len(true_retval) != 0:
write_to_log_file(true_retval, URL_LOG_PATH, "url-log-{}.log")
else:
logger.critical(set_color(
"did not find any usable URL's with the given query '{}' "
"using search engine '{}'...".format(query, url_to_search), level=50
logger.fatal(set_color(
"did not find any URLs with given query '{}'...".format(query), level=50
))
shutdown()
return list(retval) if len(retval) != 0 else None
logger.info(set_color(
"found a total of {} URLs with given query '{}'...".format(len(true_retval), query)
))
return list(true_retval) if len(true_retval) != 0 else None
def search_multiple_pages(query, link_amount, verbose=False, **kwargs):
def __config_proxy(proxy_string):
proxy_type_schema = {
"http": httplib2.socks.PROXY_TYPE_HTTP,
@ -410,4 +429,4 @@ def search_multiple_pages(query, link_amount, verbose=False, **kwargs):
else:
logger.error(set_color(
"unable to extract URL's from results...", level=40
))
))

View file

@ -121,6 +121,10 @@ if __name__ == "__main__":
help="Specify how many links to try and search on Google")
search_items.add_option("-M", "--multi", dest="searchMultiplePages", action="store_true",
help="Search multiple pages of Google")
search_items.add_option("-E", "--exclude-none", dest="noExclude", action="store_true",
help="Do not exclude URLs because they do not have a GET(query) parameter in them")
search_items.add_option("-W", "--webcache", dest="parseWebcache", action="store_true",
help="Parse webcache URLs for the redirect in them")
# obfuscation options
anon = optparse.OptionGroup(parser, "Anonymity arguments",
@ -480,7 +484,7 @@ if __name__ == "__main__":
try:
search.parse_search_results(
opt.dorkToUse, search_engine, verbose=opt.runInVerbose, proxy=proxy_to_use,
agent=agent_to_use
agent=agent_to_use, pull_all=opt.noExclude, parse_webcache=opt.parseWebcache
)
except Exception as e:
logger.exception(set_color(