Okay.
Uh, we have this web page.
And in previous lecture, you learned what is a Get method?
What is a post method?
Which one is more secure?
And here in this lecture we are going to start extracting forms create a vulnerability scanner okay.
So here we have this web page.
Let me go to source code.
So you see what do we have here.
In here we have a form okay.
And inside form we have an input to input.
One of them is input type text.
Maybe the next one is a button.
So here if I use inspect you will see that we are inside here.
You see we have an input.
It has an ID.
It has type is text.
It has a name and it has a size.
And So whenever we're trying to send this ad to URL.
So we use get method.
If you're going to send this to a form we use post method.
So here maybe it is post or maybe get no problem if it is form.
Of course it is form.
You see that it is a form and it starts from here.
It has an action.
Action is equal to index dot php and page is equal to DNS lookup dot PHP.
So method is post.
That means here it is used post and we are going to send data to post.
So we are going to use a module called request.
You know already we learned something about request.
And also in here.
Now we are going to learn to use another module called Beautifulsoup okay.
B is for.
So let's go and start creating this.
The first thing we need to import is requests.
Okay.
So now I have the request.
Let's create that function that we have.
It was I think request.
It was asking for a URL.
And we are going to let's just create the same thing that we just we were just using.
Okay I'm going to use try an exception here.
Try in here it is going to return a requests dot get.
Then I will give the URL and then in exit part.
Uh actually in except it is going to be a specific except for a specific exception.
It is going to be request dot exception, but I think it was connection error.
Okay.
Now, if something like this happened, we need to pass.
Okay.
Good.
Now, if I want to create a if I want to access that web page.
So we need to create something called let's create this by the name of target underscore URL.
It is going to be equal to.
Then the URL is going to be right here.
Let me copy this from here and then paste that URL in this variable.
Now we have this variable here and we can use it.
Okay.
So let's create another variable is going to be response.
The response is equal to request which is the method that we And we are going to give the target URL.
If I now print just the response.
Okay.
The response dot content.
And save this.
Now if I move to this location see the document.
And it is I think.
Yeah.
Let's enter here use LRS.
You see we have something called vulnerability scanner.
So.
Move here and then use LRS.
We have to extract form.
Okay.
Let's use Python extract form and hit enter.
Just a moment.
Now you see that it extracted everything that is in this location.
So it is not what we want.
I want to just extract the forms.
Okay.
Not everything.
So here we are going to use another module that is called a beautifulsoup.
Okay.
So from this or I think import Beautifulsoup.
From is going to be from not form.
B is for import beautiful soup.
Mm.
Okay.
Now we have our beautiful soup here.
Import it.
Okay.
And now let's try to extract the form that we have in this URL.
So I'm going to create a variable named HTML.
It is going to be equal to.
We have imported Beautifulsoup, so I am going to just use this beautifulsoup here.
And then we have the response dot content.
Okay.
We are storing this into parsed HTML.
So let's use form I have the form list.
It is going to be equal to our HTML that we have it at in line 13 dot find all.
Okay.
And in here we are going to give any tag we want.
So the tag that we want is form.
So now if I print.
The form list and save this then I go back to my terminal, use kill layer here and try to execute this
once again.
Now you will see that it only gives me the form.
Okay, uh, you see, it ends with form.
And soon we will have something like this.
And it starts from here.
It ends right in here.
Now you see that it is a list and it contains a form.
Okay.
And inside this form, we have a lot of we have a lot of things like, uh, all the input like this
input that we have.
It is one of the input okay.
And also we have another input that is the button here.
Now we can analyze analyze this to get exactly what we want.
Okay.
Let's go and see that how we can do that.
In the previous lecture.
Sorry.
In the next lecture.