diff --git a/LnkParse3/exceptions.py b/LnkParse3/exceptions.py index 0deb09b1..61e36adf 100644 --- a/LnkParse3/exceptions.py +++ b/LnkParse3/exceptions.py @@ -1,2 +1 @@ -class LnkParserError(Exception): - ... +class LnkParserError(Exception): ... diff --git a/LnkParse3/extra/terminal.py b/LnkParse3/extra/terminal.py index 095cfce7..adbe8772 100644 --- a/LnkParse3/extra/terminal.py +++ b/LnkParse3/extra/terminal.py @@ -33,5 +33,5 @@ def size(self): def as_dict(self): tmp = super().as_dict() - tmp["sha256"] = hashlib.sha256(self.appended_data()).hexdigest() + tmp["appended_data_sha256"] = hashlib.sha256(self.appended_data()).hexdigest() return tmp diff --git a/LnkParse3/extra/unknown.py b/LnkParse3/extra/unknown.py index 3ba0cb67..50f4333f 100644 --- a/LnkParse3/extra/unknown.py +++ b/LnkParse3/extra/unknown.py @@ -18,5 +18,5 @@ def extra_data(self): def as_dict(self): tmp = super().as_dict() - tmp["sha256"] = hashlib.sha256(self.extra_data()).hexdigest() + tmp["extra_data_sha256"] = hashlib.sha256(self.extra_data()).hexdigest() return tmp diff --git a/LnkParse3/lnk_file.py b/LnkParse3/lnk_file.py index 2b761a01..3cb5734d 100755 --- a/LnkParse3/lnk_file.py +++ b/LnkParse3/lnk_file.py @@ -5,7 +5,6 @@ __version__ = "1.3.3" import json -import hashlib import datetime import argparse from subprocess import list2cmdline @@ -97,8 +96,6 @@ def cprint(text, level=0): print(" " * (level * SPACING) + text) # add leading spaces def nice_id(identifier): - if identifier.lower() in hashlib.algorithms_guaranteed: - return identifier.upper().replace("_", " ") return identifier.capitalize().replace("_", " ") # TODO recursive nice print @@ -266,7 +263,9 @@ def nice_id(identifier): cprint(f"{nice_id(key)}: {value}", 4) else: for key, value in extra_value.items(): - if extra_key == "METADATA_PROPERTIES_BLOCK" and isinstance(value, list): + if extra_key == "METADATA_PROPERTIES_BLOCK" and isinstance( + value, list + ): cprint(f"{nice_id(key)}:", 3) for storage in value: cprint("Storage:", 4) @@ -276,9 +275,13 @@ def nice_id(identifier): for item in storage_value: cprint("Property:", 6) for item_key, item_value in item.items(): - cprint(f"{nice_id(item_key)}: {item_value}", 7) + cprint( + f"{nice_id(item_key)}: {item_value}", 7 + ) else: - cprint(f"{nice_id(storage_key)}: {storage_value}", 5) + cprint( + f"{nice_id(storage_key)}: {storage_value}", 5 + ) else: cprint(f"{nice_id(key)}: {value}", 3) diff --git a/LnkParse3/text_processor.py b/LnkParse3/text_processor.py index d252b32a..7df7f506 100644 --- a/LnkParse3/text_processor.py +++ b/LnkParse3/text_processor.py @@ -5,6 +5,7 @@ the terminating null character are undefined and can have any value. The undefined bytes MUST NOT be used. """ + import warnings diff --git a/tests/json/unknown_target.json b/tests/json/unknown_target.json index 12cdfcd6..ac3fca7b 100644 --- a/tests/json/unknown_target.json +++ b/tests/json/unknown_target.json @@ -2,7 +2,7 @@ "data": {}, "extra": { "TERMINAL_BLOCK": { - "sha256": "d64c62e65398d37cd27e11fd729fa102016a05ba67f5020e17dfbd3b857dd96e", + "appended_data_sha256": "d64c62e65398d37cd27e11fd729fa102016a05ba67f5020e17dfbd3b857dd96e", "size": 67653 } }, diff --git a/tests/json/unknown_target.txt b/tests/json/unknown_target.txt index 6ff6dbad..4393188f 100644 --- a/tests/json/unknown_target.txt +++ b/tests/json/unknown_target.txt @@ -30,4 +30,4 @@ Windows Shortcut Information: EXTRA BLOCKS: TERMINAL_BLOCK Size: 67653 - SHA256: d64c62e65398d37cd27e11fd729fa102016a05ba67f5020e17dfbd3b857dd96e + Appended data sha256: d64c62e65398d37cd27e11fd729fa102016a05ba67f5020e17dfbd3b857dd96e