1
00:00:00,630 --> 00:00:01,750
Welcome back.

2
00:00:01,770 --> 00:00:07,350
This is our third tutorial to our passport for sniffer and you might notice that I added something right

3
00:00:07,350 --> 00:00:09,800
here that we didn't have in the previous video.

4
00:00:10,110 --> 00:00:12,020
And those are these two lists.

5
00:00:12,210 --> 00:00:16,560
So I added the user's fields and the passports fields.

6
00:00:16,920 --> 00:00:22,650
These two lists are going to help us to find for the usernames and passwords inside of the body that

7
00:00:22,650 --> 00:00:25,150
we paste to this function.

8
00:00:25,150 --> 00:00:29,010
So right here now that I mentioned body I'll paste it straight away.

9
00:00:29,020 --> 00:00:33,750
Since in our packet parser function we do call it as a parameter.

10
00:00:33,750 --> 00:00:34,690
All right.

11
00:00:34,950 --> 00:00:41,410
So we're going to check for each and every element from this list if it is located inside of this body.

12
00:00:41,460 --> 00:00:45,840
And if it is we're going to print the user name and the password.

13
00:00:45,840 --> 00:00:49,770
Now for you you don't really have to type all of this if you don't want.

14
00:00:49,860 --> 00:00:56,190
You can go to the resources of this project or at the end of the section and download this program and

15
00:00:56,190 --> 00:00:59,150
simply just copy and paste these two fields.

16
00:00:59,160 --> 00:01:00,660
All right.

17
00:01:00,660 --> 00:01:06,330
So let's get straight into the coding now that we have these two fields for all the possible names for

18
00:01:06,330 --> 00:01:08,340
the usernames and passwords.

19
00:01:08,490 --> 00:01:12,540
What we can do is we can iterate over each and every element.

20
00:01:12,600 --> 00:01:16,980
For example let's go over the user fields first.

21
00:01:16,980 --> 00:01:20,250
So for logging in user fields

22
00:01:23,020 --> 00:01:31,030
we can simply just do what we're going to do right here is we're going to use projects in order to extract

23
00:01:31,030 --> 00:01:32,610
the user names.

24
00:01:32,620 --> 00:01:35,950
Now I will first type it right here and then I will explain it to you.

25
00:01:36,340 --> 00:01:42,790
So I'll create a variable called log in underscore our standing for regex and I'm going to call the

26
00:01:42,790 --> 00:01:47,600
register library with this search function in that function.

27
00:01:47,600 --> 00:01:49,450
I'm going to specify the pattern

28
00:01:52,620 --> 00:02:03,760
which will be percent S equals open square brackets close square brackets upper sign.

29
00:02:04,320 --> 00:02:05,760
Then this sign right here.

30
00:02:05,760 --> 00:02:07,300
Not really sure how it is called.

31
00:02:07,320 --> 00:02:10,590
And then at the end we specify a plus.

32
00:02:10,600 --> 00:02:10,890
Okay.

33
00:02:10,890 --> 00:02:16,230
So this is our pattern and wait for just a second that will explain it.

34
00:02:16,230 --> 00:02:17,020
We then type.

35
00:02:17,020 --> 00:02:26,520
Percent log in and then comma body and then comma R E dot ignore.

36
00:02:26,610 --> 00:02:27,780
Case.

37
00:02:27,850 --> 00:02:28,260
Okay.

38
00:02:28,440 --> 00:02:32,040
So before we continue I need to explain this line a little bit better.

39
00:02:32,850 --> 00:02:37,790
So what we're doing right here is we're creating log in that our E object.

40
00:02:37,980 --> 00:02:41,730
Now we're calling the R E library which is the regex library.

41
00:02:41,730 --> 00:02:44,730
And on this library we are calling this search function.

42
00:02:44,730 --> 00:02:50,060
But this search function does is it takes a pattern that we specify which is this right here.

43
00:02:50,130 --> 00:02:52,350
And to explain this pattern you really need to know regex.

44
00:02:52,350 --> 00:02:54,870
So if you don't know it that's great.

45
00:02:54,870 --> 00:03:00,690
If you don't know it well then I believe some resources in the description so you can get more familiar

46
00:03:00,900 --> 00:03:03,290
with projects and its patrons.

47
00:03:03,420 --> 00:03:10,380
Well basically this is is the pattern which we are going to use in order to try to get the user names.

48
00:03:10,430 --> 00:03:15,050
The second parameter to this function is the body and body simply means.

49
00:03:15,110 --> 00:03:16,990
Where are we going to search for the user name.

50
00:03:16,990 --> 00:03:19,490
So we are searching the user names in body.

51
00:03:19,490 --> 00:03:24,940
And the last parameter which is ignore it simply means that we don't care about the uppercase and lowercase

