Option to choose number of MySQL Instances!

This commit is contained in:
usmannasir
2018-05-29 20:20:05 +05:00
parent 04f89b92d0
commit 659f2014b4
1631 changed files with 418789 additions and 258 deletions

View File

@@ -0,0 +1,38 @@
from os import urandom
from random import choice
char_set = {'small': 'abcdefghijklmnopqrstuvwxyz',
'nums': '0123456789',
'big': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
}
def generate_pass(length=14):
"""Function to generate a password"""
password = []
while len(password) < length:
key = choice(char_set.keys())
a_char = urandom(1)
if a_char in char_set[key]:
if check_prev_char(password, char_set[key]):
continue
else:
password.append(a_char)
return ''.join(password)
def check_prev_char(password, current_char_set):
"""Function to ensure that there are no consecutive
UPPERCASE/lowercase/numbers/special-characters."""
index = len(password)
if index == 0:
return False
else:
prev_char = password[index - 1]
if prev_char in current_char_set:
return True
else:
return False