patch for unicode errors, it appears that selenium isn't formatted to handle unicode errors (as far as I can tell) so the dork that causes the error will be skipped (issue #125)

This commit is contained in:
ekultek 2017-10-27 17:14:08 -05:00
parent 6c46fd7523
commit ecf067b6bb
4 changed files with 16 additions and 6 deletions

View file

@ -1,4 +1,4 @@
f75a6d23bd80e9861153c9c52dce15bd ./zeus.py
4910b563b0f2403dbe4a89f10001de0b ./zeus.py
6ad5f22ec4a6f8324bfb1b01ab6d51ec ./etc/scripts/cleanup.sh
155c9482f690f1482f324a7ffd8b8098 ./etc/scripts/fix_pie.sh
0e435c641bc636ac0b3d54e032d9cf6a .etc/scripts/install_nmap.sh
@ -43,9 +43,9 @@ f27322b9716e1a2b0b0b0487f3149474 ./lib/attacks/whois_lookup/whois.py
c5ebb0c56c9ae3b9a72a14e3f05afa16 ./lib/attacks/intel_me/__init__.py
1faa2b5dfad6eb538bbfe42942d2a9da ./lib/core/errors.py
d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py
95f45565a70e223e091ff306464c9888 ./lib/core/settings.py
d68e0285c6d17335a6f4abeefb689c5c ./lib/core/settings.py
d41d8cd98f00b204e9800998ecf8427e ./var/google_search/__init__.py
6fe42683a339115709c32562b305f116 ./var/google_search/search.py
b92ee17da90b17a0abb4e07e24fca3e1 ./var/google_search/search.py
d41d8cd98f00b204e9800998ecf8427e ./var/__init__.py
d41d8cd98f00b204e9800998ecf8427e ./var/auto_issue/__init__.py
4506850a02aa18e12bef4efeb760ad9e ./var/auto_issue/github.py

View file

@ -36,7 +36,7 @@ PATCH_ID = str(subprocess.check_output(["git", "rev-parse", "origin/master"]))[:
# clone link
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.1.1"
VERSION = "1.1.2.{}".format(PATCH_ID)
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
# version string formatting
@ -145,7 +145,8 @@ URL_EXCLUDES = (
"maps.google", "play.google", "youtube",
"drive.google", "books.google", "news.google",
"www.google", "mail.google", "accounts.google",
"schema.org", "www.<b", "https://cid-", "https://<strong" # these are some weird things that get pulled up?
"schema.org", "www.<b", "https://cid-", "https://<strong", # these are some weird things that get pulled up?
"plus.google"
)
# regular expressions used for DBMS recognition based on error message response
DBMS_ERRORS = {

View file

@ -98,6 +98,7 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs):
the Google URL. This will open a robot controlled browser window and attempt
to get a URL from Google that will be used for scraping afterwards.
"""
query = query.decode('unicode_escape').encode('utf-8')
proxy, user_agent = kwargs.get("proxy", None), kwargs.get("user_agent", None)
if verbose:
logger.debug(set_color(
@ -164,6 +165,13 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs):
search.send_keys(query)
search.send_keys(Keys.RETURN) # hit return after you enter search text
time.sleep(3)
except UnicodeDecodeError:
logger.error(set_color(
"your query '{}' appears to have unicode characters in it, selenium is not "
"properly formatted to handle unicode characters, this dork will be skipped...".format(
query
), level=40
))
if verbose:
logger.debug(set_color(
"obtaining URL from selenium..."

View file

@ -2,6 +2,7 @@
import optparse
import os
import io
import shlex
import subprocess
import time
@ -450,7 +451,7 @@ if __name__ == "__main__":
# use a file full of dorks as the queries
elif opt.dorkFileToUse is not None:
with open(opt.dorkFileToUse) as dorks:
with io.open(opt.dorkFileToUse, encoding="utf-8") as dorks:
for dork in dorks.readlines():
dork = dork.strip()
logger.info(set_color(