Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_zero_times(token, amount = 1, interval = 30)
- amount = amount.to_i
- return [] if amount <= 0
- password_lib = ROTP::TOTP.new(token)
- time = Time.now
- zero_times = []
- while(zero_times.size < amount)
- code = password_lib.at(time, true)
- if code.starts_with?('0')
- zero_times << time
- end
- time += interval.seconds
- end
- zero_times
- end
Add Comment
Please, Sign In to add comment