1
00:00:00,520 --> 00:00:01,420
Welcome back.

2
00:00:01,420 --> 00:00:06,550
Let's start off with our basket cracker or if you want to call it the hash cracker.

3
00:00:06,550 --> 00:00:10,450
There is only going to be one library that we're going to need for this project and that will be the

4
00:00:10,450 --> 00:00:11,980
hash the library.

5
00:00:11,980 --> 00:00:19,120
So we will imported right away type here import hash limp and there are three different things that

6
00:00:19,120 --> 00:00:23,320
we will require from the user in order to continue with the execution of the program.

7
00:00:23,890 --> 00:00:26,590
So the first thing is going to be the type of hash.

8
00:00:26,590 --> 00:00:31,880
So we need to ask the user which type of hash they want to decrypt or they want to brute force.

9
00:00:32,080 --> 00:00:33,420
We'll give them three option.

10
00:00:33,490 --> 00:00:38,290
And if you want if you want to operate this program after this project you can simply just add multiple

11
00:00:38,290 --> 00:00:42,270
options for multiple hash values that we didn't cover in this case.

12
00:00:42,280 --> 00:00:47,590
We're going to cover the empty five hash and the Shah One hash and it might just add another one if

13
00:00:47,590 --> 00:00:48,490
we want to.

14
00:00:48,610 --> 00:00:51,190
But the principle behind adding them is all the same.

15
00:00:51,430 --> 00:00:52,020
Right.

16
00:00:52,030 --> 00:00:57,100
So what we need to do is ready to specify the first variable that is going to store the type of hash.

17
00:00:57,160 --> 00:01:00,070
So it will simply just call it like that type of hash

18
00:01:03,770 --> 00:01:05,630
and that will be equal to the input

19
00:01:08,700 --> 00:01:10,230
and will prompt the user.

20
00:01:10,230 --> 00:01:11,370
Which type of hash

21
00:01:14,190 --> 00:01:18,310
you want to brute force.

22
00:01:19,320 --> 00:01:24,890
And let's not forget to wrap this inside of an as the order function because we want this to be a string.

23
00:01:24,900 --> 00:01:29,400
So it will simply just type right here as these are open brackets and end the end.

24
00:01:29,460 --> 00:01:32,770
We want another or second closed bracket.

25
00:01:32,780 --> 00:01:33,340
All right.

26
00:01:33,360 --> 00:01:36,410
So this is the first variable we're going to need.

27
00:01:36,420 --> 00:01:42,270
The second one will be the file path or the file that we want to use in order to brute force the hash.

28
00:01:42,330 --> 00:01:48,780
So we'll call it like this file underscore path is going to be equal equal to the string since we want

29
00:01:48,780 --> 00:01:56,550
the path to be also string and we will add input and we will specify to the user enter path

30
00:02:00,920 --> 00:02:05,480
to the file to brute force with.

31
00:02:06,710 --> 00:02:08,180
Simple as that.

32
00:02:08,180 --> 00:02:11,470
This will be a file containing all the plaintext passwords.

33
00:02:11,690 --> 00:02:15,860
If you want it can be a huge file for the purposes of this tutorial of course we are going to create

34
00:02:15,860 --> 00:02:20,150
our own file which will only store about 10 to 15 passwords.

35
00:02:20,150 --> 00:02:27,490
But in real life case scenarios you would want to use a much bigger password list with plaintext passwords.

36
00:02:27,800 --> 00:02:32,690
Also to remind you the basic meaning behind this program is really using the plaintext passwords from

37
00:02:32,690 --> 00:02:33,350
that file.

38
00:02:33,410 --> 00:02:37,980
Then we're using the hash function to create the hash value from those plaintext passwords.

39
00:02:38,060 --> 00:02:42,760
Then we will compare that hash value to the hash value that the user of this program specifies.

40
00:02:42,890 --> 00:02:47,990
And if they compare that means we found the password and we will print it in plain text.

41
00:02:47,990 --> 00:02:48,440
All right.

42
00:02:48,650 --> 00:02:50,820
So let's continue the next thing.

43
00:02:50,840 --> 00:02:55,080
And the last thing that would require is hash to decrypt.

44
00:02:55,090 --> 00:02:57,760
So we're going to call it just like that hash

45
00:03:00,850 --> 00:03:02,020
to decrypt

46
00:03:05,540 --> 00:03:10,850
and this would also be as the are we want it to be in string and then we will input

47
00:03:14,540 --> 00:03:21,150
enter hash value to brute force.

48
00:03:21,380 --> 00:03:21,760
OK.

49
00:03:21,920 --> 00:03:27,850
So now that we've got all the three parts and all the three things that we need we can start with the

50
00:03:27,850 --> 00:03:29,650
main part of the program.

