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

Improvement: Eml_Parser Analyzer & Template #393

Merged
merged 1 commit into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion analyzers/EmlParser/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def parseEml(filepath):
#cause eml_parser does not provide raw headers (as far as I know)
hParser = email.parser.HeaderParser()
h = hParser.parsestr(raw_eml)
result['headers'] = (str(h).split('\n\n')[0])
result['headers'] = dict(h)

parsed_eml = eml_parser.eml_parser.decode_email(filepath, include_raw_body=True, include_attachment_data=True)
#parsed_eml['header'].keys() gives:
Expand Down
176 changes: 93 additions & 83 deletions thehive-templates/EmlParser_1_1/long.html
Original file line number Diff line number Diff line change
@@ -1,86 +1,96 @@
<div class="panel panel-danger" ng-if="!success">
<div class="panel-heading">
<strong>{{(artifact.data || artifact.attachment.name) | fang}}</strong>
<div class="panel-heading">
<strong>{{(artifact.data || artifact.attachment.name) | fang}}</strong>
</div>
<div class="panel-body">
{{content.errorMessage}}
</div>
</div>
<div class="panel-body">
{{content.errorMessage}}


<div class="panel panel-info" ng-if="success">
<div class="panel-heading">
Email message details
</div>
<div class="panel-body">
<div ng-show="content.traits.is_anonymous_proxy" class="alert alert-warning">Is anonymous proxy</div>
<div ng-show="content.traits.is_satellite_provider" class="alert alert-warning">Is satellite provider</div>

<dl class="dl-horizontal">
<dt>From</dt>
<dd>{{content.displayFrom}} ({{content.sender}})</dd>
</dl>
<dl class="dl-horizontal">
<dt>To</dt>
<dd>{{content.displayTo}} ({{content.receivers}})</dd>
</dl>
<dl class="dl-horizontal">
<dt>Subject</dt>
<dd>{{content.subject || '-'}}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Topic</dt>
<dd>{{content.topic || '-'}}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Bcc</dt>
<dd>{{content.bcc || '-'}}</dd>
</dl>
<dl class="dl-horizontal" ng-if="content.attachments && content.attachments.length !== 0">
<dt>Attachments</dt>
<dd>
<div class="bm10">This message file includes
<ng-pluralize count="content.attachments.length" when="{'1': '1 attachment', 'other': '{} attachments'}"></ng-pluralize>
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th class="col-md-2" >Filename</th>
<th >File information</th>

</tr>
</thead>
<tbody ng-repeat="a in content.attachments">
<tr>
<td rowspan=4>{{a.filename}}</td>
<td>[MD5]: {{a.md5}}</td>
</tr>
<tr>
<td>[SHA1]: {{a.sha1}}</td>
</tr>
<tr>
<td>[SHA256]: {{a.sha256}}</td>
</tr>
<tr>
<td>
{{a.mime}}
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
<dl class="dl-horizontal">
<dt>Headers</dt>
<dd>
<table class="table table-striped table-bordered">
<tr>
<th class="col-md-2">Header</th>
<th>Content</th>
</tr>
<tr ng-repeat="(k, v) in content.headers">
<td>{{k}}</td>
<td>{{v}}</td>
</tr>
</table>
</dd>
</dl>
<dl class="dl-horizontal">
<dt>Body</dt>
<dd>
<pre>{{content.body}}</pre>
</dd>
</dl>
</div>
</div>
</div>


<div class="panel panel-info" ng-if="success">
<div class="panel-heading">
Email message details
</div>
<div class="panel-body">
<div ng-show="content.traits.is_anonymous_proxy" class="alert alert-warning">Is anonymous proxy</div>
<div ng-show="content.traits.is_satellite_provider" class="alert alert-warning">Is satellite provider</div>

<dl class="dl-horizontal">
<dt>From</dt>
<dd>{{content.displayFrom}} ({{content.sender}})</dd>
</dl>
<dl class="dl-horizontal">
<dt>To</dt>
<dd>{{content.displayTo}} ({{content.receivers}})</dd>
</dl>
<dl class="dl-horizontal">
<dt>Subject</dt>
<dd>{{content.subject || '-'}}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Topic</dt>
<dd>{{content.topic || '-'}}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Bcc</dt>
<dd>{{content.bcc || '-'}}</dd>
</dl>
<dl class="dl-horizontal" ng-if="content.attachments && content.attachments.length !== 0">
<dt>Attachments</dt>
<dd>
<div class="bm10">This message file includes
<ng-pluralize count="content.attachments.length" when="{'1': '1 attachment', 'other': '{} attachments'}"></ng-pluralize>
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th class="col-md-2" >Filename</th>
<th >File information</th>

</tr>
</thead>
<tbody ng-repeat="a in content.attachments">
<tr>
<td rowspan=4>{{a.filename}}</td>
<td>[MD5]: {{a.md5}}</td>
</tr>
<tr>
<td>[SHA1]: {{a.sha1}}</td>
</tr>
<tr>
<td>[SHA256]: {{a.sha256}}</td>
</tr>
<tr>
<td>
{{a.mime}}
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
<dl class="dl-horizontal">
<dt>Headers</dt>
<dd>
<pre>{{content.headers}}</pre>
</dd>
</dl>
<dl class="dl-horizontal">
<dt>Body</dt>
<dd>
<pre>{{content.body}}</pre>
</dd>
</dl>
</div>
</div>