Code source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
#! /usr/bin/python# -*- coding: cp1252 -*- import randomimport stringimport pyperclipimport datetime today = datetime.date.today() print 'petit script pour un mdp \n\n\n' appli = raw_input ('entre le nom du programme pour lequel tu souhaites générer un mot de pase\n\n')nom = raw_input ('entre le nom pour lequel tu es loggue\n\n')choix = raw_input ('''choisis un niveau de complexite du mdp: 1- 6 lettres + 2 chiffres2- 6 lettes en majuscules et minuscules + 2 chiffres3- 8 lettres et chiffres, majuscules et minuscules4- 12 lettres, chiffres et caracteres speciaux avec minuscules et majuscules''') if choix == '1' : li1 = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0') mdp = random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+str(random.randint(0,9))+str(random.randint(0,9)) pyperclip.setcb(mdp) spam = pyperclip.getcb() fichier = open('E:\MDP\\' +str(appli)+ ' ' + str(today)+".txt", "w") fichier.write(mdp) fichier.close() if choix == '2' : li2 = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') mdp = random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+str(random.randint(0,9))+str(random.randint(0,9)) pyperclip.setcb(mdp) spam = pyperclip.getcb() fichier = open('E:\MDP\\' +str(appli)+ ' ' + str(today)+".txt", "w") fichier.write(mdp) fichier.close() if choix == '3': li3 = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0') print 'choix3' mdp = random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3) pyperclip.setcb(mdp) spam = pyperclip.getcb() fichier = open('E:\MDP\\' +str(appli)+ ' ' + str(today)+".txt", "w") fichier.write(mdp) fichier.close() if choix == '4' : liste =('%','$','£','¨','^','*','µ','§','!','ù','/', 'ç','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0') mdp = random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+str(random.randint(0,9))+str(random.randint(0,9)) pyperclip.setcb(mdp) spam = pyperclip.getcb() fichier = open('E:\MDP\\' +str(appli)+ ' ' + str(today)+".txt", "w") fichier.write(nom + ' sur ' + appli + ' \n' + mdp) fichier.close() print ("""le mot de passe pour %s au nom de %s a été généré et copié dans le presse papier.\n Il est enregistré dans D:\Mes Documents\MDP \n Copie le mdp où tu souhaites en faisant un coller.""") %(appli,nom) raw_input('presse une touche pour continuer') |
Ce message a été modifié 1 fois, dernière modification par "PurePowerPlant" (27.01.2014, 13:28)
Ce message a été modifié 2 fois, dernière modification par "PurePowerPlant" (27.01.2014, 17:59)
Code source |
|
1 2 |
#! /usr/bin/python # -*- coding: utf-8 -*- |
Code source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
chiffres = [i for i in range(10)] # Création de la liste de 0 à 9 minuscules = [] majuscules = [] for i in range(26): # range va de 0 à 25 minuscules.append(chr(97+i)) # la fonction chr prend un nombre et ressort sa correspondance en ascii. chr(97) = a majuscules.append(chr(65+i)) # chr(65) = A if choix == '1' : liste = minuscules+chiffres nbCharListe = 6 nbChiffres = 2 if choix == '2' : liste = minuscules+majuscules nbCharListe = 6 nbChiffres = 2 if choix == '3' : liste = minuscules+majuscules+chiffres nbCharListe = 8 nbChiffres = 0 (...) # boucle for pour créer le mot de passe avec liste, nbCharListe et nbChiffres fichier = open('E:\MDP\\' +str(appli)+ ' ' + str(today)+".txt", "w") fichier.write(mdp) fichier.close() (...) # fin du code |
Ce message a été modifié 1 fois, dernière modification par "MégaBoulet" (28.01.2014, 12:05)
Ce message a été modifié 1 fois, dernière modification par "PurePowerPlant" (08.02.2014, 04:25)
Code source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
#! /usr/bin/python # -*- coding: utf-8 -*- import random import string import pyperclip import datetime today = datetime.date.today() print u'''Petit script pour un mdp. ......................................... Vérifier que la clé USB est bien G... ...............\n\n''' appli = raw_input (u'Entre le nom du programme pour lequel tu souhaites générer un mot de passe\n\n') nom = raw_input (u'Entre le nom pour lequel tu es loggué\n\n') choix = raw_input (u'''Choisis un niveau de complexite du mdp : 1- 6 lettres + 2 chiffres 2- 6 lettes en majuscules et minuscules + 2 chiffres 3- 8 lettres et chiffres, majuscules et minuscules 4- 12 lettres, chiffres et caract7res spéciaux avec minuscules et majuscules\n\n''') def gen() : if choix == '1' : li1 = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') mdp = random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+str(random.randint(0,9))+str(random.randint(0,9)) if choix == '2' : li2 = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') mdp = random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+str(random.randint(0,9))+str(random.randint(0,9)) if choix == '3': li3 = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0') mdp = random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3) if choix == '4' : liste =('%','$','£','¨','^','*','µ','§','!','ù','/', 'ç','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0') mdp = random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste) else : print u'entre un chiffre parmis les choix proposés' gen() pyperclip.setcb(mdp) spam = pyperclip.getcb() fichier = open('G:\MDP\\' +str(appli)+ ' ' + str(today)+".txt", "w") fichier.write(mdp) fichier.close() gen() print (u"""Le mot de passe pour %s au nom de %s a été généré et copié dans le presse papier.\n Il est enregistré dans G:\\MDP \n Copie le mdp où tu le souhaites en faisant un coller.""") %(appli,nom) raw_input('presse une touche pour quitter') |
Code source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#! /usr/bin/python # -*- coding: utf-8 -*- from __future__ import unicode_literals import random import string import pyperclip print 'petit script pour un mdp généré sans stockage en doc texte.\n\n\n' choix = raw_input ('''choisis un niveau de complexite du mdp: 1- 6 lettres + 2 chiffres 2- 6 lettes en majuscules et minuscules + 2 chiffres 3- 8 lettres et chiffres, majuscules et minuscules 4- 12 lettres, chiffres et caracteres speciaux avec minuscules et majuscules\n\n''') if choix == '1' : li1 = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0') mdp = random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+random.choice(li1)+str(random.randint(0,9))+str(random.randint(0,9)) if choix == '2' : li2 = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') mdp = random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+random.choice(li2)+str(random.randint(0,9))+str(random.randint(0,9)) if choix == '3': li3 = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0') mdp = random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3)+random.choice(li3) if choix == '4' : liste =('%','$','£','¨','^','*','µ','§','!','ù','/', 'ç','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0') mdp = random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+random.choice(liste)+str(random.randint(0,9))+str(random.randint(0,9)) pyperclip.setcb(mdp) spam = pyperclip.getcb() print ("""le mot de passe a été généré et copié dans le presse papier.\n Copie le mdp où tu le souhaites en faisant un coller.""") raw_input('presse une touche pour continuer') |