diff --git a/analyzers/BitcoinAbuse/BitcoinAbuse.json b/analyzers/BitcoinAbuse/BitcoinAbuse.json new file mode 100644 index 000000000..8769d28c0 --- /dev/null +++ b/analyzers/BitcoinAbuse/BitcoinAbuse.json @@ -0,0 +1,20 @@ +{ + "name": "BitcoinAbuse", + "version": "1.0", + "author": "Peter Juhas", + "url": "https://github.com/pjuhas/Cortex-Analyzers", + "license": "AGPL-V3", + "description": "Check Bitcoin address against Bitcoin Abuse database", + "dataTypeList": ["btc_address"], + "baseConfig": "BitcoinAbuse", + "configurationItems": [ + { + "name": "key", + "description": "API key for Bitcoin Abuse", + "type": "string", + "multi": false, + "required": true + } + ], + "command": "BitcoinAbuse/BitcoinAbuse.py" +} \ No newline at end of file diff --git a/analyzers/BitcoinAbuse/BitcoinAbuse.py b/analyzers/BitcoinAbuse/BitcoinAbuse.py new file mode 100644 index 000000000..d8538d269 --- /dev/null +++ b/analyzers/BitcoinAbuse/BitcoinAbuse.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +import requests +from cortexutils.analyzer import Analyzer + + +class BitcoinAbuse(Analyzer): + + def __init__(self): + Analyzer.__init__(self) + self.test_key = self.get_param('config.key', None, 'Missing Bitcoin Abuse API key') + + def summary(self, raw): + color = 0 + taxonomies = [] + level = 'info' + namespace = 'Bitcoin Abuse' + predicate = 'Report count' + value = "0" + if "count" in raw: + value = "{}".format(raw["count"]) + color = raw["count"] + + if color == 0: + level = "safe" + elif color < 5: + level = "suspicious" + elif color > 4: + level = "malicious" + + taxonomies.append(self.build_taxonomy(level, namespace, predicate, value)) + return {'taxonomies': taxonomies} + + def run(self): + Analyzer.run(self) + if self.data_type == 'btc_address': + try: + data = self.get_data() + s = requests.Session() + response_details = s.get('https://www.bitcoinabuse.com/api/reports/check?address={}&api_token={}' + .format(data, self.test_key)) + if response_details.status_code == 200: + result = response_details.json() + self.report(result if len(result) > 0 else {}) + else: + self.error('Failed to query Bitcoin Abuse details. Status_code {}'.format(response_details.status_code)) + except Exception as e: + self.unexpectedError(e) + else: + self.notSupported() + + +if __name__ == '__main__': + BitcoinAbuse().run() diff --git a/analyzers/BitcoinAbuse/requirements.txt b/analyzers/BitcoinAbuse/requirements.txt new file mode 100644 index 000000000..4a21dbf63 --- /dev/null +++ b/analyzers/BitcoinAbuse/requirements.txt @@ -0,0 +1,2 @@ +cortexutils +requests \ No newline at end of file diff --git a/thehive-templates/BitcoinAbuse_1_0/long.html b/thehive-templates/BitcoinAbuse_1_0/long.html new file mode 100644 index 000000000..36151c39c --- /dev/null +++ b/thehive-templates/BitcoinAbuse_1_0/long.html @@ -0,0 +1,56 @@ +
+
+ Summary + + Show All ({{::content.recent.length}}) + Show less + +
+ +
+ + + + + + + + + +
DescriptionTime
{{r.description | ellipsis:130}}{{r.created_at}}
+
+
+
+
+ Other info +
+
+ + + + + +
URL + + + View Full Report + +
+
+
+ + +
+
+ {{artifact.data | fang}} +
+
+
+
+ urlscan.io: +
+
{{content.errorMessage}}
+
+
+
+ diff --git a/thehive-templates/BitcoinAbuse_1_0/short.html b/thehive-templates/BitcoinAbuse_1_0/short.html new file mode 100644 index 000000000..5fc0dabfb --- /dev/null +++ b/thehive-templates/BitcoinAbuse_1_0/short.html @@ -0,0 +1,3 @@ + + {{t.namespace}}:{{t.predicate}}="{{t.value}}" +