I forgot where these came from
This commit is contained in:
parent
0d06a71fca
commit
dc3bc85607
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,15 +1,25 @@
|
||||||
import time, pyotp
|
from random import randrange
|
||||||
|
import time, pyotp, datetime
|
||||||
|
|
||||||
totp = pyotp.TOTP(pyotp.random_base32(), interval=45)
|
hotp = pyotp.HOTP(pyotp.random_base32())
|
||||||
|
|
||||||
code = totp.now()
|
success = 0
|
||||||
|
num_tries = 20
|
||||||
|
|
||||||
for i in range(0,60):
|
for i in range(0,num_tries):
|
||||||
|
epoch = int(time.time())
|
||||||
if totp.verify(code):
|
code = hotp.at(epoch)
|
||||||
print(f'{code} verified fine at t+{i}')
|
print('------------------------')
|
||||||
|
print(f'Made a code {code} at {epoch}, sending a simualted instruction')
|
||||||
|
|
||||||
|
waittime = randrange(5)
|
||||||
|
print(f'Instuction will take {waittime} seconds to receive or be recieved')
|
||||||
|
time.sleep(waittime)
|
||||||
|
|
||||||
|
if hotp.verify(code, epoch):
|
||||||
|
print(f'code:{code} verified')
|
||||||
|
success += 1
|
||||||
else:
|
else:
|
||||||
print(f'{code} expired at t+{i}')
|
print(f'code:{code} expired')
|
||||||
break
|
|
||||||
|
|
||||||
time.sleep(1)
|
print(f'Succeded {success} out of {num_tries} tries')
|
||||||
|
|
Loading…
Reference in New Issue