daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def get_zero_times(token, amount = 1, interval = 30)
  2.   amount = amount.to_i
  3.   return [] if amount <= 0
  4.  
  5.   password_lib = ROTP::TOTP.new(token)
  6.  
  7.   time = Time.now
  8.   zero_times = []
  9.  
  10.   while(zero_times.size < amount)
  11.     code = password_lib.at(time, true)
  12.     if code.starts_with?('0')
  13.       zero_times << time
  14.     end
  15.  
  16.     time += interval.seconds
  17.   end
  18.  
  19.   zero_times
  20. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top