mirror of
https://github.com/tcsenpai/hmacrypt.git
synced 2025-06-02 17:10:06 +00:00
restructured and wrote standalone tools
This commit is contained in:
parent
0300a20161
commit
de6def5a30
@ -20,18 +20,18 @@ lint:
|
||||
disabled:
|
||||
- bandit
|
||||
enabled:
|
||||
- black@24.1.0
|
||||
- checkov@3.1.70
|
||||
- black@24.1.1
|
||||
- checkov@3.2.5
|
||||
- git-diff-check
|
||||
- isort@5.13.2
|
||||
- markdownlint@0.38.0
|
||||
- osv-scanner@1.6.1
|
||||
- prettier@3.2.4
|
||||
- ruff@0.1.14
|
||||
- markdownlint@0.39.0
|
||||
- osv-scanner@1.6.2
|
||||
- prettier@3.2.5
|
||||
- ruff@0.2.1
|
||||
- shellcheck@0.9.0
|
||||
- shfmt@3.6.0
|
||||
- trivy@0.48.3
|
||||
- trufflehog@3.64.0
|
||||
- trivy@0.49.0
|
||||
- trufflehog@3.67.2
|
||||
- yamllint@1.33.0
|
||||
actions:
|
||||
disabled:
|
||||
|
19
file_decryptor.py
Normal file
19
file_decryptor.py
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/python
|
||||
|
||||
import src.hmacrypt as hmacrypt
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Getting and requiring exactly 1 argument
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python3 file_decryptor.py <filepath>")
|
||||
sys.exit(1)
|
||||
filepath = sys.argv[1]
|
||||
|
||||
# The file should exist and be readable
|
||||
if not os.path.isfile(filepath):
|
||||
print("File not found")
|
||||
sys.exit(1)
|
||||
|
||||
hmacrypt.self_decrypt_file(filepath, filepath + ".enc")
|
||||
print("decrypted file: " + filepath + ".enc")
|
@ -16,6 +16,4 @@ if not os.path.isfile(filepath):
|
||||
sys.exit(1)
|
||||
|
||||
hmacrypt.self_encrypt_file(filepath, filepath + ".enc")
|
||||
print("Encrypted file: " + filepath + ".enc")
|
||||
hmacrypt.self_decrypt_file(filepath + ".enc", filepath + ".dec.png")
|
||||
print("Decrypted file: " + filepath + ".dec.png")
|
||||
print("Encrypted file: " + filepath + ".enc")
|
22
string_decryptor.py
Normal file
22
string_decryptor.py
Normal file
@ -0,0 +1,22 @@
|
||||
import src.hmacrypt as hmacrypt
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Getting and requiring exactly 1 argument
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python3 string_decryptor.py <binary_file_with_encrypted_string>")
|
||||
sys.exit(1)
|
||||
filepath = sys.argv[1]
|
||||
|
||||
# The file should exist and be readable
|
||||
if not os.path.isfile(filepath):
|
||||
print("File not found")
|
||||
sys.exit(1)
|
||||
|
||||
with open(filepath, "rb") as f:
|
||||
stringToDecrypt = f.read()
|
||||
decrypted = hmacrypt.self_decrypt(stringToDecrypt)
|
||||
|
||||
with open("decrypted.txt", "wb+") as decryptedFile:
|
||||
decryptedFile.write(decrypted)
|
||||
print(decrypted)
|
15
string_encryptor.py
Normal file
15
string_encryptor.py
Normal file
@ -0,0 +1,15 @@
|
||||
import src.hmacrypt as hmacrypt
|
||||
import sys
|
||||
|
||||
# Getting and requiring exactly 1 argument
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python3 string_encryptor.py <string to encrypt>")
|
||||
sys.exit(1)
|
||||
stringToEncrypt = sys.argv[1]
|
||||
|
||||
|
||||
|
||||
encrypted = hmacrypt.self_encrypt(stringToEncrypt)
|
||||
with open("encrypted.txt", "wb+") as encryptedFile:
|
||||
encryptedFile.write(encrypted)
|
||||
print(encrypted)
|
Loading…
x
Reference in New Issue
Block a user