adding support for python 3 (issue #7) if you find any issues with python3 please make an issue there

This commit is contained in:
ekultek 2017-09-29 14:28:53 -05:00
parent 3e4e37042a
commit f38ec5f65f
5 changed files with 32 additions and 10 deletions

View file

@ -1,6 +1,9 @@
import re
import json
import urllib2
try:
import urllib2 # python 2
except ImportError:
import urllib as urllib2 # python 3
import subprocess
import requests

View file

@ -1,6 +1,9 @@
import os
import re
import urlparse
try:
import urlparse # python 2
except ImportError:
import urllib.parse as urlparse # python 3
import tempfile
import requests

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.21.6ea5"
VERSION = "1.0.22"
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
# version string formatting

View file

@ -1,7 +1,10 @@
import os
import re
import time
import urllib
try:
from urllib import unquote
except ImportError:
from urllib.parse import unquote
import requests
from selenium import webdriver
@ -20,6 +23,11 @@ from lib.settings import (
create_dir,
)
try:
unicode
except NameError:
unicode = str
def bypass_ip_block(url, content_sep=("continue=", "Fid", "%")):
"""
@ -157,6 +165,7 @@ def parse_search_results(
Parse a webpage from Google for URL's with a GET(query) parameter
"""
exclude = "google" or "webcache" or "youtube"
splitter = "&amp;"
create_dir(dirname.format(os.getcwd()))
full_file_path = "{}/{}".format(
@ -201,7 +210,8 @@ def parse_search_results(
proxy_string_info = "setting proxy to {}..."
if proxy_string is not None:
proxy_string_info = proxy_string_info.format(''.join(proxy_string.keys()) + "://" + ''.join(proxy_string.values()))
proxy_string_info = proxy_string_info.format(
''.join(proxy_string.keys()) + "://" + ''.join(proxy_string.values()))
else:
proxy_string_info = "no proxy configuration detected..."
@ -239,14 +249,19 @@ def parse_search_results(
retval = set()
for urls in list(found_urls):
for url in list(urls):
url = urllib.unquote(url)
url = unquote(url)
if URL_QUERY_REGEX.match(url) and exclude not in url:
if type(url) is unicode:
if isinstance(url, unicode):
url = str(url).encode("utf-8")
if verbose:
logger.debug(set_color(
"found '{}'...".format(url.split("&amp;")[0]), level=10
))
try:
logger.debug(set_color(
"found '{}'...".format(url.split(splitter)[0]), level=10
))
except TypeError:
logger.debug(set_color(
"found '{}'...".format(str(url).split(splitter)[0]), level=10
))
retval.add(url.split("&amp;")[0])
logger.info(set_color(
"found a total of {} URL's with a GET parameter...".format(len(retval))

View file

@ -9,6 +9,7 @@ try:
import http.client as http_client # Python 3
except ImportError:
import httplib as http_client # Python 2
from var import blackwidow
from var.google_search import search
from lib.errors import InvalidInputProvided