From 31ad2c1a547046d22f1a443dfaab8a9198ce4b44 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Thu, 13 Jun 2019 08:34:49 +0400 Subject: [PATCH] handle submission if there is no good url (#1144) --- src/cowrie/output/virustotal.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cowrie/output/virustotal.py b/src/cowrie/output/virustotal.py index 0137bdd3..0e72f220 100644 --- a/src/cowrie/output/virustotal.py +++ b/src/cowrie/output/virustotal.py @@ -168,15 +168,16 @@ class Output(cowrie.core.output.Output): session=entry['session'], sha256=j['resource'], is_new="true") - p = urlparse(entry['url']).path - if p == "": - fileName = entry['shasum'] - else: - b = os.path.basename(p) + + try: + b = os.path.basename(urlparse(entry['url']).path) if b == "": fileName = entry['shasum'] else: fileName = b + except KeyError: + fileName = entry['shasum'] + if self.upload is True: return self.postfile(entry['outfile'], fileName) else: