https://github.com/apache/infrastructure-otp may also be worth trying.

- Sam Ruby

On Mon, Jul 20, 2020 at 7:38 AM Sam Ruby <ru...@intertwingly.net> wrote:
>
> The following works on Ubuntu and Mac (including Catalina).  Put it in
> a file named otp-md5 in your path and make it executable:
>
> #!/usr/bin/env ruby
> require 'otp' # gem install ruby-otp
> require 'open3'
>
> def OTP.md5(sequence, seed, password=nil)
>   if password == nil
>     begin
>       print "password: "
>       system 'stty -echo -icanon'
>       password = $stdin.gets
>       password.chomp! if password
>     ensure
>       system 'stty echo icanon'
>       print "\r"
>     end
>   end
>
>   if password.size < 10
>     joined = seed + password
>     password = joined[-10..-1]
>     seed = joined[0...-10]
>   end
>
>   OTP.new(sequence.to_i, seed, password, 'md5')
> end
>
> if __FILE__ == $0
>   password = OTP.md5(*ARGV[0..1])
>
>   if RUBY_PLATFORM.include? 'darwin'
>     Open3.capture2e('pbcopy', stdin_data: password)
>   else not `which xclip`.empty?
>     Open3.capture2e('xclip', '-select', 'clipboard', stdin_data: password)
>   end
>
>   puts password
> end
>
> On Mon, Jul 20, 2020 at 6:33 AM sebb <seb...@gmail.com> wrote:
> >
> > My current generator apparently does not work on Catalina.
> >
> > Can you recommend a good generator?
> >
> > S.

Reply via email to