51
00:03:29,650 --> 00:03:34,510
The first thing we want to do is we want to open the file that we want to read the passwords and perform

52
00:03:34,510 --> 00:03:35,570
from there.

53
00:03:35,590 --> 00:03:37,530
So let's open the file first.

54
00:03:37,540 --> 00:03:39,490
We're going to open it with open

55
00:03:42,850 --> 00:03:49,150
and we will specify that we want to open the file path and we also want to open it for reading

56
00:03:52,530 --> 00:03:58,740
we will open it as file and right away before we do anything else.

57
00:03:58,800 --> 00:04:02,780
We're going to enter the for loop and read every password line by line.

58
00:04:03,660 --> 00:04:07,320
So for line for each line inside of this pass from list

59
00:04:10,010 --> 00:04:15,520
so inside for line in file don't read lines.

60
00:04:16,100 --> 00:04:22,400
Once again remember the three lines function will read line by line while as the read line function

61
00:04:22,790 --> 00:04:30,210
will read character by character Dan once fans enter this loop we want to check out which type of hash

62
00:04:30,210 --> 00:04:30,960
it is.

63
00:04:30,990 --> 00:04:33,280
So by the way it is empty five or sharp one.

64
00:04:33,300 --> 00:04:46,260
We're going to check it with the statements so if type of hash is equal to the empty five then what

65
00:04:46,260 --> 00:04:53,190
we want to do is want to create the hash object variable and we simply want to create the empty five

66
00:04:53,190 --> 00:04:56,510
hash out of this plaintext password that we read from the file.

67
00:04:56,550 --> 00:05:05,240
So hash objects will be equal to the hash table library not empty five and we want to perform it on

68
00:05:05,380 --> 00:05:11,210
to the line that we read and we want to add this strip function to it.

69
00:05:11,210 --> 00:05:16,190
There is also one more thing or one or function that we need to add onto this plaintext password and

70
00:05:16,190 --> 00:05:18,720
that is going to be the ENCODE function.

71
00:05:19,010 --> 00:05:21,890
Without that this program will not work.

72
00:05:21,890 --> 00:05:24,320
So now that you created the hash object.

73
00:05:24,320 --> 00:05:30,650
Now we need to use the hex digest function so we'll create another variable called hashed underscore

74
00:05:30,650 --> 00:05:38,390
word and that hash the world will be equal to the hash object that hex digest

75
00:05:42,320 --> 00:05:46,760
after this inside of our hash the world will be the hash value of the plaintext passwords.

76
00:05:47,210 --> 00:05:52,700
So all we're left to do is perform another if statement in which we are going to compare this hash value

77
00:05:53,000 --> 00:05:56,650
with the hash to the crypt that the user specified.

78
00:05:56,710 --> 00:05:59,070
Okay so let's type it right here.

79
00:05:59,180 --> 00:06:04,580
You've hashed word is equal to the hash to the crypt

80
00:06:08,370 --> 00:06:10,620
then we're simply just going to print to the screen

81
00:06:14,190 --> 00:06:17,910
found and define password

82
00:06:22,050 --> 00:06:28,440
and then let's concatenate or simply just use plus to edit and of course we do not want to print the

83
00:06:28,440 --> 00:06:34,260
hashed word because this will be the hash value the one that we specified to the program itself.

84
00:06:34,380 --> 00:06:42,690
We only want to print the line which is the plaintext password for that hash so we will print plus line

85
00:06:42,970 --> 00:06:51,570
that strip and then we can simply just exit the program because we found the password and there is no

86
00:06:51,570 --> 00:06:59,070
need to actually compare the other passwords from the file as well to use the code zero which means

87
00:06:59,070 --> 00:07:05,250
the we returns without any errors and this will be the entire program for the empty five hash cracker.

88
00:07:06,180 --> 00:07:12,440
Let's test it out right here now before we do that we need to actually find an empty five hash so we're

89
00:07:12,450 --> 00:07:18,870
going to use Firefox to open up the empty five hash in crypto and we will just use some random word

90
00:07:19,140 --> 00:07:24,870
and see whether it will work while the Firefox is opening we also want to create another file which

91
00:07:24,870 --> 00:07:26,790
is going to store our passwords.

92
00:07:26,810 --> 00:07:29,710
So we are going to click on you and then you file.

93
00:07:29,900 --> 00:07:35,460
Now let's call it password file or pastoralists not the.

94
00:07:36,900 --> 00:07:45,660
And here let's type some random passwords admin once again something random then test one two three

95
00:07:45,680 --> 00:07:53,490
four let's add what my I have config it doesn't really matter what the strings are or what the passwords

96
00:07:53,490 --> 00:08:01,120
are we're just adding some random stuff and let's add password and password.

97
00:08:01,440 --> 00:08:02,170
One two three.

98
00:08:02,310 --> 00:08:02,670
OK.

