-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.py
More file actions
36 lines (31 loc) · 1.65 KB
/
Copy pathmail.py
File metadata and controls
36 lines (31 loc) · 1.65 KB
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
import secrets
from random import choice, randint
from string import ascii_lowercase, ascii_letters, digits
def get_mail(n_num: int = 4, n_char: int = 3):
name = ['khang', 'thien', 'tuong', 'duc', 'dung', 'duy', 'hoang', 'khai', 'khoa', 'khoi', 'minh', 'quan', 'quoc', 'son', 'tai', 'thai', 'tuan', 'tung', 'viet',
'cuong', 'loc', 'long', 'phuoc', 'thanh', 'thinh', 'thuc', 'truc', 'nhan', 'bao', 'giang', 'hien', 'hoa', 'huy', 'huynh', 'khanh', 'thach', 'tin', 'toan', 'dat', 'thuan']
random_number = str(randint(10**(n_num-1), (10**n_num)-1))
random_mail_provider = "@gmail.com"
random_name = choice(name)
random_char = "".join(choice(ascii_lowercase) for _ in range(n_char))
return random_name + random_char + random_number + random_mail_provider
def get_pass(n: int = 10, is_punctuation: bool = True):
if is_punctuation:
punctuation = "!#$%&()*+,-.:?@_~"
alphabet = ascii_letters + digits + punctuation
while True:
password = ''.join(secrets.choice(alphabet) for i in range(n))
if (any(c.islower() for c in password)
and any(c.isupper() for c in password)
and any(c.isalnum() for c in password)
and sum(c in punctuation for c in password) < 3):
break
else:
alphabet = ascii_letters + digits
while True:
password = ''.join(secrets.choice(alphabet) for i in range(10))
if (any(c.islower() for c in password)
and any(c.isupper() for c in password)
and any(c.isdigit() for c in password)):
break
return password