handle submission if there is no good url (#1144)

This commit is contained in:
Michel Oosterhof 2019-06-13 08:34:49 +04:00 committed by GitHub
parent 8b363c3432
commit 31ad2c1a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -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: