added seed output
This commit is contained in:
parent
4e49eaf0fc
commit
f3a116d11f
0
InstallDepLinux.sh
Normal file → Executable file
0
InstallDepLinux.sh
Normal file → Executable file
|
|
@ -11,6 +11,7 @@ parser = argparse.ArgumentParser(prog='True Random Password Generator', descript
|
|||
parser.add_argument('-a', '--apikey', default=os.environ['HOME']+'/.bin/.apikey' , type=str, help='path to a file which contains only a random.org api key')
|
||||
parser.add_argument('-c', '--count', default='50', type=int, help='the number of passwords to generate')
|
||||
parser.add_argument('-l', '--length', default='20', type=int, help='the length the generated passwords should have')
|
||||
parser.add_argument('-s', '--seed', action='store_true', help='outputs the queried seed instead of initialzing the pseudo random vector')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
|
|
@ -44,18 +45,19 @@ with suppress_std_err_out():
|
|||
seed=response["random"]["data"]
|
||||
|
||||
#Filling the seed with a (true) random number
|
||||
characters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#_@!?+"
|
||||
char_lst = [x for x in characters]
|
||||
random.seed(int(seed[0]))
|
||||
#Building password
|
||||
for _ in range(0,args.count):
|
||||
pw_string=""
|
||||
for _ in range(0,args.length):
|
||||
pw_string += char_lst[random.randint(0, 67)]
|
||||
print(pw_string)
|
||||
|
||||
|
||||
|
||||
if not args.seed:
|
||||
characters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#_@!?+"
|
||||
char_lst = [x for x in characters]
|
||||
random.seed(int(seed[0]))
|
||||
#Building password
|
||||
for _ in range(0,args.count):
|
||||
pw_string=""
|
||||
for _ in range(0,args.length):
|
||||
pw_string += char_lst[random.randint(0, 67)]
|
||||
print(pw_string)
|
||||
else:
|
||||
print("-------------------------------------------")
|
||||
print('Seed: '+str(seed[0]));
|
||||
|
||||
print("-------------------------------------------")
|
||||
bit_uses_left=response["bitsLeft"] // response["bitsUsed"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user