diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 3519dd0..a0644cb 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -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: diff --git a/file_encryption_example.py b/examples/file_encryption_example.py similarity index 100% rename from file_encryption_example.py rename to examples/file_encryption_example.py diff --git a/string_encryption_example.py b/examples/string_encryption_example.py similarity index 100% rename from string_encryption_example.py rename to examples/string_encryption_example.py diff --git a/file_decryptor.py b/file_decryptor.py new file mode 100644 index 0000000..a84fb15 --- /dev/null +++ b/file_decryptor.py @@ -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 ") + 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") \ No newline at end of file diff --git a/file_encryptor.py b/file_encryptor.py index cc62799..b76ad83 100644 --- a/file_encryptor.py +++ b/file_encryptor.py @@ -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") \ No newline at end of file +print("Encrypted file: " + filepath + ".enc") \ No newline at end of file diff --git a/string_decryptor.py b/string_decryptor.py new file mode 100644 index 0000000..ad6557b --- /dev/null +++ b/string_decryptor.py @@ -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 ") + 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) diff --git a/string_encryptor.py b/string_encryptor.py new file mode 100644 index 0000000..347e9c1 --- /dev/null +++ b/string_encryptor.py @@ -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 ") + sys.exit(1) +stringToEncrypt = sys.argv[1] + + + +encrypted = hmacrypt.self_encrypt(stringToEncrypt) +with open("encrypted.txt", "wb+") as encryptedFile: + encryptedFile.write(encrypted) +print(encrypted)