Hacía tiempo que no escribía ...

Aquí tenéis un generador de password con ruby...

Genera passwords aleatorios con caracteres imprimibles de la tabla ASCII.

Github: git://github.com/koteo/PasswordGenerator.git

Código:

#!/usr/bin/env ruby
# encoding: UTF-8
#
#=======================================================================================
#
# FILE: password_generator3.rb
#
#
# DESCRIPTION: Random password generator with lots of combinations
#
# OPTIONS:
# REQUIREMENTS:
# AUTHOR: Koldo Oteo (), koldo.oteo1@gmail.com
# WEB: http://koteo.lacoctelera.net
# VERSION: v1.0
# CREATED: 07-11-2010
# MODIFIED: Sun 07 Nov 2010 11:48:11 PM CET
# LICENSE: GNU AFFERO GENERAL PUBLIC LICENSE
#=======================================================================================

# Creando la clase y sus funciones
class PassGen

def pide_pal
if ARGV.empty?
puts "Ruby random password generator v1.0"
puts ""
puts "The password haves ascii printable characteres (on ascii table from the decimal 33 to 126)"
puts ""
puts "Uso: ruby #{$0} (Number_of_characters)"
exit
end
end

def range_rand(min,max)
min + rand(max-min)
end

def conv_int_to_ascii
@pas_len = ARGV[0].to_i
@charslist = ""
@pas_len.times { @charslist << range_rand(33,126) }
puts "Your password is: #{@charslist}"
end

end

# Haciendo uso de la clase y sus respectivas funciones.

pg = PassGen.new
pg.pide_pal
pg.conv_int_to_ascii