Added SHA-256 to monkey exec logs

This commit is contained in:
Shay Nehmad 2019-10-07 11:04:24 +03:00
parent 3174a97d3e
commit 3336956737
1 changed files with 6 additions and 4 deletions

View File

@ -107,9 +107,11 @@ class MonkeyDownload(flask_restful.Resource):
filepath = MonkeyDownload.get_executable_full_path(filename) filepath = MonkeyDownload.get_executable_full_path(filename)
if os.path.isfile(filepath): if os.path.isfile(filepath):
with open(filepath, 'rb') as monkey_exec_file: with open(filepath, 'rb') as monkey_exec_file:
logger.debug("{} (SHA-512): {}".format( file_contents = monkey_exec_file.read()
filepath, logger.debug("{} hashes:\nSHA-512 {}\nSHA-256 {}".format(
hashlib.sha512(monkey_exec_file.read()).hexdigest()) filename,
) hashlib.sha512(file_contents).hexdigest(),
hashlib.sha256(file_contents).hexdigest()
))
else: else:
logger.debug("No monkey executable for {}.".format(filepath)) logger.debug("No monkey executable for {}.".format(filepath))