-
Notifications
You must be signed in to change notification settings - Fork 385
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
add threatcrowd analyzer #244
Changes from 4 commits
506353e
ce631fb
32f8fd6
d4159d7
3cd2e6e
f62f22f
5641d69
86bcbce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Threatcrowd", | ||
"author": "Rémi ALLAIN, Cyberprotect", | ||
"license": "AGPL-V3", | ||
"url": "https://github.com/Cyberprotect/Cortex-Analyzers", | ||
"version": "1.0", | ||
"description": "Search for information on threatcrowd.org", | ||
"dataTypeList": [ | ||
"email", | ||
"ip", | ||
"domain" | ||
], | ||
"command": "Threatcrowd/threatcrowd_analyzer.py", | ||
"baseConfig": "Threatcrowd", | ||
"config": { | ||
"check_tlp": false, | ||
"service": "get" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cortexutils | ||
requests |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
import requests | ||
from cortexutils.analyzer import Analyzer | ||
|
||
class Threatcrowd(Analyzer): | ||
|
||
URI = "https://www.threatcrowd.org/searchApi/v2" | ||
|
||
def summary(self, raw): | ||
taxonomies = [] | ||
|
||
level = "info" | ||
value = "None" | ||
|
||
if 'votes' in raw: | ||
r = raw.get('votes') | ||
value = r | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (the |
||
if r == 1: | ||
level = "safe" | ||
elif r == 0: | ||
level = "suspicious" | ||
elif r == -1: | ||
level = "malicious" | ||
|
||
taxonomies.append(self.build_taxonomy(level, "Threatcrowd", "votes", value)) | ||
|
||
result = {"taxonomies": taxonomies} | ||
return result | ||
|
||
def run(self): | ||
Analyzer.run(self) | ||
|
||
if (self.data_type == 'domain' or self.data_type == 'ip' or self.data_type == 'email'): | ||
try: | ||
response = requests.get("{}/{}/report/".format(self.URI, self.data_type), {self.data_type: self.get_data()}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above: default e-mail datatype is Something like |
||
self.report(response.json()) | ||
except Exception as e: | ||
self.unexpectedError(e) | ||
else: | ||
self.notSupported() | ||
|
||
|
||
if __name__ == '__main__': | ||
Threatcrowd().run() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<div class="panel panel-info" ng-if="success"> | ||
<div class="panel-heading"> | ||
Threatcrowd analysis for | ||
<strong>{{artifact.data}}</strong> | ||
</div> | ||
<div class="panel-body"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should catch an empty result, because currently there would be an empty table. |
||
<h4 class="dl-horizontal"> | ||
Votes : <strong>{{content.votes}}</strong> | ||
<br/> | ||
<a href="{{content.permalink}}">View report on threatcrowd.org</a> | ||
</h4> | ||
<table class="table table-bordered"> | ||
<tr> | ||
<th>References</th> | ||
</tr> | ||
<tr ng-repeat="ref in ::content.references"> | ||
<td>{{ref}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-bordered"> | ||
<tr> | ||
<th>Domains</th> | ||
</tr> | ||
<tr ng-repeat="dom in ::content.domains"> | ||
<td>{{dom}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-bordered"> | ||
<tr> | ||
<th>Subdomains</th> | ||
</tr> | ||
<tr ng-repeat="dom in ::content.subdomains"> | ||
<td>{{dom}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-bordered"> | ||
<tr> | ||
<th>Emails</th> | ||
</tr> | ||
<tr ng-repeat="email in ::content.emails"> | ||
<td>{{email}}</td> | ||
</tr> | ||
</table> | ||
<table class="table table-bordered"> | ||
<tr> | ||
<th colspan="3">Resolutions</th> | ||
</tr> | ||
<tr> | ||
<th>Last resolved</th> | ||
<th>Domain</th> | ||
<th>Ip</th> | ||
</tr> | ||
<tr ng-repeat="res in ::content.resolutions"> | ||
<td>{{res.last_resolved}}</td> | ||
<td>{{res.domain}}</td> | ||
<td>{{res.ip_address}}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<div class="panel panel-danger" ng-if="!success"> | ||
<div class="panel-heading"> | ||
<strong>{{(artifact.data || artifact.attachment.name) | fang}}</strong> | ||
</div> | ||
<div class="panel-body"> | ||
{{content.errorMessage}} | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span class="label" ng-repeat="t in content.taxonomies" ng-class="{'info': 'label-info', 'safe': 'label-success', 'suspicious': 'label-warning', 'malicious':'label-danger'}[t.level]"> | ||
{{t.namespace}}:{{t.predicate}}={{t.value}} | ||
</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default e-mail data type is
mail
.