patch for a reported issue where saving the files would save over the important logs, such as url-log-1 -> url-log(1), blackwidow-log-1 -> blackwidow-log(1) (privatley reported)

This commit is contained in:
ekultek 2017-11-09 10:57:51 -06:00
parent 49cfc78d9e
commit 4ac02a8ff1
2 changed files with 4 additions and 3 deletions

View file

@ -51,7 +51,7 @@ c26df169167f18dad922d14d64d15c7f ./lib/attacks/admin_panel_finder/__init__.py
686935ee6e0277f93aec904bb60d8004 ./lib/attacks/intel_me/__init__.py
1faa2b5dfad6eb538bbfe42942d2a9da ./lib/core/errors.py
d41d8cd98f00b204e9800998ecf8427e ./lib/core/__init__.py
bb9e634196a78ada615128612a7c05e8 ./lib/core/settings.py
0f6e4e4cab1fc589e7285a2274a7c292 ./lib/core/settings.py
c265970650a068c0f0cdfcdb756c9914 ./lib/header_check/__init__.py
d41d8cd98f00b204e9800998ecf8427e ./var/google_search/__init__.py
80a3ec2db4c45cae6df673676149f9ad ./var/google_search/search.py

View file

@ -53,7 +53,7 @@ PATCH_ID = str(subprocess.check_output(["git", "rev-parse", "origin/master"]))[:
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.1.26.{}".format(PATCH_ID)
VERSION = "1.1.27.{}".format(PATCH_ID)
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
@ -506,6 +506,7 @@ def write_to_log_file(data_to_write, path, filename):
os.getcwd()
))) + 1)
)
skip_log_schema = ("url-log", "blackwidow-log", "zeus-log")
to_search = filename.split("-")[0]
amount = len([f for f in os.listdir(path) if to_search in f])
new_filename = "{}({}).{}".format(
@ -518,7 +519,7 @@ def write_to_log_file(data_to_write, path, filename):
log.write(etree.tostring(data_to_write, pretty_print=True))
except TypeError:
return write_to_log_file(data_to_write, path, new_filename)
elif amount > 0 and "url-log" not in filename:
elif amount > 0 and not any(_ in filename for _ in list(skip_log_schema)):
return write_to_log_file(data_to_write, path, new_filename)
else:
if isinstance(data_to_write, list):