Skip to content

Commit

Permalink
Fixes another date bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Te-k committed Dec 30, 2019
1 parent 0328159 commit fd106e9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions harpoon/commands/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ def run(self, conf, args, plugins):
for r in res["url_list"]["url_list"]:
if "result" in r:
urls.append({
"date": parse(r["date"]),
"date": parse(r["date"]).astimezone(pytz.utc),
"url": r["url"],
"ip": r["result"]["urlworker"]["ip"] if "ip" in r["result"]["urlworker"] else "" ,
"source": "OTX"
})
else:
urls.append({
"date": parse(r["date"]),
"date": parse(r["date"]).astimezone(pytz.utc),
"url": r["url"],
"ip": "",
"source": "OTX"
Expand Down Expand Up @@ -217,7 +217,7 @@ def run(self, conf, args, plugins):
for r in raw_results["results"]:
malware.append({
'hash': r["sample"],
'date': parse(r['collectionDate']),
'date': parse(r['collectionDate']).astimezone(pytz.utc),
'source' : 'PT (%s)' % r["source"]
})
except requests.exceptions.ReadTimeout:
Expand All @@ -242,29 +242,29 @@ def run(self, conf, args, plugins):
for r in res['results']['undetected_downloaded_samples']:
files.append({
'hash': r['sha256'],
'date': parse(r['date']) if 'date' in r else '',
'date': parse(r['date']).astimezone(pytz.utc) if 'date' in r else '',
'source' : 'VT'
})
if "undetected_referrer_samples" in res['results']:
for r in res['results']['undetected_referrer_samples']:
files.append({
'hash': r['sha256'],
'date': parse(r['date']) if 'date' in r else '',
'date': parse(r['date']).astimezone(pytz.utc) if 'date' in r else '',
'source' : 'VT'
})
if "detected_downloaded_samples" in res['results']:
for r in res['results']['detected_downloaded_samples']:
malware.append({
'hash': r['sha256'],
'date': parse(r['date']),
'date': parse(r['date']).astimezone(pytz.utc),
'source' : 'VT'
})
if "detected_referrer_samples" in res['results']:
for r in res['results']['detected_referrer_samples']:
if "date" in r:
malware.append({
'hash': r['sha256'],
'date': parse(r['date']),
'date': parse(r['date']).astimezone(pytz.utc),
'source' : 'VT'
})
if "detected_urls" in res['results']:
Expand All @@ -287,7 +287,7 @@ def run(self, conf, args, plugins):
if 'items' in res:
for r in res['items']:
if r['sample_sha256'] not in already:
d = parse(r['ts'])
d = parse(r['ts']).astimezone(pytz.utc)
d = d.replace(tzinfo=None)
malware.append({
'hash': r["sample_sha256"],
Expand Down

0 comments on commit fd106e9

Please sign in to comment.