diff options
| author | jerome <jerome@xlinfo.fr> | 2025-10-12 17:41:43 +0200 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-10-12 17:41:43 +0200 |
| commit | ec8893a097a6c0fffebd7db9e4a5568a3bf4df47 (patch) | |
| tree | ffebe60c3aa98df05d14aec8cea937430272c1ec /crypto/crack_hash.py | |
| parent | ba41fa46e69dbb264dfbed1b9fca5daab44a07c7 (diff) | |
| download | python-ec8893a097a6c0fffebd7db9e4a5568a3bf4df47.tar.gz python-ec8893a097a6c0fffebd7db9e4a5568a3bf4df47.zip | |
organisation
Diffstat (limited to 'crypto/crack_hash.py')
| -rw-r--r-- | crypto/crack_hash.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/crypto/crack_hash.py b/crypto/crack_hash.py new file mode 100644 index 0000000..b51cec7 --- /dev/null +++ b/crypto/crack_hash.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +"""crack_hash module""" +import sys +import hashlib +import argparse + + + +def crack_hash(hashlist, wordlist, hashsum): + """ + Args: + hashlist la liste de hashes à trouver + wordlist: le dictionnaire + hashsum: la somme de controle : md5,sha256 ou sha512 + """ + with open(hashlist,"r") as fichier1: + hashes=fichier1.readlines() + for hash in hashes: + with open(wordlist, "r") as fichier2: + lignes = fichier2.readlines() + for ligne in lignes: + if getattr(hashlib,hashsum)(ligne.strip().encode()).hexdigest() == hash.strip(): + print(f"trouvé: {ligne.strip()}") + break + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('hashlist', help='La liste de hash à trouver') + parser.add_argument('wordlist', help='Le dictionnaire choisi') + parser.add_argument('hashsum', help='la somme de contrôle : md5,sha256 ou sha512') + parser.parse_args() + crack_hash(sys.argv[1], sys.argv[2], sys.argv[3]) + |
