Okay.
In the previous lecture, we completed the crawler that we just created, and now it is time to create
a program to guess the login page information.
Okay, here you see we have dv w that is here right now.
We need to, uh, write a program that uh, gives or even we provide the username and also the password.
So it needs to handle this.
Okay.
Um, add the username here and then enter the password here.
And then hit the login button.
And then go inside and log in.
So here you see when we try to see the information or the details the code that is here, you see we
have a form and it has an action.
It is login dot php.
That means when we provide the username and password it will redirect us to Login.php.
And also it has a method.
It is post.
But before you know that we were handling the request in the get method, sorry.
And now we have something else and that is the method which is called post.
Okay.
You're going to handle the post method which is very secure.
And in here now you see we have a user okay.
We don't need that.
We have an input here.
It has a name okay.
Name for username is equal to username.
And also we have a password.
Name for password is equal to password.
And also we may have an input button.
The input button a value for this is login.
And also name for this is login.
And also we need type.
Type is equal to submit.
So we can handle this very very easy in here.
You see I created a program called login.
In here again we are going to use the request.
So first I'm going to Import
requests.
And in here, the first thing we need to provide is the target URL.
Okay.
Target URL.
It is going to be equal to the URL that I am going to just give it to.
That is here.
So I use copy and then paste it here.
Perfect.
Now we have the target URL.
Okay.
The next thing is to have those data.
Okay I am going to name it Data dictionary because we are going to store this as dictionary.
The first thing is I think it was username.
Okay.
The key is username.
And here I need to provide one more thing.
You see we have name which is username.
And we need to give it a value.
The second thing that we are providing here in dictionary is the value.
Uh here for example I example, I am going to give this test.
So right now when we execute this, the test will be writing to username and then go to the next one
which is going to be password.
And it's going to be for example.
It's also going to be test now which is not true.
Okay.
And the next one is login okay.
Value for login is submit.
Let's see if it is submit or not.
Username password.
And also we have login and the type is submit.
That means the value is submit.
We hit submit button now.
Now we have this dictionary okay.
The next thing is to use the request dot post or dot get or something.
So I'm going to name it response.
It is equal to request dot.
Before we were using git but now it is time to use post.
Okay.
Because the method is post here the first argument is going to be the URL.
The second argument is going to be the data which is equal to data dictionary.
Okay, now I have the response if I print the response and not just the response okay, I want to print
the content of the response.
Now if I save it, let me show you in the real website here.
Now if I provide test and test and then hit the login, nothing happens because login failed, because
that is not the real information that I provide.
I think the username for this is username.
And this one is password login, failed username and password.
Okay, I will find the real username and password.
Let's try admin and then password.
Okay so you see now that when we log in we have this URL.
And also we have welcome to dam vulnerable web page.
And we are logged in.
So okay here now.
You see that we are in this page.
Okay.
Let me come right here and save this.
Let's open the terminal I'm going to clear this city.
City login In and then python login.py hit enter.
Now you see an HTML web page that it is giving me something.
Let's see if anything readable.
Login.
Logo message.
Some web application with password.
Okay, so now we have this thing okay.
Which is very little information that is here now.
And I'm sure we are not logged in.
You see we are just, uh, capturing this data, which is the form.
Okay.
It is printing me the data.
Now if I just use instead of username, I use admin and instead of password.
If I use password and I am going to save it.
The data dictionary looks good.
Now if I hit login now you see that we have a lot of information here.
That means we are logged in and in here you see we have.
Welcome to this application.
What does that means.
That means we are logged in.
Let me show you in the, uh, web page that is here.
Okay.
In here you see we have this information here, this text here.
And you see that text here.
That means you are logged in.
So now in here you learn how to handle the post method using request.
Okay.
Before you learn how to handle git method now you learn how to handle post method.
So perfect.
Thanks for watching and I will see you in the next lecture.