Python版的迷你程序——随机密码生成器

在线wifi跑包 金刚包跑包 cap跑包 hccapx ewsa在线 就来 握手包跑包

各位好 又见面了 我是曹操 今天给大家带来一篇新的教程

希望各位细心学习 低调用网

import random
import string
length              = random.randint(8,13)
password         = string.ascii_letters + string.digits + string.punctuation
gen_password = "".join(random.sample(password, length))
print(password)
print(length)
print(gen_password)

最近我开始涉足破译领域,主要是学习加密和解密算法以及相关流程。在破解密码时,密码字典是一个非常关键的步骤。下面是一个关于密码生成器的Python代码示例。我们将使用Python的string和random库函数来实现:

import random
import math
alpha   = "abcdefghijklmnopqrstuvwxyz"
num     = "0123456789"
special = ".@#$%&*"
#pass_len = int(input("Enter Password Length: "))
pass_len=random.randint(8,13)
# length of password  5:3:2
alpha_len   = pass_len//2
num_len     = math.ceil(pass_len*30/100)
special_len = pass_len-(alpha_len+num_len)
password = []
def generate_pass(length, array, is_alpha=False):
    for i in range(length):
        index = random.randint(0, len(array) - 1)
        character = array[index]
        if is_alpha:
            case = random.randint(0, 1)
            if case == 1:
                character = character.upper()
        password.append(character)
generate_pass(alpha_len, alpha, True)
generate_pass(num_len, num)
generate_pass(special_len, special)
random.shuffle(password)
# convert List To string
gen_password = ""
for i in password:
    gen_password = gen_password + str(i)
print(pass_len)
print(password)
print(gen_password)

密码字典生成器

赞(0)