请前往https://www.json.cn/run/python3/使用
安装脚本内提示根据你的需要修改
import random
import string
def generate_password_with_digit():
# 先确保至少有一个数字
digit = random.choice(string.digits)
# 剩余的11个字符从大小写字母和数字中随机选择
other_chars = random.choices(string.ascii_letters + string.digits, k=11)
# 将数字插入到随机索引位置
insert_index = random.randint(0, 11)
password_chars = other_chars[:insert_index] + [digit] + other_chars[insert_index:]
random.shuffle(password_chars) # 打乱顺序以确保随机性
# 将字符列表转换为字符串
password = ''.join(password_chars)
return password
def generate_string():
# 生成一个只包含小写字母的14位随机组合作为账号部分
random_account_part = ''.join(random.choices(string.ascii_lowercase, k=14))
# 生成包含至少一个数字的12位随机密码
random_password = generate_password_with_digit()
# 格式化字符串(example.com换成你自己的邮箱根域名,如lxgo.net)
formatted_string = f"and|{random_account_part}@example.com|{random_password}|1|GB"
return formatted_string
# 生成并打印500个字符串
for _ in range(500):
print(generate_string())
后记:
特殊api收件生成脚本(新)
使用方法同上
import random
import string
def generate_random_strings(count, length):
"""生成指定数量的随机字符串列表"""
return [''.join(random.choice(string.ascii_lowercase) for _ in range(length)) for _ in range(count)]
def format_strings(random_strings, format1, format2):
"""根据两种格式模板构造并打印字符串"""
formatted_strings1 = [format1.format(s) for s in random_strings]
formatted_strings2 = [format2.format(s, s) for s in random_strings] # 注意这里第二个格式需要两个相同的占位符,所以传入两次s
# 打印第一种格式
for fs1 in formatted_strings1:
print(fs1)
# 打印第二种格式的URL
for fs2 in formatted_strings2:
# 提取出邮箱账号名部分(即随机字符串)并构造URL
email_part = fs2.split('|')[1].split('@')[0] # 这里假设格式是固定的,且邮箱账号名在第二个'|'和'@'之间
url = f"https://Domain.example.com/api/sj.php?email={email_part}@example.com"
print(url)
# 定义两种格式模板
format1 = "and|{}@example.com|some_other_data|1|GB"
format2 = "another_format|{}@example.com|different_data" # 注意:这个格式模板是假设的,你可能需要根据你的实际需求调整
# 生成200个随机字符串(全小写字母)
random_strings = generate_random_strings(200, 12)
# 根据模板构造并打印字符串
format_strings(random_strings, format1, format2)
[...]目录宝塔邮局搭建-基础教程篇邮箱服务器搭建宝塔邮局搭建-网页客户端篇网页客户端docker版搭建教程宝塔邮局搭建-网页客户端(宝塔搭建)rspamd安装宝塔邮局-rspamd安装批量生成账号脚本及其使用方法 宝塔邮局批量生成账号脚本邮局收发以及评分优化邮局评分及性能优化番外篇宝塔邮局-域名解析篇附加功能包附加功能介绍/下载[...]