99
00:08:03,070 --> 00:08:08,890
So we have the password is that the extent we have our cracker right here for the empty five all we

100
00:08:08,890 --> 00:08:16,030
need to do right now is we need to find an empty five hash so let's go and the five descriptor

101
00:08:23,370 --> 00:08:25,830
we can go to the first link it doesn't really matter.

102
00:08:25,830 --> 00:08:27,390
All of these things for the same

103
00:08:31,350 --> 00:08:34,650
OK seems that we cannot use this one so let's go to the next one

104
00:08:37,690 --> 00:08:39,800
and define the crypt and crypt

105
00:08:43,550 --> 00:08:51,780
and let's see if we type password and click on encrypt.

106
00:08:51,840 --> 00:08:55,820
Here is the empty five of the plaintext password groups.

107
00:08:55,860 --> 00:08:58,590
I actually misspelled that so I need a password.

108
00:09:05,570 --> 00:09:06,720
OK so here it is.

109
00:09:06,730 --> 00:09:10,850
This is the MDA five hash of the plaintext board password.

110
00:09:10,930 --> 00:09:11,800
Let's scope it

111
00:09:15,600 --> 00:09:17,120
go back to our program.

112
00:09:17,280 --> 00:09:24,000
If we open up the terminal and run our program so let's say Python 3.

113
00:09:24,350 --> 00:09:29,280
Cracker password which type of hash you want brute force.

114
00:09:29,280 --> 00:09:34,200
We want to brute force and end the five type of hash and the path to the file to brute force with.

115
00:09:34,200 --> 00:09:37,140
We will use password less extreme.

116
00:09:38,130 --> 00:09:42,570
And the hash value is the hard difficult ID from that website.

117
00:09:42,570 --> 00:09:48,120
Click enter and you will see in less than a second will find the correct password.

118
00:09:48,150 --> 00:09:52,080
The good thing about this program is it will run really really fast.

119
00:09:52,080 --> 00:09:58,320
Even with huge passport lists you will have no problem in completing huge pastoralists as this runs

120
00:09:58,530 --> 00:10:05,100
millions and millions passwords per second now since we are using this short pass list.

121
00:10:05,120 --> 00:10:08,570
It will always finish in less than one second.

122
00:10:08,710 --> 00:10:12,610
Okay so we found the empty five password and logo printed to the screen.

123
00:10:12,620 --> 00:10:16,630
It is password now we can build up our program a little bit more.

124
00:10:16,940 --> 00:10:19,090
Let's add another hash as a possibility.

125
00:10:19,520 --> 00:10:24,020
So we'll just going to go two steps back and we're going to compare right now.

126
00:10:24,050 --> 00:10:25,130
If type of hash

127
00:10:30,110 --> 00:10:37,460
is equal to SHA 1 for example then we'll perform the same task so hash object

128
00:10:42,930 --> 00:10:48,300
will be equal to hash later but this time we don't want to perform the five function we want to perform

129
00:10:48,550 --> 00:10:49,830
the SHA 1 function.

130
00:10:50,090 --> 00:10:53,720
Ok onto the same thing which is the line that strip

131
00:10:59,670 --> 00:11:00,290
code.

132
00:11:04,230 --> 00:11:08,610
And then we will create the hashed word which is going to be equal to hash object

133
00:11:11,180 --> 00:11:18,810
dot hex digest and after these two lines of code we have our hash value and all we need to do is compare

134
00:11:18,810 --> 00:11:21,410
it with the hash that the user specified.

135
00:11:21,600 --> 00:11:29,720
So if hash the words we already did all of this so no need to explain it twice.

136
00:11:30,530 --> 00:11:32,960
If these two are equal we'll print

137
00:11:36,470 --> 00:11:48,650
found SHA 1 password and we'll print line out strip to the screen and exit the program once again

138
00:11:51,440 --> 00:11:55,370
if it is not in this file then we're simply just going to print

139
00:12:01,570 --> 00:12:04,410
password not pin file.

140
00:12:04,800 --> 00:12:10,060
OK so we need to print this to the screen so the user of the program knows that there is not such password

141
00:12:10,120 --> 00:12:11,040
inside of the file.

142
00:12:11,050 --> 00:12:14,900
The terror using indicating that they should switch the password list.

143
00:12:14,930 --> 00:12:21,210
OK so let's test it once again but before we do that we're going to go to the SHA one right now.

144
00:12:21,370 --> 00:12:24,100
So SHA 1 and Critter

145
00:12:27,130 --> 00:12:30,670
go to the second link because it is the same thing that we use right here.

146
00:12:33,820 --> 00:12:36,930
And now let's check for some password inside of our list.

147
00:12:36,940 --> 00:12:47,280
For example I have config if we try to use Siobhan onto the IV config plaintext password we will get

