daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 49 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
Top