-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword.py
More file actions
executable file
·62 lines (47 loc) · 1.42 KB
/
password.py
File metadata and controls
executable file
·62 lines (47 loc) · 1.42 KB
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
#!/usr/bin/python
import random
def application(environ, start_response):
status = '200 OK'
max_count = 15
count = environ['REQUEST_URI'].rpartition('/')[2]
if count.isdigit():
count = int(count)
else:
count = 1
random_passes = []
for index in range(min(count,max_count)):
random_passes.append(random_pass())
output = "\n".join(random_passes)
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
def random_pass():
adjectives = []
animals = []
skills = []
names = []
with open("./adjectives.txt","r") as words:
for line in words:
adjectives.append(line.rstrip())
words.close()
with open("./animals.txt","r") as words:
for line in words:
animals.append(line.rstrip())
words.close()
with open("./skills.txt","r") as words:
for line in words:
skills.append(line.rstrip())
words.close()
with open("./names.txt","r") as words:
for line in words:
names.append(line.rstrip())
words.close()
random.seed()
adjective = adjectives[random.randint(0,len(adjectives)-1)].title()
name = names[random.randint(0,len(names)-1)].title()
animal = animals[random.randint(0,len(animals)-1)].title()
skill = skills[random.randint(0,len(skills)-1)].title().replace(" ","")
return str(adjective+animal+skill+name+str(random.randint(10,99)))
if __name__ == "__main__":
print(random_pass())