148
00:12:47,320 --> 00:12:48,430
its SHA 1 hash.

149
00:12:48,450 --> 00:12:51,950
So let's copy it right here.

150
00:12:53,900 --> 00:12:58,870
Run the program.

151
00:12:59,020 --> 00:13:01,870
We need to specify that we want to use SHA 1 hash.

152
00:13:02,590 --> 00:13:09,100
We also need a specified password list that the steep and we will pay straight here the SHA one hash

153
00:13:09,160 --> 00:13:11,030
and click on enter.

154
00:13:11,500 --> 00:13:15,390
For some reason it tells us that the password is not in file.

155
00:13:16,300 --> 00:13:18,130
Well let's see why it does that.

156
00:13:19,150 --> 00:13:22,470
I have config did I specified correctly right here.

157
00:13:22,600 --> 00:13:25,850
I have config so it should be good.

158
00:13:26,020 --> 00:13:28,750
Let's try some different words such as for example.

159
00:13:28,780 --> 00:13:32,460
Test one two three four it.

160
00:13:32,520 --> 00:13:34,160
Go right here.

161
00:13:34,450 --> 00:13:35,430
Let's paste it

162
00:13:38,500 --> 00:13:40,350
here is the short one hash

163
00:13:43,780 --> 00:13:54,530
copied and run the program once again.

164
00:13:54,540 --> 00:13:55,280
SHA 1

165
00:13:59,120 --> 00:14:01,750
password list not to exceed.

166
00:14:02,630 --> 00:14:09,190
And we paste the hash Greek and enter and we do manage to find this one.

167
00:14:09,320 --> 00:14:13,820
Not really sure about what's wrong with the IV config 1 but it seems to work now.

168
00:14:13,960 --> 00:14:17,630
We found the shaman password that is test 1 2 3 4.

169
00:14:18,140 --> 00:14:19,070
Okay.

170
00:14:20,120 --> 00:14:22,020
Now let's do the same for the NDA 5.

171
00:14:22,220 --> 00:14:27,850
Let's go to the empty five site and let's try to encrypt the same password which is test 1 2 THREE 4

172
00:14:29,810 --> 00:14:33,540
whoops click on encrypt and here it is.

173
00:14:33,720 --> 00:14:38,820
And now that I think about it I think the reason why I did it for the first time is because I typed

174
00:14:39,000 --> 00:14:41,580
I have config and then enter.

175
00:14:41,580 --> 00:14:48,720
Therefore if you notice if I encrypt this this the hash value but if I encrypted without the enter

176
00:14:52,350 --> 00:14:57,210
we get the end part of the different and the hash and that is the reason why it didn't work the first

177
00:14:57,210 --> 00:14:57,670
time.

178
00:14:58,600 --> 00:15:02,490
Okay so let's go back to test 1 2 3 4 without breaking enter

179
00:15:05,980 --> 00:15:06,790
and here it is.

180
00:15:06,790 --> 00:15:20,550
Let's copy the hash value run our program again to and 5 enter the path and enter the hash click on

181
00:15:20,550 --> 00:15:24,780
enter and we found the entry 5 password test 1 2 3 4.

182
00:15:25,340 --> 00:15:25,700
Okay.

183
00:15:25,730 --> 00:15:28,210
So this is our entire project.

184
00:15:28,510 --> 00:15:35,870
We in just a few lines of code managed to create the hash cracker which will allow us to use it for

185
00:15:35,870 --> 00:15:38,690
example in case you find ESL injection.

186
00:15:38,720 --> 00:15:44,670
As we showed in the previous video we can use those hash values and drop them inside this program with

187
00:15:44,670 --> 00:15:49,880
the combination of a huge password list and gain the plaintext passwords right.

188
00:15:50,150 --> 00:15:55,070
But you can do in order to make this program better is you can simple just add all the other possible

189
00:15:55,070 --> 00:15:56,540
hashes as well.

190
00:15:56,600 --> 00:16:04,560
For example SHA 2 5 6 SHA 512 and others if you want you can use the same library which is the hash

191
00:16:04,730 --> 00:16:10,640
library and the same algorithm which is just creating the hash value and then comparing it to the hash

192
00:16:10,640 --> 00:16:15,120
of the plaintext password that you read from the file that is all there is.

193
00:16:15,140 --> 00:16:21,380
You can see it is rather easy to code and understand this program so because it was so short I will

194
00:16:21,380 --> 00:16:23,300
give you a bonus lecture in the next video.

195
00:16:23,300 --> 00:16:28,610
As I mentioned that promised which will show you how you can brute force violence networks.

196
00:16:28,630 --> 00:16:28,930
OK.

197
00:16:29,030 --> 00:16:33,200
So thank you for watching this tutorial and I will see you in the next lecture by.
