diff --git a/bin/bitbot-log b/bin/bitbot-log index 959e6ca7..f067ff9f 100755 --- a/bin/bitbot-log +++ b/bin/bitbot-log @@ -11,7 +11,7 @@ arg_parser.add_argument("log", help="Location of the log file to decrypt") args = arg_parser.parse_args() -import base64 +import base64, sys from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import hashes @@ -38,11 +38,15 @@ def aes_decrypt(key: bytes, data_str: str): with open(args.key, "rb") as key_file: key_content = key_file.read() + key = serialization.load_pem_private_key( key_content, password=None, backend=default_backend()) -with open(args.log) as log_file: - lines = log_file.read().split("\n") +if args.log == "-": + lines = sys.stdin.read().split("\n") +else: + with open(args.log) as log_file: + lines = log_file.read().split("\n") lines = filter(None, lines) symm_key = None