Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTX query does not have actionable intelligence #1036

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions analyzers/OTXQuery/otxquery.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
import json
import json, re
import requests
import urllib
import hashlib
Expand Down Expand Up @@ -102,7 +102,7 @@ def otx_query_file(self, data):

if ip_['analysis']['analysis']:
# file has been analyzed before
self.report({
result = {
'pulse_count': ip_.get('general', {}).get('pulse_info', {}).get('count', "0"),
'pulses': ip_.get('general', {}).get('pulse_info', {}).get('pulses', "-"),
'malware': ip_.get('analysis', {}).get('malware', "-"),
Expand All @@ -120,8 +120,22 @@ def otx_query_file(self, data):
'filesize': ip_.get('analysis', {}).get('analysis', {}).get('info', {}).get('results', {}).get(
'filesize', "-"),
'ssdeep': ip_.get('analysis', {}).get('analysis', {}).get('info', {}).get('results', {}).get(
'ssdeep')
})
'ssdeep'),
'combined_score' : ip_.get('analysis', {}).get('analysis', {}).get('plugins', {}).get('cuckoo', {}).get(
'result', {}).get('info', {}).get('combined_score')
}
alert_val = ip_.get('analysis', {}).get('analysis', {}).get('plugins', {}).get('cuckoo', {}).get(
'result', {}).get('signatures')
if alert_val is not None and len(alert_val) > 0:
result['alerts'] = alert_val

ids_detections_val = ip_.get('analysis', {}).get('analysis', {}).get('plugins', {}).get('cuckoo', {}).get(
'result', {}).get('suricata', {}).get('rules')
if ids_detections_val is not None and len(ids_detections_val) > 0:
result['ids_detections'] = ids_detections_val

self.report(result)

else:
# file has not been analyzed before
self.report({
Expand Down Expand Up @@ -159,8 +173,27 @@ def summary(self, raw):
level = "info"
namespace = "OTX"
predicate = "Pulses"
pulses = dict()
value = "{}".format(raw["pulse_count"])
taxonomies.append(self.build_taxonomy(level, namespace, predicate, value))
pulses = raw.get("pulses", 0)
malicious_count = 0

if "combined_score" in raw:
combined_score = raw['combined_score']
if (combined_score < 3):
level = "safe"
elif (combined_score < 7):
level = "suspicious"
elif (combined_score >= 7):
level = "malicious"
taxonomies.append(self.build_taxonomy(level, namespace, predicate, value))
else:
for pulse in pulses:
for tag in pulse["tags"]:
if re.match(r"Malicious", tag, re.IGNORECASE) is not None:
malicious_count +=1
value = "Number of pulses: " + value + ", Pulses that have a malicious tag: " + str(malicious_count)
taxonomies.append(self.build_taxonomy(level, namespace, predicate, value))

return {"taxonomies": taxonomies}

Expand Down