diff --git a/bozocrack.rb b/bozocrack.rb index 5a4bd6f..7875e4c 100644 --- a/bozocrack.rb +++ b/bozocrack.rb @@ -35,7 +35,17 @@ def crack private def crack_single_hash(hash) - response = Net::HTTP.get URI("http://www.google.com/search?q=#{hash}") + if plaintext = crack_single_hash_with_website(hash, "http://www.google.com/search?q=#{hash}") + return plaintext + end + if plaintext = crack_single_hash_with_website(hash, "http://www.google.com/search?q=md5+#{hash}") + return plaintext + end + nil + end + + def crack_single_hash_with_website(hash, url) + response = Net::HTTP.get URI(url) wordlist = response.split(/\s+/) if plaintext = dictionary_attack(hash, wordlist) return plaintext @@ -48,6 +58,12 @@ def dictionary_attack(hash, wordlist) if Digest::MD5.hexdigest(word) == hash.downcase return word end + sub_wordlist = word.split(/[^a-zA-Z0-9]+/) + if (sub_wordlist.size > 1) + if plaintext = dictionary_attack(hash, sub_wordlist) + return plaintext + end + end end nil end @@ -74,4 +90,4 @@ def append_to_cache(hash, plaintext, filename = "cache") BozoCrack.new(ARGV[0]).crack else puts "Usage example: ruby bozocrack.rb file_with_md5_hashes.txt" -end \ No newline at end of file +end