WEBVTT

00:00.760 --> 00:02.080
Okay.

00:02.120 --> 00:03.880
Uh, we have this web page.

00:04.800 --> 00:08.000
And in previous lecture, you learned what is a Get method?

00:08.000 --> 00:09.200
What is a post method?

00:09.200 --> 00:10.720
Which one is more secure?

00:11.520 --> 00:21.080
And here in this lecture we are going to start extracting forms create a vulnerability scanner okay.

00:21.120 --> 00:23.440
So here we have this web page.

00:24.000 --> 00:26.720
Let me go to source code.

00:26.760 --> 00:28.600
So you see what do we have here.

00:29.840 --> 00:32.680
In here we have a form okay.

00:35.880 --> 00:38.840
And inside form we have an input to input.

00:38.840 --> 00:40.360
One of them is input type text.

00:40.360 --> 00:42.120
Maybe the next one is a button.

00:42.960 --> 00:49.680
So here if I use inspect you will see that we are inside here.

00:49.680 --> 00:51.000
You see we have an input.

00:51.000 --> 00:51.720
It has an ID.

00:51.760 --> 00:53.160
It has type is text.

00:53.160 --> 00:56.840
It has a name and it has a size.

00:58.640 --> 01:05.200
And So whenever we're trying to send this ad to URL.

01:05.200 --> 01:06.520
So we use get method.

01:06.520 --> 01:10.880
If you're going to send this to a form we use post method.

01:10.880 --> 01:15.080
So here maybe it is post or maybe get no problem if it is form.

01:15.120 --> 01:16.240
Of course it is form.

01:16.240 --> 01:20.200
You see that it is a form and it starts from here.

01:21.000 --> 01:22.040
It has an action.

01:22.240 --> 01:30.280
Action is equal to index dot php and page is equal to DNS lookup dot PHP.

01:31.880 --> 01:33.280
So method is post.

01:33.320 --> 01:41.040
That means here it is used post and we are going to send data to post.

01:43.800 --> 01:47.600
So we are going to use a module called request.

01:47.640 --> 01:50.680
You know already we learned something about request.

01:50.680 --> 01:52.800
And also in here.

01:52.800 --> 01:59.040
Now we are going to learn to use another module called Beautifulsoup okay.

01:59.130 --> 01:59.890
B is for.

02:00.850 --> 02:04.050
So let's go and start creating this.

02:04.050 --> 02:09.010
The first thing we need to import is requests.

02:09.050 --> 02:09.730
Okay.

02:09.770 --> 02:12.130
So now I have the request.

02:12.130 --> 02:14.850
Let's create that function that we have.

02:14.970 --> 02:17.090
It was I think request.

02:17.970 --> 02:20.130
It was asking for a URL.

02:21.410 --> 02:32.530
And we are going to let's just create the same thing that we just we were just using.

02:32.530 --> 02:34.730
Okay I'm going to use try an exception here.

02:35.130 --> 02:39.970
Try in here it is going to return a requests dot get.

02:40.010 --> 02:45.330
Then I will give the URL and then in exit part.

02:48.610 --> 02:55.690
Uh actually in except it is going to be a specific except for a specific exception.

02:55.690 --> 03:04.490
It is going to be request dot exception, but I think it was connection error.

03:06.410 --> 03:06.890
Okay.

03:07.330 --> 03:11.730
Now, if something like this happened, we need to pass.

03:11.770 --> 03:12.130
Okay.

03:12.730 --> 03:13.130
Good.

03:13.530 --> 03:22.250
Now, if I want to create a if I want to access that web page.

03:22.250 --> 03:29.810
So we need to create something called let's create this by the name of target underscore URL.

03:29.850 --> 03:31.410
It is going to be equal to.

03:31.970 --> 03:34.050
Then the URL is going to be right here.

03:34.490 --> 03:42.810
Let me copy this from here and then paste that URL in this variable.

03:43.170 --> 03:46.370
Now we have this variable here and we can use it.

03:46.410 --> 03:46.850
Okay.

03:47.770 --> 03:51.010
So let's create another variable is going to be response.

03:52.090 --> 04:01.410
The response is equal to request which is the method that we And we are going to give the target URL.

