14 lines
469 B
Python
Executable file
14 lines
469 B
Python
Executable file
#!/bin/python3
|
|
from datetime import datetime
|
|
import sys
|
|
|
|
if len(sys.argv) != 3:
|
|
raise Exception('Provide output file name and environment')
|
|
if len(sys.argv[2]) != 6:
|
|
raise Exception('Environment name must be exactly 6 characters')
|
|
|
|
with open(sys.argv[1], 'wb') as tkey:
|
|
value = ''.join([sys.argv[2], datetime.utcnow().strftime('%Y%m%d%H')])
|
|
tkey.write(value.encode('utf-8'))
|
|
with open('/dev/random', 'rb') as rand:
|
|
tkey.write(rand.read(32))
|