-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBruteForceHash.py
95 lines (81 loc) · 4.27 KB
/
BruteForceHash.py
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
import random
from getpass import getpass
import string
import hashlib
o4 = 0
try:
print("""\x1b[1;31m
▄▄▄▄ ██▀███ █ ██ ▄▄▄█████▓▓█████ █████▒▒█████ ██▀███ ▄████▄ ▓█████
▓█████▄ ▓██ ▒ ██▒ ██ ▓██▒▓ ██▒ ▓▒▓█ ▀ ▓██ ▒▒██▒ ██▒▓██ ▒ ██▒▒██▀ ▀█ ▓█ ▀
▒██▒ ▄██▓██ ░▄█ ▒▓██ ▒██░▒ ▓██░ ▒░▒███ ▒████ ░▒██░ ██▒▓██ ░▄█ ▒▒▓█ ▄ ▒███
▒██░█▀ ▒██▀▀█▄ ▓▓█ ░██░░ ▓██▓ ░ ▒▓█ ▄ ░▓█▒ ░▒██ ██░▒██▀▀█▄ ▒▓▓▄ ▄██▒▒▓█ ▄
░▓█ ▀█▓░██▓ ▒██▒▒▒█████▓ ▒██▒ ░ ░▒████▒ ░▒█░ ░ ████▓▒░░██▓ ▒██▒▒ ▓███▀ ░░▒████▒
░▒▓███▀▒░ ▒▓ ░▒▓░░▒▓▒ ▒ ▒ ▒ ░░ ░░ ▒░ ░ ▒ ░ ░ ▒░▒░▒░ ░ ▒▓ ░▒▓░░ ░▒ ▒ ░░░ ▒░ ░
▒░▒ ░ ░▒ ░ ▒░░░▒░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ▒░ ░▒ ░ ▒░ ░ ▒ ░ ░ ░
░ ░ ░░ ░ ░░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░
\x1b[0;31m#################################################################
\x1b[0;34mBy x04000
\x1b[0;33mGithub: github.com/x04000
\x1b[0;32mBase: Python
\x1b[0;36mVersion: 1.0
\x1b[0;31m#################################################################
\x1b[1;34m
""")
numc = int(input("Number of characters: "))
option = str(input("Do you want include all chars? [Y/n] "))
print("")
if option == "Y":
chars = string.printable
chars_list = list(chars)
else:
o1=1
o2=1
o3=1
option = str(input("Do you want include lowercase? [Y/n] "))
if option == "Y":
o1 = 4
option = str(input("Do you want include uppercase? [Y/n] "))
if option == "Y":
o2 = 5
option = str(input("Do you want include numbers? [Y/n] "))
if option == "Y":
o3 = 6
o4 = o1+o2+o3
if o4 == 6:
chars = "abcdefghijklmnopqrstuvwxyz"
if o4 == 7:
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if o4 == 8:
chars = "0123456789"
if o4 == 10:
chars = "abcdefghijqlmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
if o4 == 11:
chars = "abcdefghijqlmnopqrstuvwxyz0123456789"
if o4 == 15:
chars = "abcdefghijqlmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
chars_list = list(chars)
password = getpass("Hash: ")
num = 0
guess_password = ""
while(guess_password != password):
guess_password = "".join(random.choice(chars_list) for _ in range(numc))
H = hashlib.md5(str(guess_password).encode('utf-8'))
m = hashlib.md5()
line = H.hexdigest()
m.update(str(line).encode('utf-8'))
word_hash = m.hexdigest()
print("Attemp: "+str(num)+" | Checking "+str(guess_password)+" | Hash: "+word_hash)
if(word_hash == str(password)):
print("\x1b[1;36m")
print("The password is: "+"".join(guess_password))
print("Total attemps: "+str(num))
print("\x1b[1;34m")
break
num = num + 1
except:
if o4 == 3:
print("\x1b[0;31m[\x1b[0;36m!\x1b[0;31m] Invalid values\x1b[1;34m")
exit()
print("\n\x1b[0;31m[\x1b[0;36m!\x1b[0;31m] Keyboard interrupt\x1b[1;34m")