-
Notifications
You must be signed in to change notification settings - Fork 0
/
rr.py
executable file
·43 lines (33 loc) · 1.04 KB
/
rr.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
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import sys, random
# random.seed(0x1010) #设置随机种子数
#设置种子选择空间
s = (
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"йцукенгшщзхфывапролджэячсмитьбю"
"ЙЦУКЕНГШЩЗХФЫВАПРОЛДЖЭЯЧСМИТЬБЮ"
"1234567890"
"!@#$%^&*"
)
ls = [] #存取密码的列表
FirstPsw = "" #存取第一个密码的字符
length = 15 #默认密码长度
try:
length = int(sys.argv[1]) #从命令行自定义密码长度
print(f'\033[1;32m设置密码长度为:{length}\033[0m')
except ValueError:
print(f'\033[1;31m输入值非int, 使用默认值:{length}\033[0m')
except IndexError:
print(f'\033[1;33m未定义长度, 使用默认值:{length}\033[0m')
while len(ls)<10: #十个随机密码
pwd = ""
for i in range(length):
pwd += s[random.randint(0,len(s)-1)]
if pwd[0] in FirstPsw:
continue
else:
ls.append(pwd)
FirstPsw +=pwd[0]
print("\n".join(ls))