From 71adf711cbfb2a92eba4fa571ded4e411aba578d Mon Sep 17 00:00:00 2001 From: Jay Bingham Date: Sun, 16 May 2021 15:18:05 +0100 Subject: [PATCH 1/5] Added popular function to API --- name_that_hash/check_hashes.py | 6 +- name_that_hash/hash_info.py | 2 +- name_that_hash/hashes.py | 241 ++++++++++++++++++++------------- name_that_hash/prettifier.py | 36 +++-- name_that_hash/runner.py | 9 +- tests/test_click.py | 1 - tests/test_main.py | 66 +++++++-- 7 files changed, 231 insertions(+), 130 deletions(-) diff --git a/name_that_hash/check_hashes.py b/name_that_hash/check_hashes.py index 8cd3a44..69c085c 100644 --- a/name_that_hash/check_hashes.py +++ b/name_that_hash/check_hashes.py @@ -33,6 +33,6 @@ def single_hash(self, chash: str): chash = base64.b64decode(chash).decode("utf-8") except: logging.debug("Failed to base64 decode") - self.output.append(HashTypeObj.HashType(chash, self.nth, self.hashinfo_obj, self.kwargs)) - - + self.output.append( + HashTypeObj.HashType(chash, self.nth, self.hashinfo_obj, self.kwargs) + ) diff --git a/name_that_hash/hash_info.py b/name_that_hash/hash_info.py index 4df1c31..882058d 100644 --- a/name_that_hash/hash_info.py +++ b/name_that_hash/hash_info.py @@ -16,6 +16,6 @@ def __init__(self): "CryptoCurrency(PrivateKey)", "SHA-338", "Domain Cached Credentials", - "Domain Cached Credentials 2" + "Domain Cached Credentials 2", ] ) diff --git a/name_that_hash/hashes.py b/name_that_hash/hashes.py index dfae972..7528e9a 100644 --- a/name_that_hash/hashes.py +++ b/name_that_hash/hashes.py @@ -599,7 +599,7 @@ class HashInfo: HashInfo( name="GOST CryptoPro S-Box", hashcat=None, john=None, extended=False ), - HashInfo(name="Blake2b-256", hashcat=None, john=None,extended=False), + HashInfo(name="Blake2b-256", hashcat=None, john=None, extended=False), HashInfo(name="SHA3-256", hashcat=17400, john=None, extended=False), HashInfo(name="Skein-256", hashcat=None, john="skein-256", extended=False), HashInfo(name="Skein-512(256)", hashcat=None, john=None, extended=False), @@ -1358,7 +1358,10 @@ class HashInfo: ), modes=[ HashInfo( - name="Microsoft Office 2010", hashcat=9500, john="office", extended=False + name="Microsoft Office 2010", + hashcat=9500, + john="office", + extended=False, ) ], ), @@ -1369,7 +1372,10 @@ class HashInfo: ), modes=[ HashInfo( - name="Microsoft Office 2013", hashcat=9600, john="office", extended=False + name="Microsoft Office 2013", + hashcat=9600, + john="office", + extended=False, ) ], ), @@ -1440,7 +1446,10 @@ class HashInfo: ], ), Prototype( - regex=re.compile(r"^\$oldoffice\$[34]\*[a-f0-9]{32}\*[a-f0-9]{32}\*[a-f0-9]{40}:[a-f0-9]{10}", re.IGNORECASE), + regex=re.compile( + r"^\$oldoffice\$[34]\*[a-f0-9]{32}\*[a-f0-9]{32}\*[a-f0-9]{40}:[a-f0-9]{10}", + re.IGNORECASE, + ), modes=[ HashInfo( name=u"MS Office ⇐ 2003 $3, SHA1 + RC4, collider #2", @@ -1570,195 +1579,235 @@ class HashInfo: ], ), Prototype( - regex=re.compile(r"^\$krb5asrep\$23\$[^:]+:[a-f0-9]{32,32}\$[a-f0-9]{64,40960}$", re.IGNORECASE), + regex=re.compile( + r"^\$krb5asrep\$23\$[^:]+:[a-f0-9]{32,32}\$[a-f0-9]{64,40960}$", + re.IGNORECASE, + ), modes=[ HashInfo( name="Kerberos 5 AS-REP etype 23", hashcat=18200, john="krb5pa-sha1", extended=False, - description="Used for Windows Active Directory" - ) + description="Used for Windows Active Directory", + ) ], ), Prototype( - regex=re.compile(r"^\$krb5tgs\$17\$[^$]{1,512}\$[^$]{1,512}\$[^$]{1,4}?\$?[a-f0-9]{1,32}\$[a-f0-9]{64,40960}$", re.IGNORECASE), + regex=re.compile( + r"^\$krb5tgs\$17\$[^$]{1,512}\$[^$]{1,512}\$[^$]{1,4}?\$?[a-f0-9]{1,32}\$[a-f0-9]{64,40960}$", + re.IGNORECASE, + ), modes=[ HashInfo( name="Kerberos 5 TGS-REP etype 17 (AES128-CTS-HMAC-SHA1-96)", hashcat=19600, john=None, extended=False, - description="Used for Windows Active Directory" - ) + description="Used for Windows Active Directory", + ) ], ), Prototype( - regex=re.compile(r"^\$krb5tgs\$18\$[^$]{1,512}\$[^$]{1,512}\$[^$]{1,4}?\$?[a-f0-9]{1,32}\$[a-f0-9]{64,40960}", re.IGNORECASE), + regex=re.compile( + r"^\$krb5tgs\$18\$[^$]{1,512}\$[^$]{1,512}\$[^$]{1,4}?\$?[a-f0-9]{1,32}\$[a-f0-9]{64,40960}", + re.IGNORECASE, + ), modes=[ HashInfo( name="Kerberos 5 TGS-REP etype 18 (AES256-CTS-HMAC-SHA1-96)", hashcat=19700, john=None, extended=False, - description="Used for Windows Active Directory" - ) + description="Used for Windows Active Directory", + ) ], ), Prototype( - regex=re.compile(r"^\$krb5pa\$17\$[^$]{1,512}\$[^$]{1,512}\$[a-f0-9]{104,112}$", re.IGNORECASE), + regex=re.compile( + r"^\$krb5pa\$17\$[^$]{1,512}\$[^$]{1,512}\$[a-f0-9]{104,112}$", + re.IGNORECASE, + ), modes=[ HashInfo( name="Kerberos 5, etype 17, Pre-Auth", hashcat=19800, john=None, extended=False, - description="Used for Windows Active Directory" - ) + description="Used for Windows Active Directory", + ) ], ), Prototype( - regex=re.compile(r"^\$krb5pa\$17\$[^$]{1,512}\$[^$]{1,512}\$[^$]{0,512}\$[a-f0-9]{104,112}$", re.IGNORECASE), + regex=re.compile( + r"^\$krb5pa\$17\$[^$]{1,512}\$[^$]{1,512}\$[^$]{0,512}\$[a-f0-9]{104,112}$", + re.IGNORECASE, + ), modes=[ HashInfo( name="Kerberos 5, etype 17, Pre-Auth (with salt)", hashcat=None, john="krb5pa-sha1", extended=False, - description="Used for Windows Active Directory" - ) + description="Used for Windows Active Directory", + ) ], ), Prototype( - regex=re.compile(r"^\$krb5pa\$18\$[^$]{1,512}\$[^$]{1,512}\$[^$]{0,512}\$[a-f0-9]{104,112}$", re.IGNORECASE), + regex=re.compile( + r"^\$krb5pa\$18\$[^$]{1,512}\$[^$]{1,512}\$[^$]{0,512}\$[a-f0-9]{104,112}$", + re.IGNORECASE, + ), modes=[ HashInfo( name="Kerberos 5, etype 18, Pre-Auth (with salt)", hashcat=None, john="krb5pa-sha1", extended=False, - description="Used for Windows Active Directory" - ) + description="Used for Windows Active Directory", + ) ], ), Prototype( - regex=re.compile(r"^\$krb5pa\$18\$[^$]{1,512}\$[^$]{1,512}\$[a-f0-9]{104,112}$", re.IGNORECASE), + regex=re.compile( + r"^\$krb5pa\$18\$[^$]{1,512}\$[^$]{1,512}\$[a-f0-9]{104,112}$", + re.IGNORECASE, + ), modes=[ HashInfo( name="Kerberos 5, etype 18, Pre-Auth", hashcat=19900, john=None, extended=False, - description="Used for Windows Active Directory" - ) + description="Used for Windows Active Directory", + ) ], ), Prototype( - regex=re.compile(r"\$bitcoin\$[0-9]{2,4}\$[a-fA-F0-9$]{250,350}", re.IGNORECASE), - modes=[ - HashInfo( - name="Bitcoin / Litecoin", - hashcat=11300, - john="bitcoin", - extended=False, - description="Use Bitcoin2John.py to extract the hash for cracking." + regex=re.compile( + r"\$bitcoin\$[0-9]{2,4}\$[a-fA-F0-9$]{250,350}", re.IGNORECASE + ), + modes=[ + HashInfo( + name="Bitcoin / Litecoin", + hashcat=11300, + john="bitcoin", + extended=False, + description="Use Bitcoin2John.py to extract the hash for cracking.", ) ], ), Prototype( - regex=re.compile(r"\$ethereum\$[a-z0-9*]{150,250}", re.IGNORECASE), - modes=[ - HashInfo( - name="Ethereum Wallet, PBKDF2-HMAC-SHA256", - hashcat=15600, - john="ethereum-opencl", - extended=False, - description="Use ethereum2john.py to crack." + regex=re.compile(r"\$ethereum\$[a-z0-9*]{150,250}", re.IGNORECASE), + modes=[ + HashInfo( + name="Ethereum Wallet, PBKDF2-HMAC-SHA256", + hashcat=15600, + john="ethereum-opencl", + extended=False, + description="Use ethereum2john.py to crack.", + ), + HashInfo( + name="Ethereum Pre-Sale Wallet, PBKDF2-HMAC-SHA256", + hashcat=16300, + john="ethereum-presale-opencl", + extended=False, + description="Use ethereum2john.py to crack.", ), - HashInfo( - name="Ethereum Pre-Sale Wallet, PBKDF2-HMAC-SHA256", - hashcat=16300, - john="ethereum-presale-opencl", - extended=False, - description="Use ethereum2john.py to crack." - ) ], ), Prototype( - regex=re.compile(r"\$monero\$(0)\*[a-f0-9]{32,3196}", re.IGNORECASE), - modes=[ - HashInfo( - name="Monero", - hashcat=None, - john="monero", - extended=False, - description="Use monero2john.py to crack." + regex=re.compile(r"\$monero\$(0)\*[a-f0-9]{32,3196}", re.IGNORECASE), + modes=[ + HashInfo( + name="Monero", + hashcat=None, + john="monero", + extended=False, + description="Use monero2john.py to crack.", ) ], ), Prototype( - regex=re.compile(r"^\$electrum\$[1-3]\*[a-f0-9]{32,32}\*[a-f0-9]{32,32}$", re.IGNORECASE), + regex=re.compile( + r"^\$electrum\$[1-3]\*[a-f0-9]{32,32}\*[a-f0-9]{32,32}$", re.IGNORECASE + ), modes=[ - HashInfo( - name="Electrum Wallet (Salt-Type 1-3)", - hashcat=16600, - john="electrum", - extended=False, + HashInfo( + name="Electrum Wallet (Salt-Type 1-3)", + hashcat=16600, + john="electrum", + extended=False, ) ], ), Prototype( - regex=re.compile(r"^\$electrum\$4\*[a-f0-9]{1,66}\*[a-f0-9]{128,32768}\*[a-f0-9]{64,64}$", re.IGNORECASE), + regex=re.compile( + r"^\$electrum\$4\*[a-f0-9]{1,66}\*[a-f0-9]{128,32768}\*[a-f0-9]{64,64}$", + re.IGNORECASE, + ), modes=[ - HashInfo( - name="Electrum Wallet (Salt-Type 4)", - hashcat=21700, - john="electrum", - extended=False, + HashInfo( + name="Electrum Wallet (Salt-Type 4)", + hashcat=21700, + john="electrum", + extended=False, ) ], ), Prototype( - regex=re.compile(r"^\$electrum\$5\*[a-f0-9]{66,66}\*[a-f0-9]{2048,2048}\*[a-f0-9]{64,64}$", re.IGNORECASE), + regex=re.compile( + r"^\$electrum\$5\*[a-f0-9]{66,66}\*[a-f0-9]{2048,2048}\*[a-f0-9]{64,64}$", + re.IGNORECASE, + ), modes=[ - HashInfo( - name="Electrum Wallet (Salt-Type 5)", - hashcat=21800, - john="electrum", - extended=False, + HashInfo( + name="Electrum Wallet (Salt-Type 5)", + hashcat=21800, + john="electrum", + extended=False, ) ], ), Prototype( - regex=re.compile(r"\$ab\$[0-9]{1}\*[0-9]{1}\*[0-9]{1,6}\*[a-f0-9]{128}\*[a-f0-9]{128}\*[a-f0-9]{32}\*[a-f0-9]{192}", re.IGNORECASE), + regex=re.compile( + r"\$ab\$[0-9]{1}\*[0-9]{1}\*[0-9]{1,6}\*[a-f0-9]{128}\*[a-f0-9]{128}\*[a-f0-9]{32}\*[a-f0-9]{192}", + re.IGNORECASE, + ), modes=[ - HashInfo( - name="Android Backup", - hashcat=18900, - john="androidbackup", - extended=False, + HashInfo( + name="Android Backup", + hashcat=18900, + john="androidbackup", + extended=False, ) ], ), Prototype( - regex=re.compile(r"\$zip2\$\*[0-9]{1}\*[0-9]{1}\*[0-9]{1}\*[a-f0-9]{16,32}\*[a-f0-9]{1,6}\*[a-f0-9]{1,6}\*[a-f0-9]{0,16384}\*[a-f0-9]{20}\*\$\/zip2\$", re.IGNORECASE), + regex=re.compile( + r"\$zip2\$\*[0-9]{1}\*[0-9]{1}\*[0-9]{1}\*[a-f0-9]{16,32}\*[a-f0-9]{1,6}\*[a-f0-9]{1,6}\*[a-f0-9]{0,16384}\*[a-f0-9]{20}\*\$\/zip2\$", + re.IGNORECASE, + ), modes=[ - HashInfo( - name="WinZip", - hashcat=13600, - john="ZIP", - extended=False, + HashInfo( + name="WinZip", + hashcat=13600, + john="ZIP", + extended=False, ) ], ), Prototype( - regex=re.compile(r"\$itunes_backup\$\*[0-9]{1,2}\*[a-f0-9]{80}\*[0-9]{1,6}\*[a-f0-9]{40}\*[0-9]{0,10}\*[a-f0-9]{0,40}", re.IGNORECASE), + regex=re.compile( + r"\$itunes_backup\$\*[0-9]{1,2}\*[a-f0-9]{80}\*[0-9]{1,6}\*[a-f0-9]{40}\*[0-9]{0,10}\*[a-f0-9]{0,40}", + re.IGNORECASE, + ), modes=[ - HashInfo( - name="iTunes backup >= 10.0 11", - hashcat=14800, - john="itunes-backup", - extended=False, + HashInfo( + name="iTunes backup >= 10.0 11", + hashcat=14800, + john="itunes-backup", + extended=False, ) ], ), @@ -1792,12 +1841,14 @@ class HashInfo: hashcat=9720, john="oldoffice", extended=False, - description="Use office2john.py to grab the hash." + description="Use office2john.py to grab the hash.", ), ], ), Prototype( - regex=re.compile(r"\$office\$2016\$[0-9]\$[0-9]{6}\$[^$]{24}\$[^$]{88}", re.IGNORECASE), + regex=re.compile( + r"\$office\$2016\$[0-9]\$[0-9]{6}\$[^$]{24}\$[^$]{88}", re.IGNORECASE + ), modes=[ HashInfo( name="MS Office 2016 - SheetProtection", @@ -1807,4 +1858,4 @@ class HashInfo: ), ], ), -] \ No newline at end of file +] diff --git a/name_that_hash/prettifier.py b/name_that_hash/prettifier.py index 3971aeb..e95c07f 100644 --- a/name_that_hash/prettifier.py +++ b/name_that_hash/prettifier.py @@ -2,6 +2,7 @@ from typing import NamedTuple, List from rich.console import Console import logging +from name_that_hash import HashTypeObj, hash_info # we need a global console to control highlighting / printing console = Console(highlighter=False) @@ -20,15 +21,17 @@ def __init__(self, kwargs, api=False): self.a11y = kwargs["accessible"] self.john = kwargs["no_john"] self.hashcat = kwargs["no_hashcat"] + self.args = kwargs + self.hashinfo_obj = hash_info.HashInformation() def greppable_output(self, objs: List): logging.debug("Greppable output") """ - takes the prototypes and turns it into json - returns the json + takes the prototypes and turns it into json + returns the json - Doesn't print it, it prints in main - """ + Doesn't print it, it prints in main + """ return json.dumps(self.turn_hash_objs_into_dict(objs), indent=2) def turn_hash_objs_into_dict(self, objs: List): @@ -37,21 +40,30 @@ def turn_hash_objs_into_dict(self, objs: List): for y in objs: outputs_as_dict.update(y.hash_obj) logging.debug(f"Output_as_dicts is now {outputs_as_dict}") + + if self.args["popular_only"]: + popular_only = {} + for hash in list(outputs_as_dict.keys()): + popular_only[hash] = [] + for hash_type in outputs_as_dict[hash]: + if hash_type["name"] in self.hashinfo_obj.popular: + popular_only[hash].append(hash_type) + return popular_only return outputs_as_dict def pretty_print(self, objs): logging.debug("In pretty printing") """ - prints it prettily in the format: - most popular hashes - 1. - 2. - 3. - 4. + prints it prettily in the format: + most popular hashes + 1. + 2. + 3. + 4. - then everything else on one line. - """ + then everything else on one line. + """ multi_print = True if len(objs) > 1 else False for i in objs: logging.debug(i) diff --git a/name_that_hash/runner.py b/name_that_hash/runner.py index 580a207..2295200 100644 --- a/name_that_hash/runner.py +++ b/name_that_hash/runner.py @@ -147,13 +147,16 @@ def main(**kwargs): def set_logging(kwargs): if kwargs["verbose"]: - logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S') + logging.basicConfig( + level=logging.DEBUG, + format="%(asctime)s - %(message)s", + datefmt="%d-%b-%y %H:%M:%S", + ) else: logging.basicConfig(level=logging.CRITICAL) - -def api_return_hashes_as_json(chash: [str], args: dict = {}): +def api_return_hashes_as_json(chash: [str], args: dict = {"popular_only": False}): """ Using name-that-hash as an API? Call this function! diff --git a/tests/test_click.py b/tests/test_click.py index ed65fb6..5cd1500 100644 --- a/tests/test_click.py +++ b/tests/test_click.py @@ -68,4 +68,3 @@ def test_kerberos_works(): ], ) assert "Kerberos" in result.output - diff --git a/tests/test_main.py b/tests/test_main.py index 968504d..3847031 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -2,6 +2,7 @@ import click.testing import re + def test_it_works(): hashes = ["5d41402abc4b2a76b9719d911017c592"] @@ -64,6 +65,7 @@ def test_kerberos1(): x = runner.api_return_hashes_as_json(hashes) assert "Kerberos 5 AS-REQ Pre-Auth" in x + def test_kerberos2(): hashes = [ "$krb5tgs$23$*user$realm$test/spn*$63386d22d359fe42230300d56852c9eb$891ad31d09ab89c6b3b8c5e5de6c06a7f49fd559d7a9a3c32576c8fedf705376cea582ab5938f7fc8bc741acf05c5990741b36ef4311fe3562a41b70a4ec6ecba849905f2385bb3799d92499909658c7287c49160276bca0006c350b0db4fd387adc27c01e9e9ad0c20ed53a7e6356dee2452e35eca2a6a1d1432796fc5c19d068978df74d3d0baf35c77de12456bf1144b6a750d11f55805f5a16ece2975246e2d026dce997fba34ac8757312e9e4e6272de35e20d52fb668c5ed" @@ -72,6 +74,7 @@ def test_kerberos2(): x = runner.api_return_hashes_as_json(hashes) assert "Kerberos 5 TGS-REP etype 23" in x + def test_kerberos3(): hashes = [ "$krb5asrep$23$user@domain.com:3e156ada591263b8aab0965f5aebd837$007497cb51b6c8116d6407a782ea0e1c5402b17db7afa6b05a6d30ed164a9933c754d720e279c6c573679bd27128fe77e5fea1f72334c1193c8ff0b370fadc6368bf2d49bbfdba4c5dccab95e8c8ebfdc75f438a0797dbfb2f8a1a5f4c423f9bfc1fea483342a11bd56a216f4d5158ccc4b224b52894fadfba3957dfe4b6b8f5f9f9fe422811a314768673e0c924340b8ccb84775ce9defaa3baa0910b676ad0036d13032b0dd94e3b13903cc738a7b6d00b0b3c210d1f972a6c7cae9bd3c959acf7565be528fc179118f28c679f6deeee1456f0781eb8154e18e49cb27b64bf74cd7112a0ebae2102ac" @@ -80,6 +83,7 @@ def test_kerberos3(): x = runner.api_return_hashes_as_json(hashes) assert "Kerberos 5 AS-REP etype 23" in x + def test_kerberos4(): hashes = [ "$krb5tgs$17$user$realm$ae8434177efd09be5bc2eff8$90b4ce5b266821adc26c64f71958a475cf9348fce65096190be04f8430c4e0d554c86dd7ad29c275f9e8f15d2dab4565a3d6e21e449dc2f88e52ea0402c7170ba74f4af037c5d7f8db6d53018a564ab590fc23aa1134788bcc4a55f69ec13c0a083291a96b41bffb978f5a160b7edc828382d11aacd89b5a1bfa710b0e591b190bff9062eace4d26187777db358e70efd26df9c9312dbeef20b1ee0d823d4e71b8f1d00d91ea017459c27c32dc20e451ea6278be63cdd512ce656357c942b95438228e" @@ -88,6 +92,7 @@ def test_kerberos4(): x = runner.api_return_hashes_as_json(hashes) assert "Kerberos 5 TGS-REP etype 17 (AES128-CTS-HMAC-SHA1-96)" in x + def test_kerberos5(): hashes = [ "$krb5tgs$18$user$realm$8efd91bb01cc69dd07e46009$7352410d6aafd72c64972a66058b02aa1c28ac580ba41137d5a170467f06f17faf5dfb3f95ecf4fad74821fdc7e63a3195573f45f962f86942cb24255e544ad8d05178d560f683a3f59ce94e82c8e724a3af0160be549b472dd83e6b80733ad349973885e9082617294c6cbbea92349671883eaf068d7f5dcfc0405d97fda27435082b82b24f3be27f06c19354bf32066933312c770424eb6143674756243c1bde78ee3294792dcc49008a1b54f32ec5d5695f899946d42a67ce2fb1c227cb1d2004c0" @@ -96,14 +101,16 @@ def test_kerberos5(): x = runner.api_return_hashes_as_json(hashes) assert "Kerberos 5 TGS-REP etype 18 (AES256-CTS-HMAC-SHA1-96)" in x + def test_kerberos6(): hashes = [ - "$krb5pa$17$hashcat$HASHCATDOMAIN.COM$a17776abe5383236c58582f515843e029ecbff43706d177651b7b6cdb2713b17597ddb35b1c9c470c281589fd1d51cca125414d19e40e333" + "$krb5pa$17$hashcat$HASHCATDOMAIN.COM$a17776abe5383236c58582f515843e029ecbff43706d177651b7b6cdb2713b17597ddb35b1c9c470c281589fd1d51cca125414d19e40e333" ] x = runner.api_return_hashes_as_json(hashes) assert "Kerberos 5, etype 17, Pre-Auth" in x + def test_kerberos7(): hashes = [ "$krb5pa$17$user1$EXAMPLE.COM$$c5461873dc13665771b98ba80be53939e906d90ae1ba79cf2e21f0395e50ee56379fbef4d0298cfccfd6cf8f907329120048fd05e8ae5df4" @@ -112,6 +119,7 @@ def test_kerberos7(): x = runner.api_return_hashes_as_json(hashes) assert "Kerberos 5, etype 17, Pre-Auth (with salt)" in x + def test_kerberos8(): hashes = [ "$krb5pa$18$hashcat$HASHCATDOMAIN.COM$96c289009b05181bfd32062962740b1b1ce5f74eb12e0266cde74e81094661addab08c0c1a178882c91a0ed89ae4e0e68d2820b9cce69770" @@ -119,8 +127,8 @@ def test_kerberos8(): x = runner.api_return_hashes_as_json(hashes) assert "Kerberos 5, etype 18, Pre-Auth" in x - - + + def test_scrypt_python_dict(): # for issue #23 hashes = [ @@ -128,7 +136,11 @@ def test_scrypt_python_dict(): ] x = runner.api_return_hashes_as_dict(hashes) - assert "SCRYPT:1024:1:1:MDIwMzMwNTQwNDQyNQ==:5FW+zWivLxgCWj7qLiQbeC8zaNQ+qdO0NUinvqyFcfo=" in x + assert ( + "SCRYPT:1024:1:1:MDIwMzMwNTQwNDQyNQ==:5FW+zWivLxgCWj7qLiQbeC8zaNQ+qdO0NUinvqyFcfo=" + in x + ) + def test_etherum(): # for issue #23 @@ -139,6 +151,7 @@ def test_etherum(): x = runner.api_return_hashes_as_json(hashes) assert "Ethereum" in x + def test_bitcoin(): # for issue #23 hashes = [ @@ -148,6 +161,7 @@ def test_bitcoin(): x = runner.api_return_hashes_as_json(hashes) assert "Bitcoin / Litecoin" in x + def test_monero(): # for issue #23 hashes = [ @@ -159,46 +173,65 @@ def test_monero(): def test_electrum1(): - hashes = ["$electrum$1*44358283104603165383613672586868*c43a6632d9f59364f74c395a03d8c2ea"] + hashes = [ + "$electrum$1*44358283104603165383613672586868*c43a6632d9f59364f74c395a03d8c2ea" + ] x = runner.api_return_hashes_as_json(hashes) assert "Electrum Wallet (Salt-Type 1-3)" in x + def test_electrum2(): - hashes = ["$electrum$4*03eae309d8bda5dcbddaae8145469193152763894b7260a6c4ba181b3ac2ed5653*8c594086a64dc87a9c1f8a69f646e31e8d3182c3c722def4427aa20684776ac26092c6f60bf2762e27adfa93fe1e952dcb8d6362224b9a371953aa3a2edb596ce5eb4c0879c4353f2cc515ec6c9e7a6defa26c5df346d18a62e9d40fcc606bc8c34322bf2212f77770a683788db0baf4cb43595c2a27fe5ff8bdcb1fd915bcd725149d8ee8f14c71635fecb04da5dde97584f4581ceb7d907dceed80ae5daa8352dda20b25fd6001e99a96b7cf839a36cd3f5656304e6998c18e03dd2fb720cb41386c52910c9cb83272c3d50f3a6ff362ab8389b0c21c75133c971df0a75b331796371b060b32fe1673f4a041d7ae08bbdeffb45d706eaf65f99573c07972701c97766b4d7a8a03bba0f885eb3845dfd9152286e1de1f93e25ce04c54712509166dda80a84c2d34652f68e6c01e662f8b1cc7c15103a4502c29332a4fdbdda470c875809e15aab3f2fcb061ee96992ad7e8ab9da88203e35f47d6e88b07a13b0e70ef76de3be20dc06facbddc1e47206b16b44573f57396265116b4d243e77d1c98bc2b28aa3ec0f8d959764a54ecdd03d8360ff2823577fe2183e618aac15b30c1d20986841e3d83c0bfabcedb7c27ddc436eb7113db927e0beae7522b04566631a090b214660152a4f4a90e19356e66ee7309a0671b2e7bfde82667538d193fc7e397442052c6c611b6bf0a04f629a1dc7fa9eb44bfad1bfc6a0bce9f0564c3b483737e447720b7fd038c9a961a25e9594b76bf8c8071c83fcacd689c7469f698ee4aee4d4f626a73e21ce4967e705e4d83e1145b4260330367d8341c84723a1b02567ffbab26aac3afd1079887b4391f05d09780fc65f8b4f68cd51391c06593919d7eafd0775f83045b8f5c2e59cef902ff500654ea29b7623c7594ab2cc0e05ffe3f10abc46c9c5dac824673c307dcbff5bc5f3774141ff99f6a34ec4dd8a58d154a1c72636a2422b8fafdef399dec350d2b91947448582d52291f2261d264d29399ae3c92dc61769a49224af9e7c98d74190f93eb49a44db7587c1a2afb5e1a4bec5cdeb8ad2aac9728d5ae95600c52e9f063c11cdb32b7c1d8435ce76fcf1fa562bd38f14bf6c303c70fb373d951b8a691ab793f12c0f3336d6191378bccaed32923bba81868148f029e3d5712a2fb9f610997549710716db37f7400690c8dfbed12ff0a683d8e4d0079b380e2fd856eeafb8c6eedfac8fb54dacd6bd8a96e9f8d23ea87252c1a7c2b53efc6e6aa1f0cc30fbaaf68ee7d46666afc15856669cd9baebf9397ff9f322cce5285e68a985f3b6aadce5e8f14e9f9dd16764bc4e9f62168aa265d8634ab706ed40b0809023f141c36717bd6ccef9ec6aa6bfd2d00bda9375c2fee9ebba49590a166*1b0997cf64bb2c2ff88cb87bcacd9729d404bd46db18117c20d94e67c946fedc"] + hashes = [ + "$electrum$4*03eae309d8bda5dcbddaae8145469193152763894b7260a6c4ba181b3ac2ed5653*8c594086a64dc87a9c1f8a69f646e31e8d3182c3c722def4427aa20684776ac26092c6f60bf2762e27adfa93fe1e952dcb8d6362224b9a371953aa3a2edb596ce5eb4c0879c4353f2cc515ec6c9e7a6defa26c5df346d18a62e9d40fcc606bc8c34322bf2212f77770a683788db0baf4cb43595c2a27fe5ff8bdcb1fd915bcd725149d8ee8f14c71635fecb04da5dde97584f4581ceb7d907dceed80ae5daa8352dda20b25fd6001e99a96b7cf839a36cd3f5656304e6998c18e03dd2fb720cb41386c52910c9cb83272c3d50f3a6ff362ab8389b0c21c75133c971df0a75b331796371b060b32fe1673f4a041d7ae08bbdeffb45d706eaf65f99573c07972701c97766b4d7a8a03bba0f885eb3845dfd9152286e1de1f93e25ce04c54712509166dda80a84c2d34652f68e6c01e662f8b1cc7c15103a4502c29332a4fdbdda470c875809e15aab3f2fcb061ee96992ad7e8ab9da88203e35f47d6e88b07a13b0e70ef76de3be20dc06facbddc1e47206b16b44573f57396265116b4d243e77d1c98bc2b28aa3ec0f8d959764a54ecdd03d8360ff2823577fe2183e618aac15b30c1d20986841e3d83c0bfabcedb7c27ddc436eb7113db927e0beae7522b04566631a090b214660152a4f4a90e19356e66ee7309a0671b2e7bfde82667538d193fc7e397442052c6c611b6bf0a04f629a1dc7fa9eb44bfad1bfc6a0bce9f0564c3b483737e447720b7fd038c9a961a25e9594b76bf8c8071c83fcacd689c7469f698ee4aee4d4f626a73e21ce4967e705e4d83e1145b4260330367d8341c84723a1b02567ffbab26aac3afd1079887b4391f05d09780fc65f8b4f68cd51391c06593919d7eafd0775f83045b8f5c2e59cef902ff500654ea29b7623c7594ab2cc0e05ffe3f10abc46c9c5dac824673c307dcbff5bc5f3774141ff99f6a34ec4dd8a58d154a1c72636a2422b8fafdef399dec350d2b91947448582d52291f2261d264d29399ae3c92dc61769a49224af9e7c98d74190f93eb49a44db7587c1a2afb5e1a4bec5cdeb8ad2aac9728d5ae95600c52e9f063c11cdb32b7c1d8435ce76fcf1fa562bd38f14bf6c303c70fb373d951b8a691ab793f12c0f3336d6191378bccaed32923bba81868148f029e3d5712a2fb9f610997549710716db37f7400690c8dfbed12ff0a683d8e4d0079b380e2fd856eeafb8c6eedfac8fb54dacd6bd8a96e9f8d23ea87252c1a7c2b53efc6e6aa1f0cc30fbaaf68ee7d46666afc15856669cd9baebf9397ff9f322cce5285e68a985f3b6aadce5e8f14e9f9dd16764bc4e9f62168aa265d8634ab706ed40b0809023f141c36717bd6ccef9ec6aa6bfd2d00bda9375c2fee9ebba49590a166*1b0997cf64bb2c2ff88cb87bcacd9729d404bd46db18117c20d94e67c946fedc" + ] x = runner.api_return_hashes_as_json(hashes) assert "Electrum Wallet (Salt-Type 4)" in x + def test_electrum3(): - hashes = ["$electrum$5*02170fee7c35f1ef3b229edc90fbd0793b688a0d6f41137a97aab2343d315cce16*94cf72d8f5d774932b414a3344984859e43721268d2eb35fa531de5a2fc7024b463c730a54f4f46229dd9fede5034b19ac415c2916e9c16b02094f845795df0c397ff76d597886b1f9e014ad1a8f64a3f617d9900aa645b3ba86f16ce542251fc22c41d93fa6bc118be96d9582917e19d2a299743331804cfc7ce2c035367b4cbcfb70adfb1e10a0f2795769f2165d8fd13daa8b45eeac495b5b63e91a87f63b42e483f84a881e49adecacf6519cb564694b42dd9fe80fcbc6cdb63cf5ae33f35255266f5c2524dd93d3cc15eba0f2ccdc3c109cc2d7e8f711b8b440f168caf8b005e8bcdfe694148e94a04d2a738f09349a96600bd8e8edae793b26ebae231022f24e96cb158db141ac40400a9e9ef099e673cfe017281537c57f82fb45c62bdb64462235a6eefb594961d5eb2c46537958e4d04250804c6e9f343ab7a0db07af6b8a9d1a6c5cfcd311b8fb8383ac9ed9d98d427d526c2f517fc97473bd87cb59899bd0e8fb8c57fa0f7e0d53daa57c972cf92764af4b1725a5fb8f504b663ec519731929b3caaa793d8ee74293eee27d0e208a60e26290bc546e6fa9ed865076e13febfea249729218c1b5752e912055fbf993fbac5df2cca2b37c5e0f9c30789858ceeb3c482a8db123966775aeed2eee2fc34efb160d164929f51589bff748ca773f38978bff3508d5a7591fb2d2795df983504a788071f469d78c88fd7899cabbc5804f458653d0206b82771a59522e1fa794d7de1536c51a437f5d6df5efd6654678e5794ca429b5752e1103340ed80786f1e9da7f5b39af628b2212e4d88cd36b8a7136d50a6b6e275ab406ba7c57cc70d77d01c4c16e9363901164fa92dc9e9b99219d5376f24862e775968605001e71b000e2c7123b4b43f3ca40db17efd729388782e46e64d43ccb947db4eb1473ff1a3836b74fe312cd1a33b73b8b8d80c087088932277773c329f2f66a01d6b3fc1e651c56959ebbed7b14a21b977f3acdedf1a0d98d519a74b50c39b3052d840106da4145345d86ec0461cddafacc2a4f0dd646457ad05bf04dcbcc80516a5c5ed14d2d639a70e77b686f19cbfb63f546d81ae19cc8ba35cce3f3b5b9602df25b678e14411fecec87b8347f5047513df415c6b1a3d39871a6bcb0f67d9cf8311596deae45fd1d84a04fd58f1fd55c5156b7309af09094c99a53674809cb87a45f95a2d69f9997a38085519cb4e056f9efd56672a2c1fe927d5ea8eec25b8aff6e56f9a2310f1a481daf407b8adf16201da267c59973920fd21bb087b88123ef98709839d6a3ee34efb8ccd5c15ed0e46cff3172682769531164b66c8689c35a26299dd26d09233d1f64f9667474141cf9c6a6de7f2bc52c3bb44cfe679ff4b912c06df406283836b3581773cb76d375304f46239da5996594a8d03b14c02f1b35a432dc44a96331242ae31174*33a7ee59d6d17ed1ee99dc0a71771227e6f3734b17ba36eb589bdced56244135"] + hashes = [ + "$electrum$5*02170fee7c35f1ef3b229edc90fbd0793b688a0d6f41137a97aab2343d315cce16*94cf72d8f5d774932b414a3344984859e43721268d2eb35fa531de5a2fc7024b463c730a54f4f46229dd9fede5034b19ac415c2916e9c16b02094f845795df0c397ff76d597886b1f9e014ad1a8f64a3f617d9900aa645b3ba86f16ce542251fc22c41d93fa6bc118be96d9582917e19d2a299743331804cfc7ce2c035367b4cbcfb70adfb1e10a0f2795769f2165d8fd13daa8b45eeac495b5b63e91a87f63b42e483f84a881e49adecacf6519cb564694b42dd9fe80fcbc6cdb63cf5ae33f35255266f5c2524dd93d3cc15eba0f2ccdc3c109cc2d7e8f711b8b440f168caf8b005e8bcdfe694148e94a04d2a738f09349a96600bd8e8edae793b26ebae231022f24e96cb158db141ac40400a9e9ef099e673cfe017281537c57f82fb45c62bdb64462235a6eefb594961d5eb2c46537958e4d04250804c6e9f343ab7a0db07af6b8a9d1a6c5cfcd311b8fb8383ac9ed9d98d427d526c2f517fc97473bd87cb59899bd0e8fb8c57fa0f7e0d53daa57c972cf92764af4b1725a5fb8f504b663ec519731929b3caaa793d8ee74293eee27d0e208a60e26290bc546e6fa9ed865076e13febfea249729218c1b5752e912055fbf993fbac5df2cca2b37c5e0f9c30789858ceeb3c482a8db123966775aeed2eee2fc34efb160d164929f51589bff748ca773f38978bff3508d5a7591fb2d2795df983504a788071f469d78c88fd7899cabbc5804f458653d0206b82771a59522e1fa794d7de1536c51a437f5d6df5efd6654678e5794ca429b5752e1103340ed80786f1e9da7f5b39af628b2212e4d88cd36b8a7136d50a6b6e275ab406ba7c57cc70d77d01c4c16e9363901164fa92dc9e9b99219d5376f24862e775968605001e71b000e2c7123b4b43f3ca40db17efd729388782e46e64d43ccb947db4eb1473ff1a3836b74fe312cd1a33b73b8b8d80c087088932277773c329f2f66a01d6b3fc1e651c56959ebbed7b14a21b977f3acdedf1a0d98d519a74b50c39b3052d840106da4145345d86ec0461cddafacc2a4f0dd646457ad05bf04dcbcc80516a5c5ed14d2d639a70e77b686f19cbfb63f546d81ae19cc8ba35cce3f3b5b9602df25b678e14411fecec87b8347f5047513df415c6b1a3d39871a6bcb0f67d9cf8311596deae45fd1d84a04fd58f1fd55c5156b7309af09094c99a53674809cb87a45f95a2d69f9997a38085519cb4e056f9efd56672a2c1fe927d5ea8eec25b8aff6e56f9a2310f1a481daf407b8adf16201da267c59973920fd21bb087b88123ef98709839d6a3ee34efb8ccd5c15ed0e46cff3172682769531164b66c8689c35a26299dd26d09233d1f64f9667474141cf9c6a6de7f2bc52c3bb44cfe679ff4b912c06df406283836b3581773cb76d375304f46239da5996594a8d03b14c02f1b35a432dc44a96331242ae31174*33a7ee59d6d17ed1ee99dc0a71771227e6f3734b17ba36eb589bdced56244135" + ] x = runner.api_return_hashes_as_json(hashes) assert "Electrum Wallet (Salt-Type 5)" in x + def test_itunes(): - hashes = ["$itunes_backup$*10*8b715f516ff8e64442c478c2d9abb046fc6979ab079007d3dbcef3ddd84217f4c3db01362d88fa68*10000*2353363784073608264337337723324886300850*10000000*425b4bb4e200b5fd4c66979c9caca31716052063"] + hashes = [ + "$itunes_backup$*10*8b715f516ff8e64442c478c2d9abb046fc6979ab079007d3dbcef3ddd84217f4c3db01362d88fa68*10000*2353363784073608264337337723324886300850*10000000*425b4bb4e200b5fd4c66979c9caca31716052063" + ] x = runner.api_return_hashes_as_json(hashes) assert "iTunes backup >= 10.0 11" in x + def test_winzip(): - hashes = ["$zip2$*0*3*0*e3222d3b65b5a2785b192d31e39ff9de*1320*e*19648c3e063c82a9ad3ef08ed833*3135c79ecb86cd6f48fc*$/zip2$"] + hashes = [ + "$zip2$*0*3*0*e3222d3b65b5a2785b192d31e39ff9de*1320*e*19648c3e063c82a9ad3ef08ed833*3135c79ecb86cd6f48fc*$/zip2$" + ] x = runner.api_return_hashes_as_json(hashes) assert "WinZip" in x + def test_androidbackup(): - hashes = ["$ab$5*0*10000*b8900e4885ff9cad8f01ee1957a43bd633fea12491440514ae27aa83f2f5c006ec7e7fa0bce040add619919b4eb60608304b7d571a2ed87fd58c9ad6bc5fcf4c*7d254d93e16be9312fb1ccbfc6265c40cb0c5eab7b605a95a116e2383fb1cf12b688223f96221dcd2bf5410d4ca6f90e0789ee00157fa91658b42665d6b6844c*fc9f6be604d1c59ac32664ec2c5b9b30*00c4972149af3adcc235899e9d20611ea6e8de2212afcb9fcfefde7e35b691c2d0994eb47e4f9a260526ba47f4caea71af9c7fadcd5685d50126276f6acdd59966528b13ccc26036a0eaba2f2451aa64b05766d0edd03c988dcf87e2a9eec52d"] + hashes = [ + "$ab$5*0*10000*b8900e4885ff9cad8f01ee1957a43bd633fea12491440514ae27aa83f2f5c006ec7e7fa0bce040add619919b4eb60608304b7d571a2ed87fd58c9ad6bc5fcf4c*7d254d93e16be9312fb1ccbfc6265c40cb0c5eab7b605a95a116e2383fb1cf12b688223f96221dcd2bf5410d4ca6f90e0789ee00157fa91658b42665d6b6844c*fc9f6be604d1c59ac32664ec2c5b9b30*00c4972149af3adcc235899e9d20611ea6e8de2212afcb9fcfefde7e35b691c2d0994eb47e4f9a260526ba47f4caea71af9c7fadcd5685d50126276f6acdd59966528b13ccc26036a0eaba2f2451aa64b05766d0edd03c988dcf87e2a9eec52d" + ] x = runner.api_return_hashes_as_json(hashes) assert "Android Backup" in x + def test_blake2b256(): - hashes = ["87e402405c9c268532ba64e5130476237cfc1289e2e993d62c97f3b14febcbf0"] - - x = runner.api_return_hashes_as_json(hashes) - assert "Blake2b-256" in x + hashes = ["87e402405c9c268532ba64e5130476237cfc1289e2e993d62c97f3b14febcbf0"] + + x = runner.api_return_hashes_as_json(hashes) + assert "Blake2b-256" in x + def test_telegram(): hashes = [ @@ -217,6 +250,7 @@ def test_blake2(): x = runner.api_return_hashes_as_json(hashes) assert "BLAKE2b-512" in x + def test_office(): hashes = [ "$oldoffice$0*55045061647456688860411218030058*e7e24d163fbd743992d4b8892bf3f2f7*493410dbc832557d3fe1870ace8397e2:91b2e062b9" @@ -225,6 +259,7 @@ def test_office(): x = runner.api_return_hashes_as_json(hashes) assert re.findall(r"MS Office [^#]+ MD5 \+ RC4[^#]+ #2", x) + def test_office2(): hashes = [ "$oldoffice$3*83328705222323020515404251156288*2855956a165ff6511bc7f4cd77b9e101*941861655e73a09c40f7b1e9dfd0c256ed285acd:b8f63619ca" @@ -233,10 +268,11 @@ def test_office2(): x = runner.api_return_hashes_as_json(hashes) assert re.findall(r"MS Office [^#]+ SHA1 \+ RC4[^#]+ #2", x) + def test_office3(): hashes = [ "$office$2016$0$100000$876MLoKTq42+/DLp415iZQ==$TNDvpvYyvlSUy97UOLKNhXynhUDDA7H8kLql0ISH5SxcP6hbthdjaTo4Z3/MU0dcR2SAd+AduYb3TB5CLZ8+ow==" ] x = runner.api_return_hashes_as_json(hashes) - assert "MS Office 2016 - SheetProtection" in x \ No newline at end of file + assert "MS Office 2016 - SheetProtection" in x From 05a20b24658a10069a861435c422617f294a48f9 Mon Sep 17 00:00:00 2001 From: Jay Bingham Date: Sun, 16 May 2021 17:08:43 +0100 Subject: [PATCH 2/5] Updated tests, function --- name_that_hash/prettifier.py | 22 +++++++++++++++------- name_that_hash/runner.py | 2 +- tests/test_click.py | 1 - tests/test_main.py | 11 +++++++++++ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/name_that_hash/prettifier.py b/name_that_hash/prettifier.py index e95c07f..586b777 100644 --- a/name_that_hash/prettifier.py +++ b/name_that_hash/prettifier.py @@ -24,8 +24,13 @@ def __init__(self, kwargs, api=False): self.args = kwargs self.hashinfo_obj = hash_info.HashInformation() + if not "popular_only" in self.args: + self.args["popular_only"] = False + def greppable_output(self, objs: List): + logging.debug("Greppable output") + """ takes the prototypes and turns it into json returns the json @@ -42,15 +47,18 @@ def turn_hash_objs_into_dict(self, objs: List): logging.debug(f"Output_as_dicts is now {outputs_as_dict}") if self.args["popular_only"]: - popular_only = {} - for hash in list(outputs_as_dict.keys()): - popular_only[hash] = [] - for hash_type in outputs_as_dict[hash]: - if hash_type["name"] in self.hashinfo_obj.popular: - popular_only[hash].append(hash_type) - return popular_only + return self.get_popular_only(outputs_as_dict) return outputs_as_dict + def get_popular_only(self, outputs_as_dict): + popular_only = {} + for hash in list(outputs_as_dict.keys()): + popular_only[hash] = [] + for hash_type in outputs_as_dict[hash]: + if hash_type["name"] in self.hashinfo_obj.popular: + popular_only[hash].append(hash_type) + return popular_only + def pretty_print(self, objs): logging.debug("In pretty printing") """ diff --git a/name_that_hash/runner.py b/name_that_hash/runner.py index 2295200..c8a653c 100644 --- a/name_that_hash/runner.py +++ b/name_that_hash/runner.py @@ -167,7 +167,7 @@ def api_return_hashes_as_json(chash: [str], args: dict = {"popular_only": False} return pretty_printer.greppable_output(compute_hashes_for_api(chash, args)) -def api_return_hashes_as_dict(chash: [str], args: dict = {}): +def api_return_hashes_as_dict(chash: [str], args: dict = {"popular_only": False}): """ Returns the hashes as a Python dictionary """ diff --git a/tests/test_click.py b/tests/test_click.py index 5cd1500..389157e 100644 --- a/tests/test_click.py +++ b/tests/test_click.py @@ -14,7 +14,6 @@ def test_it_runs(): assert result.exit_code == 0 assert "SHA-512" in result.output - def test_greppable(): runner = CliRunner() result = runner.invoke( diff --git a/tests/test_main.py b/tests/test_main.py index 3847031..d5cd0f7 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -17,7 +17,18 @@ def test_it_identifies_correctly_correctly(): x = runner.api_return_hashes_as_json(hashes) assert "NTLM" in x +def test_for_popular(): + hashes = ["5f4dcc3b5aa765d61d8327deb882cf99"] + x = runner.api_return_hashes_as_json(hashes, {"popular_only": True}) + assert "ZipMonster" not in x + +def test_for_popular_2(): + hashes = ["5f4dcc3b5aa765d61d8327deb882cf99"] + + x = runner.api_return_hashes_as_json(hashes, {"popular_only": True}) + assert "MD5" in x + def test_main_succeeds(): runn = click.testing.CliRunner() result = runn.invoke(runner.main) From 1393af136b1478a7f5a21c98fe2dc249649ba832 Mon Sep 17 00:00:00 2001 From: Jayy001 <56607897+Jayy001@users.noreply.github.com> Date: Sun, 16 May 2021 17:49:56 +0100 Subject: [PATCH 3/5] Update prettifier.py Indent problem didn't go thrugh. --- name_that_hash/prettifier.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/name_that_hash/prettifier.py b/name_that_hash/prettifier.py index 586b777..e18fe18 100644 --- a/name_that_hash/prettifier.py +++ b/name_that_hash/prettifier.py @@ -32,11 +32,11 @@ def greppable_output(self, objs: List): logging.debug("Greppable output") """ - takes the prototypes and turns it into json - returns the json + takes the prototypes and turns it into json + returns the json - Doesn't print it, it prints in main - """ + Doesn't print it, it prints in main + """ return json.dumps(self.turn_hash_objs_into_dict(objs), indent=2) def turn_hash_objs_into_dict(self, objs: List): @@ -62,16 +62,16 @@ def get_popular_only(self, outputs_as_dict): def pretty_print(self, objs): logging.debug("In pretty printing") """ - prints it prettily in the format: - most popular hashes - 1. - 2. - 3. - 4. + prints it prettily in the format: + most popular hashes + 1. + 2. + 3. + 4. - then everything else on one line. - """ + then everything else on one line. + """ multi_print = True if len(objs) > 1 else False for i in objs: logging.debug(i) From 12d374741a6cf5e2a8e2c64eab3442f4461be638 Mon Sep 17 00:00:00 2001 From: bee-san Date: Fri, 21 May 2021 09:46:58 +0100 Subject: [PATCH 4/5] merging --- name_that_hash/hashes.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/name_that_hash/hashes.py b/name_that_hash/hashes.py index d2647ac..3587a21 100644 --- a/name_that_hash/hashes.py +++ b/name_that_hash/hashes.py @@ -1607,10 +1607,6 @@ class HashInfo: ], ), Prototype( - regex=re.compile( - r"^\$krb5asrep\$23\$[^:]+:[a-f0-9]{32,32}\$[a-f0-9]{64,40960}$", - re.IGNORECASE, - ), regex=re.compile(r"\$pdf\$5\*[5|6]\*[0-9]{3}\*[-0-9]{1,6}\*[0-9]\*[0-9]{1,4}\*[a-f0-9]{0,1024}\*[0-9]{1,4}\*[a-f0-9]{0,1024}\*[0-9]{1,4}\*[a-f0-9]{0,1024}\*[0-9]{1,4}\*[a-f0-9]{0,1024}\*[0-9]{1,4}\*[a-f0-9]{0,1024}", re.IGNORECASE), modes=[ HashInfo( From e93dcfc0d3d73bd5d7762f9514878271121a81fa Mon Sep 17 00:00:00 2001 From: bee-san Date: Fri, 21 May 2021 09:47:15 +0100 Subject: [PATCH 5/5] 1.9.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0d5e790..6ff6ad6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "name-that-hash" -version = "1.8.0" +version = "1.9.0" description = "The Modern Hash Identification System" authors = ["brandon "] license = "GPL-3.0-or-later"