| | import random |
| | import string |
| | from pyrogram import Client, filters, enums |
| | from Devine import app |
| |
|
| | def generate_strong_password(length): |
| | |
| | lowercase = string.ascii_lowercase |
| | uppercase = string.ascii_uppercase |
| | digits = string.digits |
| | special_chars = "!@#$%^&*()_+" |
| |
|
| | |
| | password = [ |
| | random.choice(lowercase), |
| | random.choice(uppercase), |
| | random.choice(digits), |
| | random.choice(special_chars), |
| | ] |
| |
|
| | |
| | all_chars = lowercase + uppercase + digits + special_chars |
| | password += random.choices(all_chars, k=length - len(password)) |
| |
|
| | |
| | random.shuffle(password) |
| | |
| | |
| | return ''.join(password) |
| |
|
| | @app.on_message(filters.command(["genpass", 'genpw', "genpassword"])) |
| | async def password(bot, update): |
| | message = await update.reply_text(text="ᴘʀᴏᴄᴇꜱꜱɪɴɢ...") |
| | |
| | if len(update.command) > 1: |
| | qw = update.text.split(" ", 1)[1] |
| | else: |
| | ST = ["12", "14", "16", "18", "20"] |
| | qw = random.choice(ST) |
| | |
| | limit = int(qw) |
| | random_value = generate_strong_password(limit) |
| | |
| | txt = f"<b>ʟɪᴍɪᴛ :</b> {str(limit)} \n<b> ᴘᴀꜱꜱᴡᴏʀᴅ: <code>{random_value}</code>" |
| | |
| | await message.edit_text(text=txt, parse_mode=enums.ParseMode.HTML) |
| |
|