WEBVTT

00:00.960 --> 00:04.440
Okay, now that we created our program, that is working perfect.

00:04.440 --> 00:06.680
And still there is one problem.

00:08.200 --> 00:14.000
Whenever we are trying to log into something, okay, that we created that here.

00:14.000 --> 00:19.800
When I was trying to log in, I provided this username, password and everything.

00:20.640 --> 00:23.960
I logged in and then it lost the session.

00:23.960 --> 00:24.480
Okay.

00:24.520 --> 00:29.440
When we lost the session, that means we close the browser and then clear the history.

00:30.040 --> 00:31.480
So we need to handle that.

00:31.880 --> 00:36.560
And just imagine that I am trying to use this okay.

00:36.600 --> 00:39.680
This username password and everything trying to log in.

00:39.680 --> 00:44.000
And then I want to keep the being logged in okay.

00:44.040 --> 00:47.720
Not to just log out, get some data and then immediately log out.

00:47.720 --> 00:48.720
I don't want that.

00:49.200 --> 00:54.480
So to solve that in here we need to use instead of Request.get.

00:54.520 --> 00:57.160
We need to use session okay.

00:57.160 --> 00:59.720
So let's see if we can do that or not.

01:00.360 --> 01:03.860
In here I need to create a session.

01:04.140 --> 01:14.180
So let's name it session self dot session is going to be uh equal to.

01:17.100 --> 01:18.620
Uh it is going to be equal to.

01:19.020 --> 01:23.700
In here we have requests dot uh session okay.

01:27.180 --> 01:30.740
And this session because it is a part of the request.

01:30.740 --> 01:33.220
So it is it is a class okay.

01:33.260 --> 01:35.060
You see it is capital S.

01:35.060 --> 01:36.580
So that means it is a class.

01:36.580 --> 01:40.220
When I move my mouse over it it says class session.

01:40.220 --> 01:40.580
Okay.

01:40.820 --> 01:47.460
Now that I use it here, in here in this extract link I use request dot get.

01:48.020 --> 01:51.140
Now instead of using request dot get here.

01:51.420 --> 01:58.380
I can use uh, something else instead of request I can just use self dot session.

01:58.380 --> 01:59.300
Okay.

01:59.300 --> 01:59.980
So.

02:02.340 --> 02:03.840
Now what is going on here.

02:04.000 --> 02:11.400
Okay self dot session dot get and then the URL.

02:11.760 --> 02:16.760
So now it looks like uh it is better now.

02:17.520 --> 02:19.920
And in here also we need to.

02:21.960 --> 02:23.360
Handle this okay.

02:23.400 --> 02:28.440
The first thing that we want is this data dictionary.

02:29.680 --> 02:31.920
So I use data dictionary.

02:31.920 --> 02:38.240
From here I copy everything that is there and then I paste it here.

02:38.280 --> 02:40.800
You see data dictionary is equal to something like this.

02:41.400 --> 02:44.800
And also we need to change this URL okay.

02:46.640 --> 02:54.040
Then next thing that I want is the scanner okay.

02:54.080 --> 02:57.560
In here we need to add two argument okay.

02:57.960 --> 03:00.960
So I will handle that in just a moment.

03:01.640 --> 03:09.950
And here I need to use that session so I have this vulnerable wall scanner.

03:09.990 --> 03:10.390
Okay.

03:10.950 --> 03:12.470
Dot session.

03:12.790 --> 03:14.910
Dot post.

03:15.350 --> 03:17.070
I want to post something.

03:17.110 --> 03:17.550
Okay.

03:18.430 --> 03:27.270
The first thing that I want to post, uh, the first argument is the link for the login page for a website.

03:27.310 --> 03:29.030
The second one is the data.

03:29.750 --> 03:33.350
So this data is going to be equal to data dictionary.

03:34.150 --> 03:38.190
So now let's come here.

03:38.590 --> 03:46.190
And the first thing I want is this one link for this login page.

03:47.790 --> 03:49.790
So let's paste it here.

03:50.910 --> 03:56.910
And the second thing or the second option is also this one.

03:56.910 --> 03:58.790
So here I don't need to give the login.

03:58.790 --> 04:02.470
So immediately it will redirect me to that page.

04:02.710 --> 04:03.110
Okay.

04:04.250 --> 04:04.770
And.

04:06.930 --> 04:08.730
Now it is better.

04:08.770 --> 04:09.170
Okay.

04:11.210 --> 04:14.610
That this looks better, I think.

04:15.250 --> 04:22.090
Now let me save this to use Ctrl s and also this.

04:23.090 --> 04:27.290
Now let's come back here and try to see if the program is still working.

04:28.010 --> 04:32.210
And as you see right now it is working better.

04:32.250 --> 04:32.930
Okay.

04:32.970 --> 04:38.610
It is logged in and it's giving me all and everything that is inside that web page.

04:39.250 --> 04:41.610
And these all are inside the page.

04:41.650 --> 04:41.890
Okay.

04:41.930 --> 04:43.890
And you see that at the end.

04:44.050 --> 04:46.650
It is it has the log out still.

04:46.650 --> 04:47.130
It is.

04:47.250 --> 04:53.050
When I have this in my list, that means I am logged out of that web page still.

04:53.370 --> 04:55.810
So we need to handle that as well.

04:55.850 --> 04:56.690
Okay.

04:56.730 --> 04:58.170
What does that mean?

04:58.330 --> 04:59.330
Maybe you didn't understand.

04:59.330 --> 05:00.010
Let me explain.

05:00.050 --> 05:01.010
Okay.

05:01.050 --> 05:02.970
We have the log out dot PHP.

05:03.010 --> 05:06.710
Log out dot PHP means that I logged out.

