mirror of
https://github.com/retspen/webvirtcloud.git
synced 2026-05-26 07:08:05 +00:00
update secret generator with new python secrets module - urlsafe
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
import random
|
import secrets
|
||||||
import string
|
|
||||||
|
|
||||||
haystack = string.ascii_letters + string.digits + string.punctuation
|
generated_key = secrets.token_urlsafe(50)
|
||||||
print(''.join([random.SystemRandom().choice(haystack.replace('/', '').replace('\'', '').replace('\"', '')) for _ in range(50)]))
|
|
||||||
|
print(''.join(generated_key))
|
||||||
|
|
||||||
|
|
||||||
|
### Use for old python versions < 3.6
|
||||||
|
##import random
|
||||||
|
##import string
|
||||||
|
#
|
||||||
|
##haystack = string.ascii_letters + string.digits + string.punctuation
|
||||||
|
##print(''.join([random.SystemRandom().choice(haystack.replace('/', '').replace('\'', '').replace('\"', '')) for _ in range(50)]))
|
||||||
|
|||||||
Reference in New Issue
Block a user