[Ruby] CrackHash 0.1

Iniciado por BigBear, 10 Febrero 2012, 21:04 PM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Un simple codigo en ruby para crackear un hash md5 con un diccionario.

Código (ruby) [Seleccionar]

#!usr/bin/ruby
#CrackHash 0.1
#Coded By Doddy H
#Test with 202cb962ac59075b964b07152d234b70 = 123

require "digest/md5"

def openwords(file)
  if File.file?(file)
    print "\n[+] Opening file\n\n"
    ar = File.open(file)
    lineas = ar.readlines
    ar.close
    print "[+] Number of words : ",lineas.length,"\n\n"
    return lineas
  else
    print "[-] Error opening file\n"
  end
end

def sintax()
  print "\n[+] ruby crack.rb <hash> <wordlist>\n"
end

def head()
  print "\n-- == CrackHash 0.1 == --\n\n"
end

def copyright()
  print "\n\n(C) Doddy Hackman 2012\n"
  exit(1)
end

hash = ARGV[0]
wordlist = ARGV[1]

head()

if !hash and !wordlist
  sintax()
else
  if hash.length ==32
    words = openwords(wordlist)
    print "\n[+] Cracking hash...\n\n"
    words.each do |word|
      word = word.chomp
      if Digest::MD5.hexdigest(word) == hash
        print "\a\a\n[+] Hash cracked : ",word,"\n"
        copyright()
      end     
    end
    print "\n[-] Hash not found\n\n"
  else
    print "\n[-] Hash invalid\n\n"
    copyright()     
  end
end

copyright()


# The End ?