Sha256: 59f32c3194cc34deecb667f496a82e2413e83387ffa78e522d6f1df9fc20edb7

Contents?: true

Size: 529 Bytes

Versions: 10

Compression:

Stored size: 529 Bytes

Contents

class Gratan::Identifier::Auto
  def initialize(output, options = {})
    @options = options

    if output == '-'
      @output = $stdout
    else
      @output = open(output, 'w')
    end
  end

  def identify(user, host)
    password = mkpasswd
    puts_password(user, host, password)
    password
  end

  private

  def mkpasswd(len = 8)
    [*1..9, *'A'..'Z', *'a'..'z'].shuffle.slice(0, len).join
  end

  def puts_password(user, host, password)
    @output.puts("#{user}@#{host},#{password}")
    @output.flush
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gratan-0.1.9 lib/gratan/identifier/auto.rb
gratan-0.1.8 lib/gratan/identifier/auto.rb
gratan-0.1.7 lib/gratan/identifier/auto.rb
gratan-0.1.6 lib/gratan/identifier/auto.rb
gratan-0.1.5 lib/gratan/identifier/auto.rb
gratan-0.1.4 lib/gratan/identifier/auto.rb
gratan-0.1.3 lib/gratan/identifier/auto.rb
gratan-0.1.2 lib/gratan/identifier/auto.rb
gratan-0.1.1 lib/gratan/identifier/auto.rb
gratan-0.1.0 lib/gratan/identifier/auto.rb