Bonjour,
a tous les programmeurs du web , j'aimerai lui intégré la fonction timer
en gros le script python généré des clefs , et pendant qu'il génère j'aimerais que le programme calcule le nombre de temps pour les générés .
voici mon script:
**************
#!/usr/bin/env python
__version__ = "2012"
import hashlib, string,sys
from os import system
from random import randrange
def valide(var):
for interdit in [ "0","8","B" ]:
if interdit in var:
return False
for current_char in ["3","6","7","6"]:
if 3*current_char in var:
return False
return True
def livebox(nbr_line, t_output):
nbr_line = nbr_line / 5
fichier_texte = open('wpa_lb.txt', 'a+')
while nbr_line > 0:
a = randrange(9000000)
b = randrange(9000000)
c = randrange(9000000)
result1 = a + b + c
result2 = (a + b) * c
result3 = (b * c) + a
result4 = (b + c) * a
result5 = (a * b) + c
hash1 = hashlib.md5(str(result1)).hexdigest()
hash2 = hashlib.md5(str(result2)).hexdigest()
hash3 = hashlib.md5(str(result3)).hexdigest()
hash4 = hashlib.md5(str(result4)).hexdigest()
hash5 = hashlib.md5(str(result5)).hexdigest()
clef1 = hash1[:26].upper()
clef2 = hash2[:26].upper()
clef3 = hash3[:26].upper()
clef4 = hash4[:26].upper()
clef5 = hash5[:26].upper()
for curclef in [ clef1 , clef2 , clef3 , clef4 , clef5 ]:
if valide(curclef):
if t_output == 0:
fichier_texte.write(curclef + '\n')
else:
print curclef
nbr_line = nbr_line - 0.2
fichier_texte.close()
def splash():
system("clear")
print "//////////////////////////////////////////////////////////////"
print " Keys generate "
print "//////////////////////////////////////////////////////////////"
print
def splash_err():
print "[!] Erreur, s'il vous plaît préciser le nombre de clés dans votre liste de mots "
print ""
print "[Exemple] pyhton generateur-key.py 10000 | fichier de sortie"
print "[Exemple] python generateur-key.py 10000 stdout | sur la sortie standard"
if len(sys.argv) > 2:
if sys.argv[2] == "stdout":
livebox(int(sys.argv[1]), 1)
else:
splash_err()
elif len(sys.argv) == 2:
splash()
livebox(int(sys.argv[1]), 0)
print "[>] Your output file is : wpa_lb.txt"
else:
splash()
splash_err()
Si vous pouviez m'aider ça serait sympa merci !