Aca les dejo este crackeador por fuerza bruta. Funciona de maravilla aunque no es muy rapido por el lenguaje. Quizas les sirva como ejemplo.
1 Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -v
Comandos:
1
2
3
4
5
6 -t: Tipo de Hash
-h: Hash a Crackear
-w: Teclas a usar
-a: Maximo de Caracteres
-i: Minimo de Caracteres
-v: Modo Hacking
Código Fuente:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187 import sys , string , time
def main():
"Main"
title = "MD5 Cracker Brute Force"
print "\n" + title.center(45) + "\n"
def usage():
"Usage"
print "[+] Ejemplo : Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -v"
def usagelarge():
"Usage Large"
print "\n Forma de Uso:"
print "\n [+]Ejemplo: Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -v"
print ""
print "\t[Comandos]"
print "\t -t: Tipo de Hash"
print "\t -h: Hash a Crackear"
print "\t -w: Teclas a usar"
print "\t -a: Maximo de Caracteres"
print "\t -i: Minimo de Caracteres"
print "\t -v: Modo Hacking\n"
def timer():
"Time"
now = time.localtime(time.time())
return time.asctime(now)
if '__main__' == __name__ :
if len(sys.argv) <= 5:
main()
usagelarge()
sys.exit(1)
hhash = words = maxw = minw = typeh = ""
verbose = 0
for arg in sys.argv[1:]:
try:
if arg.lower() == "-v" or arg.lower() == "-verbose":
verbose = 1
if arg.lower() == "-h" or arg.lower() == "-hash":
hhash = sys.argv[int(sys.argv[1:].index(arg))+2]
if arg.lower() == "-a" or arg.lower() == "-max":
maxw = sys.argv[int(sys.argv[1:].index(arg))+2]
if arg.lower() == "-i" or arg.lower() == "-min":
minw = sys.argv[int(sys.argv[1:].index(arg))+2]
if arg.lower() == "-w" or arg.lower() == "-words":
words = sys.argv[int(sys.argv[1:].index(arg))+2]
if arg.lower() == "-t" or arg.lower() == "-type":
typeh = sys.argv[int(sys.argv[1:].index(arg))+2]
except(IndexError):
print "[+] Comandos Obligatorios -t(Tipo de Hash) -h(Hash) -w(Teclas) -a(Maximo de teclas) -a(Minimo de teclas)"
usage()
sys.exit(1)
if minw == "" : minw = '1'
main()
for args in (typeh, hhash, words, maxw, minw):
try:
if args != "":
if args == typeh :
if typeh.lower() != 'md5' or 'sha':
if typeh.lower() == "md5" :
typeh = '1'
print "[+] Tipo de Hash : MD5"
elif typeh.lower() == "sha" :
typeh = '2'
print "[+] Tipo de Hash : SHA1"
else:
print "[+] Tipo Invalido de Hash"
sys.exit(1)
if args == hhash :
if typeh == '1' :
if len(hhash) == 32 :
print "[+] MD5 Hash : " + hhash
else:
print "[+] Tipo Invalido de Hash"
sys.exit(1)
if typeh == '2' :
if len(hhash) == 40 :
print "[+] SHA1 Hash : " + hhash
else:
print "[+] SHA1 Invalido"
sys.exit(1)
if args == words :
print "[+] Teclas a usar : " + words
if args == maxw :
if maxw.isdigit() != False :
if int(maxw) >= 15 :
print "[+] Maximo de Digitos : 15 : " + maxw
sys.exit(1)
else:
if int(maxw) > int(minw):
print "[+] Maximo de Digitos : " + maxw
else:
print "[+] El Maximo de Digitos debe ser mayor al Minimo de Digitos"
sys.exit(1)
else:
print "[+] Maximo de Teclas = Digitos"
sys.exit(1)
if args == minw :
if minw.isdigit() != False :
if int(minw) < int(maxw) :
print "[+] Minimo de Digitos : " + minw
else:
print "[+] El minimo de Digitos debe ser menor al maximo de Digitos"
sys.exit(1)
else:
print "[+] Minimo de Teclas = Digitos"
sys.exit(1)
else:
print "[+] Comandos Obligatorios -t(Tipo de Hash) -h(Hash) -w(Teclas) -a(Maximo de teclas) -a(Minimo de teclas)"
usage()
sys.exit(1)
except(ValueError):
print "[+] Formato de comandos erroneo"
sys.exit(1)
f = open("CRACK.py",'w')
f.write("#!/usr/bin/env python\n")
if (typeh == '1') : f.write("import sys , md5 , string , time\n")
if (typeh == '2') : f.write("import sys , sha , string , time\n")
tab = '\t'
f.write("def timer():\n")
f.write(tab + "now = time.localtime(time.time())\n")
f.write(tab + "return time.asctime(now)\n")
f.write("def crackhash():\n")
i = 0 ; inwords = ""
f.write(tab + "hashh = '" + hhash.lower() +"'\n")
f.write(tab + "try:\n")
#print words
for i in words:
if i == str(words[int(len(words)-1)]) :
inwords += "'" + i + "'"
break
inwords += "'" + i + "',"
#print inwords
i = int(minw) ; iwords = "" ; a = 0
while (int(i) != int(maxw) + 1) :
for a in range(i):
if int(i) != (int(a) + 1):
iwords += "i" + str(i) + str(a) + " + "
else:
iwords += "i" + str(i) + str(a)
data = (int(a + 2) * tab + "for i" + str(i) + str(a) + " in (" + inwords + "):\n")
f.write(data)
f.write(int(i + 2) * tab + "word = '' ; value = ''\n")
f.write(int(i + 2) * tab + "word = " + iwords + "\n")
if typeh == '1' : f.write(int(i + 2) * tab + "hash = md5.new()\n")
if typeh == '2' : f.write(int(i + 2) * tab + "hash = sha.new()\n")
f.write(int(i + 2) * tab + "hash.update(str(word))\n")
f.write(int(i + 2) * tab + "value = hash.hexdigest()\n")
if verbose == 1 : f.write(int(i + 2) * tab + "print " + iwords + ' + " : " + str(value)\n')
f.write(int(i + 2) * tab + "if str(hashh) == str(value):\n")
f.write(int(i + 3) * tab + "raise Exception\n")
iwords = ""
i += 1
f.write(tab + "except(Exception):")
f.write('\n'+ 2 * tab + "print '******************** Hash Crackeado ' + 20 * '*'")
f.write('\n' + 2 * tab + "print '[+] HASH :', hashh")
f.write('\n' + 2 * tab + "print '[+] PASS :', str(word)")
f.write('\n' + 2 * tab + "print '[+] Hora de finalizacion :', timer()")
f.write('\n' + 2 * tab + "sys.exit(1)")
f.write('\n' + tab + "except(KeyboardInterrupt):")
f.write('\n' + 2 * tab + "print '[+] Process Ended ',timer()")
f.write('\n' + 2 * tab + "sys.exit(1)")
f.write("\ncrackhash()")
f.close()
print '[+] Hora de inicio : ', timer()
import CRACK
CRACK.crackhash()
Nota: Corre con Python 2.x