Skip to content

Commit

Permalink
Merge pull request #1251 from TheHive-Project/fix/proofpoint-Lookup-f…
Browse files Browse the repository at this point in the history
…ile-hashing

#1250 fix: use file_digest to hash file
  • Loading branch information
jeromeleonard authored Mar 29, 2024
2 parents 75a888c + 0f17920 commit 502f396
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion analyzers/ProofPoint/proofpoint_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def run(self):
if self.data_type == 'file':
filename = self.get_param('attachment.name', 'noname.ext')
filepath = self.get_param('file', None, 'File is missing')
sha256 = hashlib.sha256(open(filepath, 'r').read()).hexdigest()
with open(filepath, "rb") as f:
digest = hashlib.file_digest(f, "sha256")
sha256 = digest.hexdigest()
elif self.data_type == 'hash' and len(self.get_data()) == 64:
sha256 = self.get_data()
else:
Expand Down

0 comments on commit 502f396

Please sign in to comment.