05:06.870 --> 05:07.270
Okay.

05:07.310 --> 05:11.230
And, uh, right now I am at this page.

05:11.830 --> 05:15.830
So in here, if I check in here, I have maybe only 1 or 2 links.

05:16.390 --> 05:21.230
And when we logged in, you see, inside the page, we have a lot of links.

05:21.590 --> 05:22.710
You see that here.

05:23.310 --> 05:26.350
And then at the end it logs me out back.

05:26.630 --> 05:30.470
So because we have this link, it logged me out of that website.

05:30.870 --> 05:34.510
So we need to handle that too.

05:34.550 --> 05:35.590
How can I handle that.

05:35.630 --> 05:40.030
I can create a list to ignore this kind of link or this link.

05:40.350 --> 05:45.310
So in here I'm going to create a list.

05:45.310 --> 05:51.870
I'm going to name it link to what link to ignore.

05:51.870 --> 05:53.910
It is going to be equal to a list.

05:54.110 --> 05:56.750
So this list is going to be.

05:58.990 --> 06:00.510
That list that we have.

06:00.550 --> 06:01.190
Okay.

06:01.230 --> 06:02.990
The log out.

06:03.030 --> 06:05.070
Let me copy that.

06:05.070 --> 06:07.030
From here we have it.

06:11.290 --> 06:11.810
Okay.

06:12.090 --> 06:14.210
Copy selection.

06:15.570 --> 06:23.730
And now, instead of this that I just copied, I'm going to copy this logout dot php.

06:23.770 --> 06:27.050
Now I have this and I need to use this.

06:27.090 --> 06:27.490
Okay.

06:28.250 --> 06:29.490
We are going to use this.

06:29.890 --> 06:33.930
I can use it as an argument in my class.

06:34.170 --> 06:36.930
So here you see we have a target URL.

06:37.490 --> 06:40.490
And in here I'm going to add another thing.

06:40.490 --> 06:43.450
And that is going to be link to ignore.

06:43.610 --> 06:44.250
Okay.

06:44.290 --> 06:49.970
So when I add this here that means the class get two argument.

06:50.170 --> 06:57.690
So when the class get two argument that means in here into init method or init function or the constructor

06:57.690 --> 07:00.810
we need to handle this two okay.

07:00.850 --> 07:04.290
So here you see right now it is asking only for one argument.

07:04.290 --> 07:06.450
And that is the URL that.

07:06.450 --> 07:09.310
Now I need to add another one.

07:09.310 --> 07:11.910
So let's name it ignore.

07:14.270 --> 07:14.750
Links.

07:14.790 --> 07:15.190
Okay.

07:17.670 --> 07:34.310
And also down here I'm going to tell it the self dot we had link to ignore is going to be equal to ignore

07:34.350 --> 07:34.870
links.

07:35.150 --> 07:37.790
That is something we have up here.

07:37.830 --> 07:39.230
Okay.

07:39.270 --> 07:40.990
And now I save this.

07:40.990 --> 07:52.110
And also somewhere inside this method I am checking if url in link and link not in the target link.

07:53.070 --> 07:54.430
Do something okay.

07:57.030 --> 08:00.910
And in here I'm going to check that too.

08:00.950 --> 08:11.700
So I use and here and the link that is That that we are capturing, that we're extracting.

08:11.700 --> 08:12.100
Okay.

08:13.460 --> 08:15.580
And link.

08:16.420 --> 08:18.460
Not in.

08:19.820 --> 08:20.620
In what?

08:23.020 --> 08:24.940
In link to ignore.

08:24.980 --> 08:25.340
Okay.

08:25.700 --> 08:28.900
Self dot link to ignore.

08:29.260 --> 08:36.060
So right now it is a very big and beautiful condition here that is checking.

08:36.060 --> 08:39.140
And then it is returning me the link okay.

08:39.900 --> 08:41.620
And then printing all the link.

08:41.620 --> 08:45.060
But it is ignoring the link to ignore.

08:45.500 --> 08:49.780
You see we have the link to ignore here that is here.

08:49.940 --> 08:50.700
So right now it is.

08:50.740 --> 08:53.980
It will ignore that and it will not get that.

08:53.980 --> 09:01.260
So that means we need to ignore that we are logged in and we are not logged out of something that we

09:01.300 --> 09:02.420
are logged in.

09:02.420 --> 09:06.980
So let's re-execute this program and see this time what happened.

09:06.980 --> 09:12.240
So this time you see before we had logout dot php here.

09:12.800 --> 09:16.440
But now in this time we only have about dot php.

09:16.480 --> 09:18.680
Instead of logout we have nothing.

09:18.720 --> 09:26.200
Okay, so that means now we are logged in and this thing is ignored.

09:26.400 --> 09:31.360
Okay, we're not logged out of the class of the website.

09:31.400 --> 09:31.680
All right.

09:31.680 --> 09:32.240
Excuse me.

09:32.600 --> 09:36.600
So here you see we have the username provided we have the password provided.

09:36.600 --> 09:40.280
And then we have the submit button clicked.

09:40.320 --> 09:44.760
And then after we are logged in then we have the session.

09:46.120 --> 09:48.520
And then the data had been sent.

09:49.080 --> 09:50.800
And then we call this method.

09:50.880 --> 09:53.920
The method is in here.

09:53.920 --> 09:55.120
It happens here.

09:55.120 --> 09:57.800
And then it ignore that link to ignore.

09:57.800 --> 10:03.160
And then it gives me all the link that it capture and that is it.

10:03.240 --> 10:10.440
So thanks for watching and I will see you in the next lecture to improve this to get something very,

10:10.440 --> 10:11.400
very useful.
