summaryrefslogtreecommitdiff
path: root/crack_hash.py
diff options
context:
space:
mode:
authorjerome <jerome@xlinfo.fr>2023-12-18 00:02:09 +0100
committerjerome <jerome@xlinfo.fr>2023-12-18 00:02:09 +0100
commita1203ccb343703ba5ae522254f75b6384a1831a7 (patch)
treec54e1e6cf0da29170419b2fd9880ff6dcea28742 /crack_hash.py
downloadpython-a1203ccb343703ba5ae522254f75b6384a1831a7.tar.gz
python-a1203ccb343703ba5ae522254f75b6384a1831a7.zip
depôt initial
Diffstat (limited to 'crack_hash.py')
-rw-r--r--crack_hash.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/crack_hash.py b/crack_hash.py
new file mode 100644
index 0000000..a8ade90
--- /dev/null
+++ b/crack_hash.py
@@ -0,0 +1,20 @@
+import sys
+import hashlib
+
+def crack_hash(hash,wordlist,hashsum) :
+ """
+ Args:
+ hash : le hash à craquer
+ wordlist : la wordlist à utiliser
+ hashsum : md5 ou sha256 ou sha512...
+ """
+ with open(wordlist,"r") as fichier:
+ lignes = fichier.readlines()
+ for ligne in lignes:
+ #if hashlib.md5(ligne.strip().encode()).hexdigest() == hash:
+ if getattr(hashlib, hashsum)(ligne.strip().encode()).hexdigest() == hash :
+ print(f"trouvé : {ligne}")
+ exit()
+
+if __name__ == "__main__":
+ crack_hash(sys.argv[1],sys.argv[2],sys.argv[3])