本文整理汇总了Python中linotp.lib.HMAC.HmacOtp类的典型用法代码示例。如果您正苦于以下问题:Python HmacOtp类的具体用法?Python HmacOtp怎么用?Python HmacOtp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HmacOtp类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getNextOtp
def _getNextOtp(self):
"""
access the nex valid otp
:return: otpval
:rtype: string
"""
LOG.debug("[getNextOtp] begin. starting to look for the next otp")
try:
otplen = int(self.token.LinOtpOtpLen)
except ValueError as ex:
LOG.error("[getNextOtp] ValueError %r" % ex)
raise Exception(ex)
secObj = self._get_secret_object()
counter = self.token.getOtpCounter()
#log.debug("serial: %s",serialNum)
hmac2otp = HmacOtp(secObj, counter, otplen)
nextotp = hmac2otp.generate(counter + 1)
LOG.debug("[getNextOtp] end. got the next otp value: nextOtp %r"
% nextotp)
return nextotp
示例2: getOtp
def getOtp(self, curTime=None):
'''
get the next OTP value
:return: next otp value
:rtype: string
'''
log.debug("[getOtp] begin. Get the next OTP value for: curTime: %r" % (curTime))
try:
otplen = int(self.token.LinOtpOtpLen)
except ValueError as ex:
log.error("[getOtp]: Could not convert otplen - value error %r " % (ex))
raise Exception(ex)
self.hashlibStr = self.getFromTokenInfo("hashlib", 'sha1')
secretHOtp = self.token.getHOtpKey()
hmac2Otp = HmacOtp(secretHOtp, self.getOtpCount(), otplen, self.getHashlib(self.hashlibStr))
otpval = hmac2Otp.generate(inc_counter=False)
pin = self.token.getPin()
combined = "%s%s" % (otpval, pin)
if getFromConfig("PrependPin") == "True" :
combined = "%s%s" % (pin, otpval)
log.debug("[getOtp] end. Return opt is: (pin: %r, otpval: %r, combined: %r) " %
(pin, otpval, combined))
return (1, pin, otpval, combined)
示例3: get_multi_otp
def get_multi_otp(self, count=0, epoch_start=0, epoch_end=0, curTime=None):
'''
return a dictionary of multiple future OTP values of the HOTP/HMAC token
:param count: how many otp values should be returned
:type count: int
:return: tuple of status: boolean, error: text and the OTP dictionary
'''
log.debug("[get_multi_otp] begin. Get a dictionary of multiple future OTP values for: count: %r, epoch_start: %r, epoch_end: %r, curTime: %r" %
(count, epoch_start, epoch_end, curTime))
otp_dict = {"type" : "HMAC", "otp": {}}
ret = False
error = "No count specified"
try:
otplen = int(self.token.LinOtpOtpLen)
except ValueError as ex:
log.error("[get_multi_otp]: Could not convert otplen - value error %r " % (ex))
raise Exception(ex)
secretHOtp = self.token.getHOtpKey()
hmac2Otp = HmacOtp(secretHOtp, self.getOtpCount(), otplen, self.getHashlib(self.hashlibStr))
log.debug("[get_multi_otp] retrieving %i OTP values for token %s" % (count, hmac2Otp))
if count > 0:
for i in range(count):
otpval = hmac2Otp.generate(self.getOtpCount() + i, inc_counter=False)
otp_dict["otp"][i] = otpval
ret = True
log.debug("[get_multi_otp] end. dictionary of multiple future OTP is: otp_dict: %r - status: %r - error %r" % (ret, error, otp_dict))
return (ret, error, otp_dict)
示例4: getNextOtp
def getNextOtp(self):
'''
access the nex validf otp
:return: otpval
:rtype: string
'''
log.debug("[getNextOtp] begin. starting to look for the next otp")
try:
### TODO - replace tokenLen
otplen = int(self.token.LinOtpOtpLen)
except ValueError as ex:
log.error("[getNextOtp] ValueError %r" % ex)
raise Exception(ex)
secret_obj = self.token.getHOtpKey()
counter = self.token.getOtpCounter()
#log.debug("serial: %s",serialNum)
hmac2otp = HmacOtp(secret_obj, counter, otplen)
nextotp = hmac2otp.generate(counter + 1)
log.debug("[getNextOtp] end. got the next otp value: nextOtp %r"
% nextotp)
return nextotp
示例5: get_multi_otp
def get_multi_otp(self, count=0, epoch_start=0, epoch_end=0, curTime=None):
'''
return a dictionary of multiple future OTP values of the HOTP/HMAC token
:param count: how many otp values should be returned
:type count: int
:return: tuple of status: boolean, error: text and the OTP dictionary
'''
log.debug("[get_multi_otp] begin. Get a dictionary of multiple future OTP values for: count: %r, epoch_start: %r, epoch_end: %r, curTime: %r" %
(count, epoch_start, epoch_end, curTime))
otp_dict = {"type" : "TOTP", "otp": {}}
ret = False
error = "No count specified"
try:
otplen = int(self.token.LinOtpOtpLen)
except ValueError:
return ret
secretHOtp = self.token.getHOtpKey()
self.hashlibStr = self.getFromTokenInfo("hashlib", "sha1")
timeStepping = int(self.getFromTokenInfo("timeStep", 30))
shift = int(self.getFromTokenInfo("timeShift", 0))
hmac2Otp = HmacOtp(secretHOtp, self.getOtpCount(),
otplen, self.getHashlib(self.hashlibStr))
tCounter = self.time2float(datetime.datetime.now())
if curTime:
tCounter = self.time2float(curTime)
## we don't need to round here as we have alread float
counter = int(((tCounter - shift) / timeStepping))
otp_dict["shift"] = shift
otp_dict["timeStepping"] = timeStepping
if count > 0:
for i in range(0, count):
otpval = hmac2Otp.generate(counter=counter + i, inc_counter=False)
timeCounter = ((counter + i) * timeStepping) + shift
otp_dict["otp"][ counter + i] = {
'otpval' : otpval,
'time' : datetime.datetime.fromtimestamp(timeCounter).strftime("%Y-%m-%d %H:%M:%S"),
}
ret = True
log.debug("[get_multi_otp] end. dictionary of multiple future OTP is: otp_dict: %r - status: %r - error %r" % (ret, error, otp_dict))
return (ret, error, otp_dict)
示例6: resync
def resync(self, otp1, otp2, options=None):
'''
resync the token based on two otp values
- external method to do the resync of the token
:param otp1: the first otp value
:type otp1: string
:param otp2: the second otp value
:type otp2: string
:param options: optional token specific parameters
:type options: dict or None
:return: counter or -1 if otp does not exist
:rtype: int
'''
log.debug("[resync] .begin. Resync the token based on: %r, anOtpVal: %r, options: %r" % (otp1, otp2, options))
ret = False
try:
otplen = int(self.token.LinOtpOtpLen)
except ValueError as ex:
log.debug("[resync] otplen ValueError: %r ret: %r " % (ex, ret))
raise Exception(ex)
self.hashlibStr = self.getFromTokenInfo("hashlib", 'sha1')
secretHOtp = self.token.getHOtpKey()
counter = self.token.getOtpCounter()
syncWindow = self.token.getSyncWindow()
#log.debug("serial: %s",serialNum)
hmac2Otp = HmacOtp(secretHOtp, counter, otplen, self.getHashlib(self.hashlibStr))
counter = hmac2Otp.checkOtp(otp1, syncWindow)
if counter == -1:
log.debug("[resync] exit. First counter (-1) not found ret: %r" % (ret))
return ret
nextOtp = hmac2Otp.generate(counter + 1)
if nextOtp != otp2:
log.debug("[resync] exit. Failed to verify second otp: nextOtp: %r != otp2: %r ret: %r" % (nextOtp, otp2, ret))
return ret
ret = True
self.incOtpCounter(counter + 1, True)
log.debug("[resync] end. resync was successful: ret: %r" % (ret))
return ret
示例7: checkOtp
def checkOtp(self, anOtpVal, counter, window, options=None):
'''
checkOtp - validate the token otp against a given otpvalue
:param anOtpVal: the to be verified otpvalue
:type anOtpVal: string
:param counter: the counter state, that should be verified
:type counter: int
:param window: the counter +window, which should be checked
:type window: int
:param options: the dict, which could contain token specific info
:type options: dict
:return: the counter state or -1
:rtype: int
'''
log.debug("[checkOtp] begin. Validate the token otp: anOtpVal: %r ,counter: %r,window: %r, options: %r " % (anOtpVal, counter, window, options))
res = -1
try:
otplen = int(self.getOtpLen())
except ValueError as ex:
log.exception('[checkOtp] failed to initialize otplen: ValueError %r %r' % (ex, self.token.LinOtpOtpLen))
raise Exception(ex)
try:
self.hashlibStr = self.getFromTokenInfo("hashlib", 'sha1')
except Exception as ex:
log.exception('[checkOtp] failed to initialize hashlibStr: %r' % (ex))
raise Exception(ex)
secretHOtp = self.token.getHOtpKey()
#serialNum = self.token.LinOtpTokenSerialnumber
#log.debug("serial: %s",serialNum)
hmac2Otp = HmacOtp(secretHOtp, counter, otplen,
self.getHashlib(self.hashlibStr))
res = hmac2Otp.checkOtp(anOtpVal, window)
if -1 == res:
res = self.autosync(hmac2Otp, anOtpVal)
log.debug("[checkOtp] end. otp verification result was: res %r" % (res))
return res
示例8: check_otp_exist
def check_otp_exist(self, otp, window=10, user=None, autoassign=False):
'''
checks if the given OTP value is/are values of this very token.
This is used to autoassign and to determine the serial number of
a token.
:param otp: the to be verified otp value
:type otp: string
:param window: the lookahead window for the counter
:type window: int
:return: counter or -1 if otp does not exist
:rtype: int
'''
log.debug("[check_otp_exist] begin. checks if the given OTP value exists: otp %r, window %r " %
(otp, window))
res = -1
try:
otplen = int(self.token.LinOtpOtpLen)
counter = int(self.token.LinOtpCount)
except ValueError as ex:
log.warning("[check_otp_exist] a value error occurred while converting: otplen %r, counter %r : ValueError: %r ret: %r "
% (self.token.LinOtpOtpLen, self.token.LinOtpCount, ex, res))
return res
self.hashlibStr = self.getFromTokenInfo("hashlib", "sha1")
secObj = self._get_secret_object()
hmac2Otp = HmacOtp(secObj, counter, otplen,
self.getHashlib(self.hashlibStr))
res = hmac2Otp.checkOtp(otp, window)
if res >= 0:
# As usually the counter is increased in auth.validate.checkUserPass, we
# need to do this manually here:
self.incOtpCounter(res)
if res == -1:
msg = "otp counter %r was not found" % otp
else:
msg = "otp counter %r was found" % otp
log.debug("[check_otp_exist] end. %r: res %r" % (msg, res))
return res
示例9: getOtp
def getOtp(self, curTime=None):
'''
get the next OTP value
:return: next otp value
:rtype: string
'''
log.debug("[getOtp] begin. Get the next OTP value for: curTime: %r" % (curTime))
res = (-1, 0, 0, 0)
otplen = int(self.token.LinOtpOtpLen)
secretHOtp = self.token.getHOtpKey()
self.hashlibStr = self.getFromTokenInfo("hashlib", "sha1")
timeStepping = int(self.getFromTokenInfo("timeStep", 30))
shift = int(self.getFromTokenInfo("timeShift", 0))
hmac2Otp = HmacOtp(secretHOtp, self.getOtpCount(), otplen, self.getHashlib(self.hashlibStr))
tCounter = self.time2float(datetime.datetime.now())
if curTime:
tCounter = self.time2float(curTime)
## we don't need to round here as we have alread float
counter = int(((tCounter - shift) / timeStepping))
otpval = hmac2Otp.generate(counter=counter, inc_counter=False)
pin = self.token.getPin()
combined = "%s%s" % (otpval, pin)
if getFromConfig("PrependPin") == "True" :
combined = "%s%s" % (pin, otpval)
log.debug("[getOtp] end. Return opt is: (pin: %r, otpval: %r, combined: %r) " %
(pin, otpval, combined))
return (1, pin, otpval, combined)
示例10: checkOtp
def checkOtp(self, anOtpVal, counter, window, options=None):
'''
checkOtp - validate the token otp against a given otpvalue
:param anOtpVal: the to be verified otpvalue
@type anOtpVal: string
:param counter: the counter state, that should be verified
:type counter: int
:param window: the counter +window, which should be checked
:type window: int
:param options: the dict, which could contain token specific info
:type options: dict
:return: the counter state or -1
:rtype: int
'''
log.debug("[checkOtp] begin. Validate the token otp: anOtpVal: %r ,\
counter: %r,window: %r, options: %r " %
(anOtpVal, counter, window, options))
try:
otplen = int(self.token.LinOtpOtpLen)
except ValueError as e:
raise e
secretHOtp = self.token.getHOtpKey()
self.hashlibStr = self.getFromTokenInfo("hashlib", self.hashlibStr)
timeStepping = int(self.getFromTokenInfo("timeStep", self.timeStep))
window = int(self.getFromTokenInfo("timeWindow", self.timeWindow))
shift = int(self.getFromTokenInfo("timeShift", self.timeShift))
## oldCounter we have to remove one, as the normal otp handling will increment
oCount = self.getOtpCount() - 1
initTime = -1
if options != None and type(options) == dict:
initTime = int(options.get('initTime', -1))
if oCount < 0: oCount = 0
log.debug("[checkOTP] timestep: %i, timeWindow: %i, timeShift: %i" %
(timeStepping, window, shift))
inow = int(time.time())
T0 = time.time() + shift
if initTime != -1: T0 = int(initTime)
log.debug("[checkOTP] T0 : %i" % T0)
counter = self._time2counter_(T0, timeStepping=timeStepping)
otime = self._getTimeFromCounter(oCount, timeStepping=timeStepping)
ttime = self._getTimeFromCounter(counter, timeStepping=timeStepping)
log.debug("[checkOTP] last log: %r :: %r" % (oCount, otime))
log.debug("[checkOTP] counter : %r :: %r <==> %r" %
(counter, ttime, datetime.datetime.now()))
log.debug("[checkOTP] shift : %r " % (shift))
hmac2Otp = HmacOtp(secretHOtp, counter, otplen, self.getHashlib(self.hashlibStr))
res = hmac2Otp.checkOtp(anOtpVal, int (window / timeStepping), symetric=True)
log.debug("[checkOTP] comparing the result %i to the old counter %i." % (res, oCount))
if res != -1 and oCount != 0 and res <= oCount:
if initTime == -1:
log.warning("[checkOTP] a previous OTP value was used again!\n former tokencounter: %i, presented counter %i" %
(oCount, res))
res = -1
return res
if -1 == res :
## autosync: test if two consecutive otps have been provided
res = self.autosync(hmac2Otp, anOtpVal)
if res != -1:
## on success, we have to save the last attempt
self.setOtpCount(counter)
#
# here we calculate the new drift/shift between the server time and the tokentime
#
tokentime = self._counter2time_(res, timeStepping)
tokenDt = datetime.datetime.fromtimestamp(tokentime / 1.0)
nowDt = datetime.datetime.fromtimestamp(inow / 1.0)
lastauth = self._counter2time_(oCount, timeStepping)
lastauthDt = datetime.datetime.fromtimestamp(lastauth / 1.0)
log.debug("[checkOTP] last auth : %r" % (lastauthDt))
log.debug("[checkOTP] tokentime : %r" % (tokenDt))
#.........这里部分代码省略.........
示例11: resync
def resync(self, otp1, otp2, options=None):
'''
resync the token based on two otp values
- external method to do the resync of the token
:param otp1: the first otp value
:type otp1: string
:param otp2: the second otp value
:type otp2: string
:param options: optional token specific parameters
:type options: dict or None
:return: counter or -1 if otp does not exist
:rtype: int
'''
log.debug("[resync] .begin. Resync the token based on: %r, anOtpVal: %r, options: %r" % (otp1, otp2, options))
ret = False
try:
otplen = int(self.token.LinOtpOtpLen)
except ValueError:
return ret
secretHOtp = self.token.getHOtpKey()
self.hashlibStr = self.getFromTokenInfo("hashlib", 'sha1')
timeStepping = int(self.getFromTokenInfo("timeStep", 30))
shift = int(self.getFromTokenInfo("timeShift", 0))
try:
window = int(self.token.LinOtpSyncWindow) * timeStepping
except:
window = 10 * timeStepping
log.debug("[resync] timestep: %r, syncWindow: %r, timeShift: %r"
% (timeStepping, window, shift))
T0 = time.time() + shift
log.debug("[resync] T0 : %i" % T0)
counter = int((T0 / timeStepping) + 0.5) # T = (Current Unix time - T0) / timeStepping
log.debug("[resync] counter (current time): %i" % counter)
oCount = self.getOtpCount()
log.debug("[resync] tokenCounter: %r" % oCount)
log.debug("[resync] now checking window %s, timeStepping %s" % (window, timeStepping))
# check 2nd value
hmac2Otp = HmacOtp(secretHOtp, counter, otplen, self.getHashlib(self.hashlibStr))
log.debug("[resync] %s in otpkey: %s " % (otp2, secretHOtp))
res2 = hmac2Otp.checkOtp(otp2, int (window / timeStepping), symetric=True) #TEST -remove the 10
log.debug("[resync] res 2: %r" % res2)
# check 1st value
hmac2Otp = HmacOtp(secretHOtp, counter - 1, otplen, self.getHashlib(self.hashlibStr))
log.debug("[resync] %s in otpkey: %s " % (otp1, secretHOtp))
res1 = hmac2Otp.checkOtp(otp1, int (window / timeStepping), symetric=True) #TEST -remove the 10
log.debug("[resync] res 1: %r" % res1)
if res1 < oCount:
# A previous OTP value was used again!
log.warning("[resync] a previous OTP value was used again! tokencounter: %i, presented counter %i" %
(oCount, res1))
res1 = -1
if res1 != -1 and res1 + 1 == res2:
# here we calculate the new drift/shift between the server time and the tokentime
tokentime = (res2 + 0.5) * timeStepping
currenttime = T0 - shift
new_shift = (tokentime - currenttime)
log.debug("[resync] the counters %r and %r matched. New shift: %r"
% (res1, res2, new_shift))
self.addToTokenInfo('timeShift', new_shift)
# The OTP value that was used for resync must not be used again!
self.setOtpCount(res2 + 1)
ret = True
if ret == True:
msg = "resync was successful"
else:
msg = "resync was not successful"
log.debug("[resync] end. %s: ret: %r" % (msg, ret))
return ret
示例12: test_scenario01
#.........这里部分代码省略.........
"bach": serial_token_bach,
"debussy": serial_token_debussy,
"mozart": serial_token_mozart,
"beethoven": serial_token_beethoven
}
for user in user_token_dict:
driver.get(self.base_url + "/account/login")
driver.find_element_by_id("login").clear()
driver.find_element_by_id("login").send_keys("%[email protected]%s" % (user, test1_realm))
driver.find_element_by_id("password").clear()
driver.find_element_by_id("password").send_keys("Test123!")
driver.find_element_by_id("password").submit()
driver.find_element_by_xpath("//div[@id='tabs']/ul/li/a/span[text()='set PIN']").click()
time.sleep(1)
# driver.find_element_by_css_selector('#tokenDiv > ul > li > a').click()
driver.find_element_by_id('tokenDiv').find_element_by_partial_link_text(user_token_dict[user]).click()
driver.find_element_by_id("pin1").clear()
driver.find_element_by_id("pin1").send_keys(user + "newpin")
driver.find_element_by_id("pin2").clear()
driver.find_element_by_id("pin2").send_keys(user + "newpin")
driver.find_element_by_id("button_setpin").click()
time.sleep(1)
self.assertEqual("PIN set successfully", self.close_alert_and_get_its_text())
driver.find_element_by_link_text("Logout").click()
self._announce_test("10. Authentisierung der 4 Benutzer ###")
validate = Validate(self.http_protocol,
self.http_host,
self.http_port,
self.http_username,
self.http_password)
# Validate HOTP Token - bach
hotp = HmacOtp()
for counter in range(0, 20):
otp = "bachnewpin" + hotp.generate(counter=counter, key=seed_oath137332_bin)
access_granted, _ = validate.validate(user="[email protected]" +
test1_realm, password=otp)
self.assertTrue(access_granted, "OTP: " + otp + " for user " +
"[email protected]" + test1_realm + " returned False")
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="1234111111")
self.assertFalse(access_granted, "OTP: 1234111111 should be False for user bach")
# Validate Remote token - debussy
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="debussynewpin" + remote_token_otp)
self.assertTrue(access_granted, "OTP: " + remote_token_otp + " for user " +
"[email protected]" + test1_realm + " returned False")
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="1234111111")
self.assertFalse(access_granted, "OTP: 1234111111 should be False for user debussy")
# Validate Spass token - beethoven
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="beethovennewpin")
self.assertTrue(access_granted, "OTP: " + "beethovennewpin" + " for user " +
"[email protected]" + test1_realm + " returned False")
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="randominvalidpin")
self.assertFalse(access_granted, "OTP: randominvalidpin should be False for user beethoven")
# Validate mOTP token - mozart
current_epoch = time.time()
motp_otp = calculate_motp(
epoch=current_epoch,
示例13: test_scenario01
#.........这里部分代码省略.........
user_token_dict = {
"bach": serial_token_bach,
"debussy": serial_token_debussy,
"mozart": serial_token_mozart,
"beethoven": serial_token_beethoven
}
for user in user_token_dict:
driver.get(self.base_url + "/account/login")
driver.find_element_by_id("login").clear()
driver.find_element_by_id("login").send_keys("%[email protected]%s" % (user, test1_realm))
driver.find_element_by_id("password").clear()
driver.find_element_by_id("password").send_keys("Test123!")
driver.find_element_by_id("password").submit()
driver.find_element_by_xpath("//div[@id='tabs']/ul/li/a/span[text()='set PIN']").click()
time.sleep(1)
# driver.find_element_by_css_selector('#tokenDiv > ul > li > a').click()
driver.find_element_by_id('tokenDiv').find_element_by_partial_link_text(user_token_dict[user]).click()
driver.find_element_by_id("pin1").clear()
driver.find_element_by_id("pin1").send_keys(user + "newpin")
driver.find_element_by_id("pin2").clear()
driver.find_element_by_id("pin2").send_keys(user + "newpin")
driver.find_element_by_id("button_setpin").click()
time.sleep(1)
self.assertEqual("PIN set successfully", self.close_alert_and_get_its_text())
driver.find_element_by_link_text("Logout").click()
### 10. Authentisierung der 4 Benutzer ###
validate = Validate(self.http_protocol,
self.http_host,
self.http_username,
self.http_password)
# Validate HOTP Token - bach
hotp = HmacOtp()
for counter in range(0, 20):
otp = "bachnewpin" + hotp.generate(counter=counter, key=seed_oath137332_bin)
access_granted, _ = validate.validate(user="[email protected]" +
test1_realm, password=otp)
self.assertTrue(access_granted, "OTP: " + otp + " for user " +
"[email protected]" + test1_realm + " returned False")
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="1234111111")
self.assertFalse(access_granted, "OTP: 1234111111 should be False for user bach")
# Validate Remote token - debussy
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="debussynewpin" + remote_token_otp)
self.assertTrue(access_granted, "OTP: " + remote_token_otp + " for user " +
"[email protected]" + test1_realm + " returned False")
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="1234111111")
self.assertFalse(access_granted, "OTP: 1234111111 should be False for user debussy")
# Validate Spass token - beethoven
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="beethovennewpin")
self.assertTrue(access_granted, "OTP: " + "beethovennewpin" + " for user " +
"[email protected]" + test1_realm + " returned False")
access_granted, _ = validate.validate(user="[email protected]" + test1_realm,
password="randominvalidpin")
self.assertFalse(access_granted, "OTP: randominvalidpin should be False for user beethoven")
# Validate mOTP token - mozart
current_epoch = time.time()
motp_otp = calculate_motp(
epoch=current_epoch,