mirror of
https://github.com/Ekultek/Zeus-Scanner.git
synced 2026-03-11 08:55:51 +00:00
edited the automatic issue creator so that it will only pull the last 35 lines of the file, along with that it will now tell you the link to your issue if you have anything to add to it
This commit is contained in:
parent
0ae36e2489
commit
46cb3d64d0
3 changed files with 55 additions and 6 deletions
|
|
@ -71,11 +71,11 @@ e11185d7dd3d6c94d7f4ddbcfd1d26cc ./lib/header_check/__init__.py
|
|||
45fc5f5847a3a9909cbd5e0add7b4586 ./lib/core/common.py
|
||||
1faa2b5dfad6eb538bbfe42942d2a9da ./lib/core/errors.py
|
||||
d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py
|
||||
db185dc79cdb6baa6c0949788204421c ./lib/core/settings.py
|
||||
e85aeb86ed1e341c65d3916e80e264f0 ./lib/core/settings.py
|
||||
9989b7122c79a4cd38be1e00adab5187 ./var/search/__init__.py
|
||||
cd16c7e4eb550b2c8531dee993eb4c2a ./var/search/selenium_search.py
|
||||
63ba132381a0cc2d7629852bd5e4aa17 ./var/search/pgp_search.py
|
||||
d41d8cd98f00b204e9800998ecf8427e ./var/__init__.py
|
||||
d41d8cd98f00b204e9800998ecf8427e ./var/auto_issue/__init__.py
|
||||
a12d5ffa2d45347c86e5fab154a89943 ./var/auto_issue/github.py
|
||||
0c11c16126baf789388a661bbbefb149 ./var/auto_issue/github.py
|
||||
7f605eefd38c7404660e8266a7a52192 ./var/blackwidow/__init__.py
|
||||
|
|
@ -46,7 +46,7 @@ CLONE = "https://github.com/ekultek/zeus-scanner.git"
|
|||
ISSUE_LINK = "https://github.com/ekultek/zeus-scanner/issues"
|
||||
|
||||
# current version <major.minor.commit.patch ID>
|
||||
VERSION = "1.2.35".format(PATCH_ID)
|
||||
VERSION = "1.2.36".format(PATCH_ID)
|
||||
|
||||
# colors to output depending on the version
|
||||
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
|
||||
|
|
@ -1097,3 +1097,23 @@ def get_token(path):
|
|||
n = __get_n(encoded)
|
||||
token = __decode(encoded, int(n))
|
||||
return token
|
||||
|
||||
|
||||
def tails(file_object, last_lines=35):
|
||||
"""
|
||||
return the last `n` lines of a file, much like the Unix
|
||||
tails command
|
||||
"""
|
||||
with open(file_object) as file_object:
|
||||
assert last_lines >= 0
|
||||
pos, lines = last_lines+1, []
|
||||
while len(lines) <= last_lines:
|
||||
try:
|
||||
file_object.seek(-pos, 2)
|
||||
except IOError:
|
||||
file_object.seek(0)
|
||||
break
|
||||
finally:
|
||||
lines = list(file_object)
|
||||
pos *= 2
|
||||
return "".join(lines[-last_lines:])
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import re
|
||||
import sys
|
||||
try:
|
||||
import urllib2 # python 2
|
||||
|
|
@ -6,10 +7,35 @@ except ImportError:
|
|||
import json
|
||||
import platform
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
import lib.core.common
|
||||
import lib.core.settings
|
||||
|
||||
|
||||
def find_url(params, search="https://github.com/ekultek/zeus-scanner/issues"):
|
||||
"""
|
||||
get the URL that your issue is created at
|
||||
"""
|
||||
retval = "https://github.com{}"
|
||||
href = None
|
||||
searcher = re.compile(params, re.I)
|
||||
req = requests.get(search)
|
||||
status, html = req.status_code, req.content
|
||||
if status == 200:
|
||||
split_information = str(html).split("\n")
|
||||
for i, line in enumerate(split_information):
|
||||
if searcher.search(line) is not None:
|
||||
href = split_information[i-1]
|
||||
if href is not None:
|
||||
soup = BeautifulSoup(href, "html.parser")
|
||||
for item in soup.findAll("a"):
|
||||
link = item.get("href")
|
||||
return retval.format(link)
|
||||
return None
|
||||
|
||||
|
||||
def request_issue_creation():
|
||||
if not lib.core.settings.get_md5sum():
|
||||
lib.core.settings.logger.fatal(lib.core.settings.set_color(
|
||||
|
|
@ -60,8 +86,9 @@ 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)
|
||||
identifier = lib.core.settings.create_identifier()
|
||||
issue_title = "{} ({})".format(stacktrace.split("\n")[-2], identifier)
|
||||
issue_title = "Unhandled exception ({})".format(identifier)
|
||||
ff_version = lib.core.settings.get_browser_version()
|
||||
log_file_information = lib.core.settings.tails(current_log_file)
|
||||
|
||||
issue_data = {
|
||||
"title": issue_title,
|
||||
|
|
@ -78,7 +105,7 @@ def request_issue_creation():
|
|||
str(stacktrace),
|
||||
str(platform.platform()),
|
||||
" ".join(sys.argv),
|
||||
open(current_log_file).read()
|
||||
log_file_information
|
||||
),
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +121,9 @@ def request_issue_creation():
|
|||
urllib2.urlopen(req, timeout=10).read()
|
||||
lib.core.settings.logger.info(lib.core.settings.set_color(
|
||||
"issue has been created successfully with the following name '{}', your unique identifier "
|
||||
"for this issue is '{}'...".format(issue_title, identifier)
|
||||
"for this issue is '{}' and the URL to your issue is '{}'...".format(
|
||||
issue_title, identifier, find_url(identifier)
|
||||
)
|
||||
))
|
||||
except Exception as e:
|
||||
lib.core.settings.logger.exception(lib.core.settings.set_color(
|
||||
|
|
|
|||
Loading…
Reference in a new issue