-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #849 from jonathan6661/master
New analyzer: Inoitsu email lookup.
- Loading branch information
Showing
9 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "Inoitsu", | ||
"version": "1.0", | ||
"author": "Abdelkader Ben Ali", | ||
"url": "https://github.com/TheHive-Project/Cortex-Analyzers", | ||
"license": "MIT", | ||
"description": "Query Inoitsu for a compromised email address.", | ||
"dataTypeList": ["mail"], | ||
"command": "Inoitsu/inoitsu_analyzer.py", | ||
"baseConfig": "Inoitsu", | ||
"configurationItems": [ | ||
|
||
], | ||
"registration_required": false, | ||
"subscription_required": false, | ||
"service_homepage": "https://www.hotsheet.com/inoitsu/", | ||
"service_logo": { | ||
"path": "assets/inoitsu_logo.png", | ||
"caption": "logo" | ||
}, | ||
"screenshots": [ | ||
{ | ||
"path": "assets/Inoitsu_long.png", | ||
"caption": "Inoitsu long report sample" | ||
}, | ||
{ | ||
"path": "assets/Inoitsu_short.png", | ||
"caption:": "Inoitsu mini report sample" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Inoitsu-analyzer | ||
|
||
This analyzer helps you investigate suspicious emails received from known or unknown senders to ensure that their email addresses aren't compromised. | ||
|
||
No API key required. | ||
|
||
If the email is compromised then it returns: | ||
- Total breaches | ||
- Most recent breach | ||
- Breached data | ||
- Critical data | ||
- Exposure rating: The comparative data exposure and risk rating assigned to this email address. | ||
|
||
### Testing Inoitsu analyzer (Cortex) | ||
|
||
You need first to enable the analyzer. | ||
|
||
 | ||
|
||
Navigate to Analyzers then run Inoitsu analyzer. | ||
|
||
 | ||
|
||
Test Inoitsu analyzer on a compromised email address. | ||
|
||
 | ||
|
||
Test Inoitsu analyzer on an uncompromised email address. | ||
|
||
 | ||
|
||
### Testing Inoitsu analyzer (TheHive) | ||
|
||
In the observables section add emails to test. | ||
|
||
Then select the emails that you want to analyze, select Inoitsu and click on Run selected analyzers. | ||
|
||
 | ||
|
||
 | ||
|
||
To view the report of the compromised email, click on ```Inoitsu:Compromised="True"``` | ||
|
||
 | ||
|
||
To view the report of the uncompromised email, click on ```Inoitsu:Compromised="False"``` | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env python3 | ||
from cortexutils.analyzer import Analyzer | ||
import requests | ||
import re | ||
|
||
|
||
class InoitsuAnalyzer(Analyzer): | ||
def __init__(self): | ||
Analyzer.__init__(self) | ||
|
||
def verify_email_format(self, email): | ||
email_regex = '^(?i)[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$' | ||
if(re.search(email_regex,email)): | ||
return True | ||
else: | ||
return False | ||
|
||
def remove_html_tags(self, html): | ||
regex = re.compile('<.*?>') | ||
cleantext = re.sub(regex, '', html) | ||
return cleantext | ||
|
||
def inoitsu_check(self,email): | ||
url ="https://www.hotsheet.com/inoitsu/" | ||
data = {'act' : email, 'accounthide' : 'test', 'submit' : 'Submit'} | ||
r = requests.post(url, data=data, timeout=10) | ||
response = r.text | ||
if 'BREACH DETECTED!' in response: | ||
cleantext = self.remove_html_tags(response) | ||
text = cleantext.replace(' ','') | ||
Breached_data_finder = re.search('Breached Personal Data(.*)Critical Identity Alerts', text) | ||
Breached_data = Breached_data_finder.group(1)[1:] | ||
Critical_data_finder = re.search('Critical Identity Alerts(.*)Total Breaches', text) | ||
Critical_data = Critical_data_finder.group(1)[1:] | ||
Total_breaches_finder = re.search('Total Breaches(.*)Most Recent Breach', text) | ||
Total_breaches = Total_breaches_finder.group(1)[1:] | ||
Most_recent_breach_finder = re.search('Most Recent Breach(.*)Relative Exposure Rating', text) | ||
Most_recent_breach = Most_recent_breach_finder.group(1)[2:] | ||
Exposure_rating_finder = re.search('Relative Exposure Rating(.*)breach data from', text) | ||
Exposure_rating = Exposure_rating_finder.group(1)[2:] | ||
result = dict(Email = email, Leaked = True, Breached_data = Breached_data, Critical_data = Critical_data, | ||
Total_breaches = int(Total_breaches), Most_recent_breach = Most_recent_breach, | ||
Exposure_rating = Exposure_rating) | ||
return result | ||
else: | ||
return dict(Email = email, Leaked = False) | ||
|
||
def summary(self, raw): | ||
taxonomies = [] | ||
level = "info" | ||
namespace = "Inoitsu" | ||
predicate = "Compromised" | ||
leaked = raw.get("Leaked") | ||
if leaked: | ||
level = "malicious" | ||
value = "True" | ||
else: | ||
level = "safe" | ||
value = "False" | ||
taxonomies.append( | ||
self.build_taxonomy(level, namespace, predicate, value) | ||
) | ||
return {"taxonomies": taxonomies} | ||
|
||
def run(self): | ||
email = self.get_data() | ||
if not email: | ||
self.error('No email given.') | ||
try: | ||
if self.verify_email_format(email): | ||
result = self.inoitsu_check(email) | ||
self.report(result) | ||
else: | ||
self.error('Your input is not an email.') | ||
except Exception as e: | ||
self.error(str(e)) | ||
|
||
if __name__ == "__main__": | ||
InoitsuAnalyzer().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
requests | ||
re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<div class="report-SecurityTrails" ng-if="success"> | ||
<div class="panel panel-info"> | ||
<div class="panel-heading"> | ||
Inoitsu lookup ({{ content.Email }}) | ||
</div> | ||
<div class="panel-body"> | ||
<div ng-if="(content | json) === '{}'"> | ||
No data found | ||
</div> | ||
<div ng-if="(content | json) !== '{}'"> | ||
|
||
<div ng-if="(content.Leaked)"> | ||
<dl class=" dl-horizontal"> | ||
<dt>Compromised:</dt> | ||
<dd class="wrap">{{ content.Leaked }}</dd> | ||
</dl> | ||
<dl class=" dl-horizontal"> | ||
<dt>Total breaches:</dt> | ||
<dd class="wrap">{{ content.Total_breaches }}</dd> | ||
</dl> | ||
<dl class="dl-horizontal"> | ||
<dt>Most recent breach:</dt> | ||
<dd class="wrap">{{ content.Most_recent_breach }}</dd> | ||
</dl> | ||
<dl class="dl-horizontal"> | ||
<dt>Breached data:</dt> | ||
<dd class="wrap">{{ content.Breached_data }}</dd> | ||
</dl> | ||
<dl class="dl-horizontal"> | ||
<dt>Critical data:</dt> | ||
<dd class="wrap">{{ content.Critical_data }}</dd> | ||
</dl> | ||
<dl class="dl-horizontal"> | ||
<dt>Exposure rating:</dt> | ||
<dd class="wrap">{{ content.Exposure_rating }}</dd> | ||
</dl> | ||
</div> | ||
|
||
<div ng-if="!(content.Leaked)"> | ||
<dl class=" dl-horizontal"> | ||
<dt>Compromised:</dt> | ||
<dd class="wrap">{{ content.Leaked }}</dd> | ||
</dl> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<!-- General error --> | ||
<div class="panel panel-danger" ng-if="!success"> | ||
<div class="panel-heading"> | ||
<strong>{{ artifact.data | fang }}</strong> | ||
</div> | ||
<div class="panel-body"> | ||
<dl class="dl-horizontal" ng-if="content.errorMessage"> | ||
<dt> | ||
<i class="fa fa-warning"></i> | ||
</dt> | ||
<dd class="wrap">{{ content.errorMessage }}</dd> | ||
</dl> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |