patches an issue where Zeus will always install the same geckodriver version (issue #102)

This commit is contained in:
ekultek 2017-10-15 09:10:51 -05:00
parent 65716493e7
commit 5375c15b9e
3 changed files with 44 additions and 39 deletions

View file

@ -7,7 +7,6 @@ import ConfigParser
import whichcraft
import lib.core.settings
import var.auto_issue.github
def disclaimer():
@ -58,6 +57,18 @@ def find_tools(to_search=("sqlmap", "nmap"), directory="{}/bin/paths", filename=
cfgfile.close()
def config_gecko_version(browser_version):
"""
figure out which gecko version you need
"""
if (55,) > browser_version > (53,):
return 17
elif (56,) > browser_version > (55,):
return 18
else:
return 19
def check_os(current=platform.platform()):
"""
check the users operating system..
@ -101,13 +112,8 @@ def untar_gecko(filename="{}/bin/drivers/geckodriver-v0.{}.0-linux{}.tar.gz", ve
"""
arch_info = {"64bit": "64", "32bit": "32"}
file_arch = arch_info[platform.architecture()[0]]
ff_version = var.auto_issue.github.get_browser_version()
if ff_version > (54,): # ff version between 53-55
gecko_version = 18
elif ff_version < (55,): # ff version between 56 and anything greater (will probably cause problems later on)
gecko_version = 19
else:
gecko_version = 17 # anything else
ff_version = lib.core.settings.get_browser_version()
gecko_version = config_gecko_version(ff_version)
gecko_full_filename = filename.format(os.getcwd(), gecko_version, file_arch)
with open(lib.core.settings.GECKO_VERSION_INFO_PATH, "a+") as log:
log.write(gecko_full_filename.split("/")[-1])

View file

@ -1,12 +1,13 @@
import difflib
import glob
import logging
import os
import io
import random
import re
import sys
import glob
import time
import difflib
import logging
import random
import subprocess
import ConfigParser
import psutil
@ -22,7 +23,7 @@ except NameError:
# clone link
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.0.48"
VERSION = "1.0.49.ced6"
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
# version string formatting
@ -399,4 +400,25 @@ def search_for_process(name):
for pid in psutil.pids():
process = psutil.Process(pid)
all_process_names.add(" ".join(process.cmdline()).strip())
return False if not any(name in proc for proc in list(all_process_names)) else True
return False if not any(name in proc for proc in list(all_process_names)) else True
def get_browser_version():
logger.info(set_color(
"attempting to get firefox browser version..."
))
try:
output = subprocess.check_output(['firefox', '--version'])
except Exception:
logger.error(set_color(
"failed to run firefox...", level=50
))
return "failed to start"
try:
major, minor = map(int, re.search(r"(\d+).(\d+)", output).groups())
except Exception:
logger.error(set_color(
"failed to parse '{}' for version number...".format(output), level=50
))
return "failed to gather"
return major, minor

View file

@ -1,5 +1,4 @@
import os
import re
import sys
try:
import urllib2 # python 2
@ -7,34 +6,12 @@ except ImportError:
import urllib.request as urllib2 # python 3
import json
import platform
import subprocess
from base64 import b64decode
import lib.core.settings
def get_browser_version():
lib.core.settings.logger.info(lib.core.settings.set_color(
"attempting to get firefox browser version..."
))
try:
output = subprocess.check_output(['firefox', '--version'])
except Exception:
lib.core.settings.logger.error(lib.core.settings.set_color(
"failed to run firefox...", level=50
))
return "failed to start"
try:
major, minor = map(int, re.search(r"(\d+).(\d+)", output).groups())
except Exception:
lib.core.settings.logger.error(lib.core.settings.set_color(
"failed to parse '{}' for version number...".format(output), level=50
))
return "failed to gather"
return "Version: ({}.{})".format(major, minor)
def __get_encoded_string(filename="{}/var/auto_issue/oauth"):
with open(filename.format(os.getcwd())) as data:
return data.read()
@ -96,7 +73,7 @@ def request_issue_creation():
current_log_file = lib.core.settings.get_latest_log_file(lib.core.settings.CURRENT_LOG_FILE_PATH)
stacktrace = __extract_stacktrace(current_log_file)
issue_title = stacktrace.split("\n")[-2]
ff_version = get_browser_version()
ff_version = lib.core.settings.get_browser_version()
issue_data = {
"title": issue_title,
@ -108,7 +85,7 @@ def request_issue_creation():
"Commands used:\n`{}`\n\n"
"Log file info:\n```{}```".format(
lib.core.settings.VERSION,
ff_version,
"({})".format(ff_version),
open(lib.core.settings.GECKO_VERSION_INFO_PATH).read(),
str(stacktrace),
str(platform.platform()),