-
Notifications
You must be signed in to change notification settings - Fork 0
/
RPWC.py
28 lines (21 loc) · 963 Bytes
/
RPWC.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
import argparse
#随机密码生成工具
parser = argparse.ArgumentParser()
parser.add_argument('-max',type=str,default=16,help='默认16')
parser.add_argument('-min',type=str,default=8,help='默认8')
args = parser.parse_args()
def generate_random_password(min_length, max_length):
import random
import string
if min_length > max_length:
raise ValueError("Min必须小于Max")
# Define the requirements of the password
symbols = "*#@!_$" #可加入符号
# Randomly choose a length between min_length and max_length
password_length = random.randint(min_length, max_length)
# Create a pool of characters to choose from
characters = string.ascii_letters + string.digits + symbols
# Generate a random password
random_password = ''.join(random.choice(characters) for i in range(password_length))
return random_password
print(generate_random_password(args.min, args.max))