52
00:03:25,040 --> 00:03:25,820
letters.

53
00:03:25,840 --> 00:03:26,210
OK.

54
00:03:26,960 --> 00:03:33,290
Now this pattern right here this percent since that is the first thing will get replaced with the log

55
00:03:33,290 --> 00:03:40,110
in and keep in mind the log in is the trouble and it will be each and every of these elements.

56
00:03:40,130 --> 00:03:48,140
So for this example let's take this element but we are looking for is something like user name equals

57
00:03:48,710 --> 00:03:50,890
and then something right here.

58
00:03:51,050 --> 00:03:54,980
This pattern simply specifies something like this.

59
00:03:54,980 --> 00:04:00,500
If we find this inside of a body that means that we successfully found the user name and we're going

60
00:04:00,500 --> 00:04:02,540
to print this to the screen.

61
00:04:03,350 --> 00:04:03,700
OK.

62
00:04:04,010 --> 00:04:11,210
So let's delete this now that we got that out of the way we now need to check whether there is anything

63
00:04:11,210 --> 00:04:13,690
stored inside of this log in.

64
00:04:13,980 --> 00:04:16,100
Since if there is that means we found the user name.

65
00:04:16,100 --> 00:04:24,380
So if logging underscore our E then our user variable which we created at the beginning of the problem

66
00:04:24,440 --> 00:04:34,700
and set the value of None to it is going to be equal to logging underscore our E dot group and group

67
00:04:35,000 --> 00:04:39,020
are just the results that we got from this function right here.

68
00:04:39,020 --> 00:04:43,640
Therefore it will simply just store the user name inside of this variable.

69
00:04:43,650 --> 00:04:44,230
All right.

70
00:04:44,250 --> 00:04:47,530
So the same thing we need to perform 40 passwords as well.

71
00:04:48,050 --> 00:04:54,870
So let's go right here for pass field in past fields

72
00:04:58,020 --> 00:05:04,260
we're going to create an object once again called Pass underscore our E and we perform the exact same

73
00:05:04,260 --> 00:05:14,270
thing so I'm going to copy this so we don't have to type it twice and paste it right here while not

74
00:05:14,330 --> 00:05:14,800
there.

75
00:05:14,900 --> 00:05:16,670
We don't want there we want it here.

76
00:05:16,720 --> 00:05:17,020
Okay.

77
00:05:17,030 --> 00:05:17,460
Good.

78
00:05:19,460 --> 00:05:22,160
Now the pattern right here will remain the same.

79
00:05:22,190 --> 00:05:28,910
As for the user names just in our case what we are searching for is something like this password equals

80
00:05:29,360 --> 00:05:31,330
and then random password.

81
00:05:31,340 --> 00:05:31,690
Okay.

82
00:05:32,420 --> 00:05:34,170
So let's delete this.

83
00:05:34,430 --> 00:05:41,660
And in order to actually search for a password we need to replace this log in with past field since

84
00:05:41,660 --> 00:05:50,000
we are iterating right now over the second list which is the possible names for the password field.

85
00:05:50,720 --> 00:05:52,170
All of this will remain the same.

86
00:05:52,310 --> 00:05:55,270
And now we need to check whether we got this.

87
00:05:55,280 --> 00:06:05,870
So if if past underscore our E then we're going to store in our past WD variable which is once again

88
00:06:06,050 --> 00:06:09,630
at the beginning of this function and set to None.

89
00:06:09,920 --> 00:06:14,600
We will store Sanders core ar e dot group.

90
00:06:16,000 --> 00:06:16,520
OK.

91
00:06:16,520 --> 00:06:16,900
Good.

92
00:06:17,840 --> 00:06:22,970
And now at the end we need to return these two values.

93
00:06:22,970 --> 00:06:32,320
So we will specify if user and password will return both user name and password.

94
00:06:34,480 --> 00:06:35,120
All right.

95
00:06:35,180 --> 00:06:38,930
So this is the entire get log in pass function.

96
00:06:39,140 --> 00:06:44,000
And now we are ready to go back to our PAC parser function.

97
00:06:44,000 --> 00:06:50,210
Now before we close this video I'm going to just select the user name karma password to be equal to

98
00:06:50,210 --> 00:06:57,400
get log in pass with the body as a parameter since we are returning the two values from this function.

99
00:06:57,530 --> 00:07:01,840
Therefore we need to set those two values inside of these two values.

100
00:07:01,940 --> 00:07:07,280
User will be set inside of a username and password will be set inside of a password.

101
00:07:07,340 --> 00:07:13,350
So in the next video we're going to wrap up our program and we're going to go for a first test of it.

102
00:07:13,430 --> 00:07:13,820
Right.

103
00:07:13,910 --> 00:07:18,590
So thank you for watching this trial and I will see you in the next lecture by.
