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_md5.py | |
| parent | ba41fa46e69dbb264dfbed1b9fca5daab44a07c7 (diff) | |
| download | python-ec8893a097a6c0fffebd7db9e4a5568a3bf4df47.tar.gz python-ec8893a097a6c0fffebd7db9e4a5568a3bf4df47.zip | |
organisation
Diffstat (limited to 'crypto/crack_md5.py')
| -rw-r--r-- | crypto/crack_md5.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/crack_md5.py b/crypto/crack_md5.py new file mode 100644 index 0000000..00bac2b --- /dev/null +++ b/crypto/crack_md5.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +"""crack_md5 module""" +import sys +import hashlib + +def crack_md5(hash, wordlist): + """ + Args: + hash : le hash à trouver + wordlist: le dictionnaire + """ + with open(wordlist, "r") as fichier: + lignes = fichier.readlines() + for ligne in lignes: + if hashlib.md5(ligne.strip().encode()).hexdigest() == hash.strip(): + print(f"trouvé: {ligne.strip()}") + break + +if __name__ == "__main__": + try: + crack_md5(sys.argv[1], sys.argv[2]) + except IndexError: + print(f"{sys.argv[0]} demande des arguments. Voir l'aide.") + |
