Skip to content

Commit

Permalink
Change headers to dict and update long template (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnydo authored and nadouani committed Dec 20, 2018
1 parent 6b4c14d commit 0cc1564
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 84 deletions.
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>

0 comments on commit 0cc1564

Please sign in to comment.