-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b107af
commit c254637
Showing
3 changed files
with
16 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
#!/usr/bin/python3 | ||
# Hash: b3bdd013f179bb06e9be80e8282c3d3dcaf34463f33257b88a96769daf51689c | ||
# Hash: 7171f49aa3395c9177ee86c621c5635ad5f62cc52a8564e5adb6b7f2e50b786b | ||
# Author: Ron Stoner | ||
# Github: ronaldstoner | ||
# Website: stoner.com | ||
|
||
"""Script to verify the selfhash/selfhash.py module hash""" | ||
|
||
import sys | ||
import selfhash | ||
|
||
def verify_selfhash(): | ||
"""Verifies the hash of the selfhash.py module.""" | ||
|
||
# Instantiate the SelfHash class with bypass_salt=True to skip salt prompt | ||
hasher = selfhash.SelfHash(bypass_salt=True) | ||
|
||
# Perform the hash verification check on the selfhash.py module | ||
print("\nVerifying the hash of the 'selfhash/selfhash.py' module...") | ||
hasher.hash("selfhash/selfhash.py") # Replace with the actual path to selfhash.py if needed | ||
|
||
# Output the calculated hash and comparison results | ||
print("Expected Hash: ", hasher.known_hash) | ||
print("Actual Hash: ", hasher.source_code_hash) | ||
if hasher.known_hash != hasher.source_code_hash: | ||
print("\033[91mFAIL\033[0m: The selfhash.py module has been tampered with or the hash does not match.") | ||
print("Expected Hash: ", hasher.known_hash) | ||
print("Actual Hash: ", hasher.source_code_hash) | ||
exit(1) | ||
sys.exit(1) | ||
elif hasher.known_hash in ("INSERT_HASH_HERE", "Hash:"): | ||
print("\033[93mWARNING\033[0m: The hash is not set yet. Please replace 'INSERT_HASH_HERE' with the calculated hash.") | ||
print("Generated Hash: ", hasher.source_code_hash) | ||
exit(1) | ||
sys.exit(1) | ||
print("\nVerification complete.") | ||
|
||
# Run the verification function | ||
if __name__ == "__main__": | ||
verify_selfhash() | ||
|