-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpassword.py
More file actions
executable file
·21 lines (20 loc) · 825 Bytes
/
password.py
File metadata and controls
executable file
·21 lines (20 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python3
# Module to Encrypt Password for Auto Install Modules with ESXi
#=============================================================================
# Source Modules
#=============================================================================
def prRed(skk): print("\033[91m {}\033[00m" .format(skk))
import sys
try:
import crypt, stdiomask
except ImportError as e:
prRed(f'!!! ERROR !!!\n{e.__class__.__name__}')
prRed(f" Module {e.name} is required to run this script")
prRed(f" Install the module using the following: `pip install {e.name}`")
sys.exit(1)
valid = False
while valid == False:
password = stdiomask.getpass(prompt='Enter the password to encrypt: ')
if not password == '':
print(crypt.crypt(password, crypt.mksalt(crypt.METHOD_SHA512)))
valid = True