From 7695a0ea5178224b5dba3a6b4e210c2acfd3145a Mon Sep 17 00:00:00 2001 From: root Date: Fri, 5 Aug 2016 10:59:33 +0200 Subject: [PATCH 1/2] FEATURE: added zi Zip compressing reports.json and reports.html changed api and web interface as well --- conf/reporting.conf | 4 ++- .../{compression.py => zcompression.py} | 30 ++++++++++++++++++- web/analysis/views.py | 4 +-- web/api/views.py | 4 +-- 4 files changed, 36 insertions(+), 6 deletions(-) rename modules/reporting/{compression.py => zcompression.py} (65%) diff --git a/conf/reporting.conf b/conf/reporting.conf index f780f7654..9c11cf13c 100644 --- a/conf/reporting.conf +++ b/conf/reporting.conf @@ -108,12 +108,14 @@ resublimit = 5 enabled = no maxsimilar = 20 -[compression] +[zcompression] enabled = yes zipmemdump = yes zipmemstrings = yes zipprocdump = yes zipprocstrings = yes +ziprepjson = yes +ziprephtml = yes [misp] enabled = no diff --git a/modules/reporting/compression.py b/modules/reporting/zcompression.py similarity index 65% rename from modules/reporting/compression.py rename to modules/reporting/zcompression.py index d0e198447..114d4778f 100644 --- a/modules/reporting/compression.py +++ b/modules/reporting/zcompression.py @@ -4,10 +4,12 @@ import os import zipfile +import logging from lib.cuckoo.common.abstracts import Report from lib.cuckoo.common.exceptions import CuckooReportError +log = logging.getLogger(__name__) class Compression(Report): """Compresses analysis artifacts after processing/signatures are complete for permanent storage.""" @@ -16,6 +18,8 @@ def run(self, results): zipprocdump = self.options.get("zipprocdump", False) zipmemstrings = self.options.get("zipmemstrings", False) zipprocstrings = self.options.get("zipprocstrings", False) + ziprepjson = self.options.get("ziprepjson", False) + ziprephtml = self.options.get("ziprephtml", False) if "procmemory" in results and results["procmemory"]: for proc in results["procmemory"]: @@ -61,5 +65,29 @@ def run(self, results): strings_path = "%s.zip" % (strings_path) except Exception as e: raise CuckooReportError("Error creating Full Memory Strings Zip File %s" % e) - + rpath = self.reports_path + log.debug('repath %s, zip json: %s, zip html: %s, either params true %d, path exists: %d',self.reports_path,ziprepjson,ziprephtml, int(ziprepjson or ziprephtml), int(os.path.exists(rpath))) + if((ziprepjson or ziprephtml) and self.reports_path and os.path.exists(rpath)): + log.debug('zipping html or json reports') + rjfile=os.path.join(rpath, "report.json") + rhfile=os.path.join(rpath, "report.html") + log.debug('file 1: %s, file 2: %s',rjfile, rhfile) + if ziprepjson and os.path.exists(rjfile): + try: + f = zipfile.ZipFile("%s.zip" % (rjfile), "w", allowZip64=True) + f.write(rjfile, rpath, zipfile.ZIP_DEFLATED) + f.close() + os.remove(rjfile) + log.debug('finished compressing report json') + except Exception as e: + raise CuckooReportError("Error creating JSON Report Zip File %s" % e) + if ziprephtml and os.path.exists(rhfile): + try: + f = zipfile.ZipFile("%s.zip" % (rhfile), "w", allowZip64=True) + f.write(rhfile, rpath, zipfile.ZIP_DEFLATED) + f.close() + os.remove(rhfile) + log.debug('finished compressing report html') + except Exception as e: + raise CuckooReportError("Error creating HTML Report Zip File %s" % e) diff --git a/web/analysis/views.py b/web/analysis/views.py index b94539c37..397922ac2 100755 --- a/web/analysis/views.py +++ b/web/analysis/views.py @@ -954,8 +954,8 @@ def procdump(request, task_id, process_id, start, end): @conditional_login_required(login_required, settings.WEB_AUTHENTICATION) def filereport(request, task_id, category): formats = { - "json": "report.json", - "html": "report.html", + "json": "report.json.zip", + "html": "report.html.zip", "htmlsummary": "summary-report.html", "pdf": "report.pdf", "maec": "report.maec-4.1.xml", diff --git a/web/api/views.py b/web/api/views.py index 4b4748e61..9d3354380 100644 --- a/web/api/views.py +++ b/web/api/views.py @@ -1213,8 +1213,8 @@ def tasks_report(request, task_id, report_format="json"): "error_value": "No reports created for task %s" % task_id} formats = { - "json": "report.json", - "html": "report.html", + "json": "report.json.zip", + "html": "report.html.zip", "htmlsummary": "summary-report.html", "pdf": "report.pdf", "maec": "report.maec-4.1.xml", From 66d50755da71af573643f46dfb5e487aef13a3f5 Mon Sep 17 00:00:00 2001 From: muhviehstah Date: Wed, 24 Aug 2016 13:01:50 +0200 Subject: [PATCH 2/2] added german strings to button list --- analyzer/windows/modules/auxiliary/human.py | 44 +++++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/analyzer/windows/modules/auxiliary/human.py b/analyzer/windows/modules/auxiliary/human.py index 322866823..737fa0c06 100644 --- a/analyzer/windows/modules/auxiliary/human.py +++ b/analyzer/windows/modules/auxiliary/human.py @@ -32,6 +32,7 @@ def foreach_child(hwnd, lparam): # List of buttons labels to click. buttons = [ + # english "yes", "ok", "accept", @@ -40,8 +41,8 @@ def foreach_child(hwnd, lparam): "run", "agree", "enable", - "don't send", - "don't save", + "dont't send", + "dont't save", "continue", "unzip", "open", @@ -52,16 +53,51 @@ def foreach_child(hwnd, lparam): "end", "allow access", "remind me later", + # german + "ja", + "weiter", + "akzeptieren", + "ende", + "starten", + "jetzt starten", + "neustarten", + "neu starten", + "jetzt neu starten", + "beenden", + "oeffnen", + "schliessen", + "installation weiterfuhren", + "fertig", + "beenden", + "fortsetzen", + "fortfahren", + "stimme zu", + "zustimmen", + "senden", + "nicht senden", + "speichern", + "nicht speichern", + "ausfuehren", + "spaeter", + "einverstanden" ] # List of buttons labels to not click. dontclick = [ + # english "check online for a solution", "don't run", "do not ask again until the next update is available", "cancel", "do not accept the agreement", - "i would like to help make reader even better" + "i would like to help make reader even better", + # german + "abbrechen", + "online nach losung suchen", + "abbruch", + "nicht ausfuehren", + "hilfe", + "stimme nicht zu" ] classname = create_unicode_buffer(128) @@ -176,7 +212,7 @@ def run(self): # add some random data to the clipboard randchars = list(" aaaabcddeeeeeefghhhiiillmnnnooooprrrsssttttuwy") - cliplen = random.randint(10,1000) + cliplen = random.randint(10, 1000) clipval = [] for i in range(cliplen): clipval.append(randchars[random.randint(0, len(randchars)-1)])