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('-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('-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('-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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -44,18 +45,19 @@ with suppress_std_err_out():
|
||||||
seed=response["random"]["data"]
|
seed=response["random"]["data"]
|
||||||
|
|
||||||
#Filling the seed with a (true) random number
|
#Filling the seed with a (true) random number
|
||||||
characters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#_@!?+"
|
if not args.seed:
|
||||||
char_lst = [x for x in characters]
|
characters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#_@!?+"
|
||||||
random.seed(int(seed[0]))
|
char_lst = [x for x in characters]
|
||||||
#Building password
|
random.seed(int(seed[0]))
|
||||||
for _ in range(0,args.count):
|
#Building password
|
||||||
pw_string=""
|
for _ in range(0,args.count):
|
||||||
for _ in range(0,args.length):
|
pw_string=""
|
||||||
pw_string += char_lst[random.randint(0, 67)]
|
for _ in range(0,args.length):
|
||||||
print(pw_string)
|
pw_string += char_lst[random.randint(0, 67)]
|
||||||
|
print(pw_string)
|
||||||
|
else:
|
||||||
|
print("-------------------------------------------")
|
||||||
|
print('Seed: '+str(seed[0]));
|
||||||
|
|
||||||
print("-------------------------------------------")
|
print("-------------------------------------------")
|
||||||
bit_uses_left=response["bitsLeft"] // response["bitsUsed"]
|
bit_uses_left=response["bitsLeft"] // response["bitsUsed"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user