-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
175 lines (97 loc) · 4.6 KB
/
main.py
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import os
import time
from random import shuffle
print("""
Hello there, welcome to first Alireza0K python console app. \n
this is strong password generator, this console app can make best password for you.\n
in the below i describe how you can use this app but let me to
say thank you for useing this app. \n
\t1. if you wana to make a normal password, first enter the 'N' and second
enter the limit you want. ^Attention! normal password created just with alphabets and numbers.^\n
\t2. if you wana to make a Strong password, first enter the 'S' and second
enter the limit you want. ^Attention! strong password created with alphabets, symbols and numbers.^\n
\t3. if you wana to make a password list, first enter the 'L' and second enter
limit you want,before choose the elements enter limit of length of passwords,
enter elements you want for passwords [upper Case Alphabet,
lower Case Alphabet, numbers, symbols] and after you finished write 'ex'.
""")
upperCaseAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" # list of Elements
lowerCaseAlphabet = "abcdefghijklmnopqrstuvwxyz"
numbers = "1234567890"
symbols = "?><}{:!@#$%^&*()_+=-|\\/"
userChose = str(input("Enter wich type of password you want: ")) # user choose the wich kind of password want
passwordLimit = int(input("Enter the limit: ")) # password limit 'user given'
# shuffled creator
def ShuffleJoiner(thingList):
thingList = list(thingList)
shuffle(thingList)
thing = "".join(thingList)
return thing
# limiter make a priod of a string
def Limiter(limit, stringOfThings):
result = stringOfThings[0:limit]
return result
# normal password creator
def NormalPassword(limit, elements):
rowPassword = ""
for element in elements:
rowPassword += element
if "1" in element:
rowPassword += element
rowPassword = ShuffleJoiner(rowPassword)
lastResult = Limiter(limit, rowPassword)
return lastResult
# normal password creator
def StrongPassword(limit, elements):
rowPassword = ""
for element in elements:
rowPassword += element
if "1" in element:
rowPassword += element
rowPassword = ShuffleJoiner(rowPassword)
lastResult = Limiter(limit, rowPassword)
return lastResult
# password list creator
def PasswordList(limit, length, elements):
rowPassword = ""
for element in elements:
rowPassword += element
if "1" in element:
rowPassword += element
listOfPassword = []
for i in range(0, limit):
rowPassword = ShuffleJoiner(rowPassword)
result = Limiter(length, rowPassword)
listOfPassword.append(result)
return listOfPassword
# conditions for recognise to create which type password
if userChose == "N":
print("you're password is:",NormalPassword(passwordLimit, [upperCaseAlphabet,numbers]))
elif userChose == "S":
print("you're password is:",NormalPassword(passwordLimit, [upperCaseAlphabet,numbers,symbols,lowerCaseAlphabet]))
elif userChose == "L":
passwordCase = []
passwordLength = int(input("Enter your passwords length: "))
while True:
userElements = str(input("choose your Elements: "))
if userElements == "ex":
break
elif userElements == "upper Case Alphabet":
passwordCase.extend(upperCaseAlphabet)
elif userElements == "lower Case Alphabet":
passwordCase.extend(lowerCaseAlphabet)
elif userElements == "numbers":
passwordCase.extend(numbers)
elif userElements == "symbols":
passwordCase.extend(symbols)
createdListOfPassword = PasswordList(passwordLimit, passwordLength, passwordCase)
nameOfPasswordList = "password-list-number-" + str(int(time.time())) + ".txt"
file = open(nameOfPasswordList,"w")
for password in createdListOfPassword:
file.write(password)
file.write("\n")
file.close
someOfPasswords = createdListOfPassword[0:int(len(createdListOfPassword)/4)]
print("Those are some of your password see more in password list file -->", nameOfPasswordList)
for password in someOfPasswords:
print(password)