summaryrefslogtreecommitdiff
path: root/crack_hash.py
blob: a8ade9073e7b098102e9d8442c3876ed48e6501a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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])