Python version 2
This commit is contained in:
20
testPass.py
20
testPass.py
@@ -1,26 +1,40 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
tempsN_1 = time.time();
|
||||||
|
globalTime = time.time()
|
||||||
|
nMot = 0
|
||||||
def main():
|
def main():
|
||||||
|
#passwordCrypte = "MatDuv1945"
|
||||||
passwordCrypte = "azerty"
|
passwordCrypte = "azerty"
|
||||||
tabPass =list("a")
|
tabPass =list("a")
|
||||||
print("test",2*2)
|
print("test",2*2)
|
||||||
found, passTrouve = testPass(True,0,tabPass,passwordCrypte)
|
found, passTrouve = testPass(True,0,tabPass,passwordCrypte)
|
||||||
if found == True :
|
if found == True :
|
||||||
print("Trouvé ! : " + passTrouve)
|
print("Trouvé ! : " + passTrouve +" en " + str(time.time() - globalTime) + " secondes")
|
||||||
|
|
||||||
|
#tabChar = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
||||||
tabChar = list("abcdefghijklmnopqrstuvwxyz")
|
tabChar = list("abcdefghijklmnopqrstuvwxyz")
|
||||||
|
|
||||||
|
|
||||||
def testPass(isFirst, pos, tabPass, password ):
|
def testPass(isFirst, pos, tabPass, password ):
|
||||||
found = False
|
found = False
|
||||||
passTrouve = ""
|
passTrouve = ""
|
||||||
|
global nMot
|
||||||
|
global tempsN_1
|
||||||
|
|
||||||
for char in tabChar:
|
for char in tabChar:
|
||||||
tabPass[pos] = char
|
tabPass[pos] = char
|
||||||
|
nMot = nMot +1;
|
||||||
|
if (time.time() - tempsN_1) > 5 :
|
||||||
|
print("\t\t\t" + str(nMot/(time.time() - tempsN_1)) + "Mots/s \tMot actuel : " + "".join(tabPass));
|
||||||
|
nMot = 0;
|
||||||
|
tempsN_1 = time.time()
|
||||||
if "".join(tabPass) == password:
|
if "".join(tabPass) == password:
|
||||||
found=True
|
found=True
|
||||||
passTrouve = "".join(tabPass)
|
passTrouve = "".join(tabPass)
|
||||||
return found, passTrouve
|
return found, passTrouve
|
||||||
else:
|
#else:
|
||||||
print("".join(tabPass) + "\t | " + str(len(tabPass)))
|
#print("".join(tabPass) + "\t | " + str(len(tabPass)))
|
||||||
|
|
||||||
|
|
||||||
if isFirst == True and found == False:
|
if isFirst == True and found == False:
|
||||||
|
|||||||
Reference in New Issue
Block a user