Last active
June 15, 2020 01:56
-
-
Save brunurd/7ca91f43a102b7014d93e10c68a4eee1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import random | |
import string | |
import sys | |
def gen_secret(secret_size): | |
secret = "" | |
invalid_chars = [' ','\n','\t','\r','\x0b','\x0c','"','\'','`','\\'] | |
for i in range(0, secret_size): | |
c = '' | |
while True: | |
c = string.printable[random.randrange(0,len(string.printable))] | |
if c not in invalid_chars: | |
break | |
secret += c | |
return secret | |
if __name__ == "__main__": | |
try: | |
value = int(sys.argv[1]) | |
print(gen_secret(value)) | |
except: | |
print(gen_secret(256)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment