Created
August 28, 2014 02:10
-
-
Save dillonhafer/9ded6436faa1fbfc058a to your computer and use it in GitHub Desktop.
Get random passwords from GRC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
class Grc | |
attr_accessor :hex, :ascii, :alpha | |
PAGE_URL = "https://www.grc.com/passwords.htm" | |
def initialize | |
chars = fetch | |
@hex = chars[0].text | |
@ascii = chars[1].text | |
@alpha = chars[2].text | |
end | |
def self.random(complexity) | |
self.new.send(complexity.to_s) | |
end | |
private | |
def fetch | |
Nokogiri::HTML(open(PAGE_URL)).css("font[size='2']")[1..3] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment