1
00:00:00,600 --> 00:00:01,650
Welcome back.

2
00:00:01,680 --> 00:00:05,310
Let's wrap up our program and run it for a test.

3
00:00:05,310 --> 00:00:09,290
So there are a few things that we actually need to finish before we do that.

4
00:00:09,450 --> 00:00:13,590
From now on we got the main part of the program ready which is the connect function.

5
00:00:13,590 --> 00:00:19,530
We used up all of these four libraries and we are just now going to use the term color library as well.

6
00:00:19,530 --> 00:00:25,980
And we also managed to open the file with the password from the file and now we need to compare the

7
00:00:25,980 --> 00:00:33,180
actual code that we return from the response and see whether that password is correct or not.

8
00:00:33,180 --> 00:00:33,690
All right.

9
00:00:33,720 --> 00:00:39,270
So the last line is us in the code and storing it in the response variable.

10
00:00:39,270 --> 00:00:41,690
So let's think about what we need to do after it.

11
00:00:41,970 --> 00:00:46,930
Well we need to compare the actual response with 0 1 and 2.

12
00:00:47,070 --> 00:00:48,770
Simple as that.

13
00:00:48,780 --> 00:00:50,270
So in the statement.

14
00:00:50,300 --> 00:00:55,620
Well first of all going to compare if response equals equals zero.

15
00:00:55,620 --> 00:01:03,060
That means let's check it out first but zero means well since zero is a parameter that is already set

16
00:01:03,060 --> 00:01:07,830
by default or decode this parameter that is already set by default to be equal to zero.

17
00:01:08,460 --> 00:01:11,330
And we do not change it if we manage to connect.

18
00:01:11,340 --> 00:01:14,250
That means that zero equals successful connection.

19
00:01:14,790 --> 00:01:17,100
So we are going to print found password

20
00:01:21,130 --> 00:01:22,380
Let's print it like this.

21
00:01:22,410 --> 00:01:30,830
So inside we are going to add a plus sign found password to dots.

22
00:01:30,860 --> 00:01:35,520
And then let's add these passwords as a string.

23
00:01:35,520 --> 00:01:42,630
And let's also add four which account we managed to find the passwords of for account.

24
00:01:42,630 --> 00:01:46,200
And then let's also add plus user name.

25
00:01:46,260 --> 00:01:47,450
All right.

26
00:01:47,490 --> 00:01:53,610
And let me just move this a little bit to the side so everything fit inside of our screen.

27
00:01:53,610 --> 00:01:59,010
And now there is the part where we can use the term card library and what the term color library allows

28
00:01:59,010 --> 00:02:03,150
us to do is to print the statements in different colors.

29
00:02:03,150 --> 00:02:07,500
That's what I meant when I mentioned that it is not needed inside of this program but it will make it

30
00:02:07,500 --> 00:02:14,370
look a little bit prettier so inside of the print statement we're going to define term color and then

31
00:02:14,370 --> 00:02:22,770
dot colored which is the actual function that we need to use open up two brackets right here and in

32
00:02:22,770 --> 00:02:29,070
the first bracket we're going to type the actual print statement which is this thing that does good

33
00:02:29,120 --> 00:02:36,730
decide so here we call the first bracket then we need to add the comma and in between the single quotes

34
00:02:36,730 --> 00:02:39,580
here we specify in which color we want to print.

35
00:02:39,580 --> 00:02:44,230
Let's say we want to print in green color as we successfully managed to connect.

36
00:02:44,230 --> 00:02:45,190
So it will be green.

37
00:02:45,580 --> 00:02:50,900
And then we need to close the first bracket which is going to be the brackets to the term color function.

38
00:02:50,950 --> 00:02:55,820
And now the second bracket which is going to be the bracket to the print statement.

39
00:02:56,200 --> 00:03:02,740
So let's check if we have the right amount of brackets one bracket to bracket three brackets and three

40
00:03:02,950 --> 00:03:03,910
close brackets.

41
00:03:03,910 --> 00:03:04,320
All right.

42
00:03:04,330 --> 00:03:06,510
So everything seems to be good.

43
00:03:06,670 --> 00:03:08,820
Now let's go down here.

44
00:03:08,950 --> 00:03:13,090
If we manage to find the password let me just move this so we can see in part code

45
00:03:19,760 --> 00:03:25,880
if we manage to find the password then we can break out of this program since we don't really need to

46
00:03:26,240 --> 00:03:33,200
test anymore we've managed to find it in case we don't manage which will be the else if statement or

47
00:03:33,290 --> 00:03:43,430
else if response equals equals one then we will simply just print incorrect log in and we're going to

48
00:03:43,430 --> 00:03:48,200
add the password so we can see which password is incorrect.

49
00:03:48,200 --> 00:03:58,360
And the last case which is if the response is equal to two then we're going to print simply just let's

50
00:03:58,370 --> 00:04:05,290
print like this and let's print can't connect as an error.

51
00:04:05,300 --> 00:04:10,940
So we didn't manage to connect possibly the target is off line and after it we want to see its exit

52
00:04:10,940 --> 00:04:13,430
the program since we didn't manage to connect.

53
00:04:13,430 --> 00:04:15,820
There is nothing really more to test right here.

54
00:04:15,920 --> 00:04:22,850
And after it as the accept statement we want to print any other exception in case there is some exception

55
00:04:22,850 --> 00:04:27,730
that we didn't cover such as connection Wrong password or didn't manage to connect.

56
00:04:27,740 --> 00:04:29,120
We want to print it right here.

57
00:04:29,120 --> 00:04:41,450
So except Exception as e we want to print that exception so print it and then we can pass since this

58
00:04:41,480 --> 00:04:44,490
actual exception can occur only in one password.

59
00:04:44,570 --> 00:04:47,160
Therefore we don't really want to break out of the program.

60
00:04:47,240 --> 00:04:51,830
We want to print that exception and possibly go on to the next password.

61
00:04:52,100 --> 00:04:54,590
Okay so this is the entire program.

62
00:04:54,590 --> 00:04:57,440
Let's see if there is anything that we didn't code.

63
00:04:57,500 --> 00:05:00,130
Let's delete this empty space right here.

64
00:05:00,170 --> 00:05:03,470
We used up all the libraries imported.

65
00:05:03,500 --> 00:05:06,910
This is the part of the program where we check for the password.

66
00:05:07,130 --> 00:05:10,370
And this is the actual connection part of the program.

67
00:05:10,370 --> 00:05:12,190
All right so let's test it up.

68
00:05:12,260 --> 00:05:18,740
We're going to open up our terminal and large everything so we can see it better.

69
00:05:18,770 --> 00:05:23,480
And before we actually test it you might notice that we're missing one thing and that thing is going

70
00:05:23,480 --> 00:05:25,520
to be the passwords list.

71
00:05:25,520 --> 00:05:31,370
Now once again for this for the purposes of this trial I'm going to create a small password list with

72
00:05:31,490 --> 00:05:33,200
around 10 passwords.

73
00:05:33,200 --> 00:05:38,630
But if you were to perform our real life attack you would actually use a lot bigger passwords with possibly

74
00:05:38,630 --> 00:05:43,910
tens of thousands or hundreds of thousand passwords and see which one is correct.

75
00:05:44,090 --> 00:05:49,040
If you manage to find it now of course in the bonus videos I will leave a video where I will show you

76
00:05:49,340 --> 00:05:53,700
where you can actually download some of the bigger password lists that are used for real life attacks.

77
00:05:53,750 --> 00:05:58,190
But right now we're going to test it on a small password list that we're going to create.

78
00:05:58,190 --> 00:06:00,140
So let's go right here right click

79
00:06:03,470 --> 00:06:07,340
whoops right click right here new and we want.

80
00:06:07,430 --> 00:06:08,900
Well we don't want that.

81
00:06:08,900 --> 00:06:16,300
We want to go once again the new new file just a regular file and let's call it passwords not the extreme.

82
00:06:17,290 --> 00:06:25,560
And let's add some random passwords such as for example Hello World One two three five four three two

83
00:06:25,560 --> 00:06:27,300
one password.

84
00:06:27,300 --> 00:06:29,670
One two three.

85
00:06:29,790 --> 00:06:36,370
Let's type in another password test for 3 2 1.

86
00:06:36,890 --> 00:06:41,810
Let's add real password like now so we can see whether it works which is MSF admin.

87
00:06:42,170 --> 00:06:44,210
Now let's add two more passwords.

88
00:06:44,390 --> 00:06:46,580
So rude and rude.

89
00:06:46,580 --> 00:06:47,270
One two three.

90
00:06:47,300 --> 00:06:48,170
Why not.

91
00:06:48,170 --> 00:06:50,720
So we have around nine passwords.

92
00:06:50,740 --> 00:06:52,990
So let's add one more so we can circle it to ten.

93
00:06:52,990 --> 00:06:56,330
One two three four five six seven eight nine.

94
00:06:56,450 --> 00:06:58,690
And this is our password list.

95
00:06:58,730 --> 00:06:59,080
All right.

96
00:06:59,090 --> 00:07:01,100
So let's test our program.

97
00:07:01,100 --> 00:07:02,660
We have our terminal open.

98
00:07:03,560 --> 00:07:05,480
We zoomed everything in.

99
00:07:05,480 --> 00:07:06,980
Now let's go to the pie chart.

100
00:07:07,640 --> 00:07:10,150
Let's go to the stage.

101
00:07:10,160 --> 00:07:17,750
Brute force and right here we want to run DSH brought up to be why so Python 3 as sage brought dot P.

102
00:07:17,770 --> 00:07:21,270
why we have somewhere invalid syntax.

103
00:07:21,290 --> 00:07:24,140
Let's see where that is filed the treat lines.

104
00:07:24,140 --> 00:07:30,050
This is somewhere down here for line in files or treat lines and at the end of the fourth statement

105
00:07:30,080 --> 00:07:32,380
we need to specify two dots.

106
00:07:32,420 --> 00:07:34,130
Therefore this didn't work.

107
00:07:34,130 --> 00:07:42,060
Let's test it once again target address will specify one and to that 168 at 1 3.

108
00:07:42,110 --> 00:07:49,160
And once again in order to check out the IP address of your target machine you simply just type II config

109
00:07:49,820 --> 00:07:55,030
inside of your mouth to split the ball and you will get the net address right here which is why I add

110
00:07:55,060 --> 00:07:56,980
to that 168 at 1 to 3.

111
00:07:56,990 --> 00:08:02,450
In my case in your case it will most likely be something different so don't specify the same thing right

112
00:08:02,450 --> 00:08:02,780
here.

113
00:08:03,030 --> 00:08:03,310
Okay.

114
00:08:03,350 --> 00:08:09,190
So now that specify this press enter the yes say choose name for deemed suitable is MSF Herdman.

115
00:08:09,290 --> 00:08:15,920
Now you can perform this attack if you want to practice after this on our route account on matters potable

116
00:08:16,280 --> 00:08:21,490
with a big password list that you can download online and see whether you can corrective food as say

117
00:08:21,480 --> 00:08:29,570
to count on them at disputable so and user name MSF admin and password file will be passwords not the

118
00:08:29,570 --> 00:08:34,230
extreme press you enter and let's see whether this will work.

119
00:08:34,310 --> 00:08:37,670
As you can see first password is incorrect.

120
00:08:37,670 --> 00:08:41,290
Second password incorrect third and fourth are also incorrect.

121
00:08:41,810 --> 00:08:49,200
And let's see what happens once we get to the MSF admin and here it is found password MSF admin for

122
00:08:49,200 --> 00:08:56,820
account MSF admin then it exited out of the program because there is no point in testing out other passwords.

123
00:08:56,820 --> 00:09:04,500
So all we need to do in order to fix this so it can look a little bit prettier is we want to print right

124
00:09:04,500 --> 00:09:08,700
here right after the input file.

125
00:09:08,710 --> 00:09:14,410
We want to print the new line characters so we can differentiate the input parameters that we specify

126
00:09:14,410 --> 00:09:22,560
from the actual passwords that it tests so print backslash and let's run it once again right here clear

127
00:09:24,180 --> 00:09:32,550
one night to that 168 at fund 3 MSF admin and passwords not the step.

128
00:09:32,560 --> 00:09:33,220
Here it is.

129
00:09:33,220 --> 00:09:38,930
New Line character is there and it will perform the exact same task as it did previously.

130
00:09:38,950 --> 00:09:44,290
Now you might notice that this is going a little bit slow and that is something that we will fix in

131
00:09:44,290 --> 00:09:50,500
the next video as we're going to see how we can import threading library inside of this program to make

132
00:09:50,500 --> 00:09:55,960
it brute force the passwords faster because in real life attacks if you for example had one hundred

133
00:09:55,970 --> 00:10:02,140
thousand passwords this would take a long time to actually brute force and you don't really want to

134
00:10:02,140 --> 00:10:08,820
sit for a week waiting for a 100000 passwords to finish you want to finish it as fast as possible.

135
00:10:08,890 --> 00:10:11,560
So we're going to take a look at that in directorial.

136
00:10:11,560 --> 00:10:16,960
I hope you enjoyed this one and I will see you in the threading part of this section.

137
00:10:16,960 --> 00:10:17,690
Take care.

138
00:10:17,710 --> 00:10:17,980
Bye.
