Okay.
Now we have our program that is, uh, doing a small part that is post option.
Okay.
It is handling the post option.
Now let's go and create a program to guess the login information okay.
For example, the, uh, password for this website.
And here I'm going to create a new file.
It is going to be guess this login dot pi.
So here I am going to use that.
And also let's create a list of password here.
So it's going to be password dot list.
Let enter.
Now the list is almost here.
Uh we have um.
Just let's use this little information that we have here, okay, as a password and add let's add some
new thing.
For example.
The other one is going to be admin.
We have pass we have pass w we have password.
We have like we have love this information.
This little which is 20 line of code, 20 line of uh password that we are going to use here to test
it.
Okay.
I don't have a big password list here.
I'm going to just use that to get the just the password for this data for this website.
Okay.
Again in here we are going to use the request as well.
So you see that, uh, we have this little information here that I'm going to use.
I copy that and use that here and paste it here.
Okay.
Here you see we have the username which is equal to admin.
Password is equal to password.
Here I'm going to remove that and put an empty string there.
And the next thing is to open this password list.
And then try that on this website and try to log in.
If we log in we'll find a correct password.
So we need to provide a correct message that shows that we are we are finding or we found the password.
If not so give me an appropriate message or that you didn't find the password for this website.
Okay.
So the first thing is we need to open the file.
The file is as word dot list okay.
And when we open this?
I want to read it.
Okay.
As something as for example, I'm going to name it word list.
So when I open this I need to go inside.
So we need you.
We need to use a for loop for line in word list that we have okay.
So when I go inside of this and then I can do one thing to remove extra space and enter from here.
That is, uh, word is equal to line dot strip.
Okay.
This will remove the extra thing like the enter that we have at the end of each line.
The next thing I can do is the data dictionary.
One of the it's key.
That is um that is password okay.
We need to find this.
And Um password.
Okay.
Is going to be equal to word.
So.
Now we are going to have uh, the target URL and also the data.
I mean we need to use the post.
Okay.
So again let's use the response is going to be equal to requests dot post okay.
Here we need to give two things.
The first one is the target URL.
And the next one is going to be data is equal to data underscore dictionary.
So now let's use an if condition here.
If we have something here let me show you in here When I try to log in with a false information, I
hit login.
I have something called login failed.
Okay.
It shows me this text here that I can use it in here.
Okay.
If.
If this login failed.
Not in, uh response dot content that we could use.
If it is not in here, that means we are logged in.
So let's print that.
Uh, got the password.
And that is the password.
Okay.
So the world will have will contain only the thing that it found.
It finds.
Okay.
And then let's exit this.
And if not, find it.
Okay.
If we are not able to find what we're looking for.
Then let's print something else.
In here I am going to print that.
Great.
Mm.
End of line.
Let's save this.
And now you see that we have a password list here.
That is, uh, in here we are opening that and we are reading each line, and then we are removing the
extra entry from that each line.
And then we are checking that data dictionary which has a password key here and it has an empty value.
We are going to assign the word in here.
And in here we are checking that if we don't have login failed in response dot content, that means
we are logged in.
And that thing that we provided is correct and the word is founded.
Let's save it.
And here.
Okay I am going to use this login.
Let's hit enter.
Okay.
We have something again here on line 11 that is here.
That means we need to change this again.
Back to string.
And save it.
Try to re-execute this and you see.
Got the password.
And the password is equal to password.
That means we have found the password.
What if I remove this password from here and now.
I save this and really execute the program.
You will see that ridge end of line and we don't have any password or something.
Okay.
So now you learn how to guess a login page.
Okay.
Login page details like password.
If you're going to try this on a big website like Facebook or like Gmail or something, for example,
you have the email address trying to find the password.
You need to have a big password.
You give the URL here and then you provide the username and also the password.
Okay.
Go and check the source code.
And then you will be able to test that you need to have a big password list.
So thanks for watching and I will see you later.