WIP: Examine develop branch #9
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())
|
||||
code = hotp.at(epoch)
|
||||
print('------------------------')
|
||||
print(f'Made a code {code} at {epoch}, sending a simualted instruction')
|
||||
|
||||
if totp.verify(code):
|
||||
print(f'{code} verified fine at t+{i}')
|
||||
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:
|
||||
print(f'{code} expired at t+{i}')
|
||||
break
|
||||
print(f'code:{code} expired')
|
||||
|
||||
time.sleep(1)
|
||||
print(f'Succeded {success} out of {num_tries} tries')
|
||||
|
|
Loading…
Reference in New Issue