certsocietegenerale / fame

FAME Automates Malware Evaluation
https://certsocietegenerale.github.io/fame/
GNU General Public License v3.0
847 stars 168 forks source link

Patch: Include File Size in Object Details and file Class. #25

Closed 53BStsttr6EDff closed 6 years ago

53BStsttr6EDff commented 7 years ago

Hello,

I didn't see this available in any of the models, so I added it to the file model.

diff --git a/fame/core/file.py b/fame/core/file.py
index 288a478..ab8816b 100755
--- a/fame/core/file.py
+++ b/fame/core/file.py
@@ -124,6 +124,7 @@ class File(MongoDict):
         self['detailed_type'] = magic.from_file(self['filepath'])
         self['mime'] = magic.from_file(self['filepath'], mime=True)
         self['analysis'] = []
+        self['size'] = os.path.getsize(self['filepath'])

         # Init antivirus status
         self['antivirus'] = {}
diff --git a/web/templates/files/details.html b/web/templates/files/details.html
index e6d36dc..ce05576 100755
--- a/web/templates/files/details.html
+++ b/web/templates/files/details.html
@@ -26,6 +26,10 @@
                 </div>
                 {% if not file.type == 'url' %}
                 <div class="row">
+                    <div class="col-sm-2 text-right"><strong>File Size</strong></div>
+                    <div class="col-sm-10">{{file.size}} bytes</div>
+                </div>
+                <div class="row">
                     <div class="col-sm-2 text-right"><strong>MD5</strong></div>
                     <div class="col-sm-10">{{file.md5}}</div>
                 </div>
gaelmuller commented 6 years ago

Thank you for your contribution, this was included in master.