04:02.090 --> 04:05.170
If I now print just the response.

04:07.770 --> 04:08.250
Okay.

04:08.450 --> 04:10.850
The response dot content.

04:12.330 --> 04:13.650
And save this.

04:13.770 --> 04:18.930
Now if I move to this location see the document.

04:21.890 --> 04:25.170
And it is I think.

04:27.610 --> 04:27.850
Yeah.

04:31.090 --> 04:33.610
Let's enter here use LRS.

04:34.530 --> 04:39.010
You see we have something called vulnerability scanner.

04:39.050 --> 04:39.330
So.

04:41.690 --> 04:43.650
Move here and then use LRS.

04:43.690 --> 04:45.050
We have to extract form.

04:45.090 --> 04:45.730
Okay.

04:45.770 --> 04:50.210
Let's use Python extract form and hit enter.

04:50.250 --> 04:51.730
Just a moment.

04:51.770 --> 04:55.450
Now you see that it extracted everything that is in this location.

04:55.450 --> 04:56.610
So it is not what we want.

04:56.650 --> 04:59.140
I want to just extract the forms.

04:59.180 --> 04:59.580
Okay.

04:59.620 --> 05:00.500
Not everything.

05:01.060 --> 05:08.500
So here we are going to use another module that is called a beautifulsoup.

05:08.540 --> 05:09.380
Okay.

05:09.380 --> 05:17.940
So from this or I think import Beautifulsoup.

05:23.540 --> 05:27.940
From is going to be from not form.

05:28.460 --> 05:32.420
B is for import beautiful soup.

05:34.340 --> 05:35.020
Mm.

05:38.140 --> 05:38.500
Okay.

05:39.340 --> 05:41.500
Now we have our beautiful soup here.

05:41.820 --> 05:42.740
Import it.

05:42.780 --> 05:43.220
Okay.

05:43.780 --> 05:49.940
And now let's try to extract the form that we have in this URL.

05:50.180 --> 05:56.020
So I'm going to create a variable named HTML.

05:56.220 --> 05:58.020
It is going to be equal to.

05:58.580 --> 06:05.860
We have imported Beautifulsoup, so I am going to just use this beautifulsoup here.

06:05.860 --> 06:10.300
And then we have the response dot content.

06:11.460 --> 06:11.740
Okay.

06:11.780 --> 06:14.980
We are storing this into parsed HTML.

06:15.460 --> 06:20.980
So let's use form I have the form list.

06:20.980 --> 06:31.900
It is going to be equal to our HTML that we have it at in line 13 dot find all.

06:35.620 --> 06:36.060
Okay.

06:36.860 --> 06:40.420
And in here we are going to give any tag we want.

06:40.500 --> 06:44.380
So the tag that we want is form.

06:44.380 --> 06:47.660
So now if I print.

06:49.780 --> 07:02.350
The form list and save this then I go back to my terminal, use kill layer here and try to execute this

07:02.350 --> 07:03.150
once again.

07:03.510 --> 07:07.470
Now you will see that it only gives me the form.

07:07.510 --> 07:12.870
Okay, uh, you see, it ends with form.

07:14.070 --> 07:16.750
And soon we will have something like this.

07:17.350 --> 07:18.990
And it starts from here.

07:19.310 --> 07:21.710
It ends right in here.

07:23.670 --> 07:27.910
Now you see that it is a list and it contains a form.

07:28.070 --> 07:28.750
Okay.

07:28.790 --> 07:34.550
And inside this form, we have a lot of we have a lot of things like, uh, all the input like this

07:34.550 --> 07:35.670
input that we have.

07:36.350 --> 07:37.830
It is one of the input okay.

07:37.870 --> 07:41.470
And also we have another input that is the button here.

07:41.950 --> 07:48.070
Now we can analyze analyze this to get exactly what we want.

07:48.110 --> 07:48.950
Okay.

07:49.070 --> 07:51.590
Let's go and see that how we can do that.

07:51.830 --> 07:53.030
In the previous lecture.

07:53.750 --> 07:53.910
Sorry.

07:53.950 --> 07:55.030
In the next lecture.
