Hello everybody and welcome back.
And in this tutorial we will start coding our basic authentication brute force.
And this will be the last video in this article hacking beginner to advanced course.
Now after you finish this you will have twenty five plus hours of ethical hacking videos where you can
learn everything from basics to later a little bit more advanced stuff.
Now basically right now as I said we want to code the brute force or in python.
So let us first see what basic authentication is.
So let us go on our terminal and just open up our burps ID.
So we'll have to show you what a basic notification example looks like.
So every time you go here you just close this from a previous video.
And for example open up my router right here.
It will open up this window which will require the username and password.
So this is the example of a basic authentication.
Now how do you know it's basic authentication.
Well simply I will just show you right now as you can see right here it doesn't say is if you don't
specify username and password protected object is the object the rampage server is protected.
So right now in order for us to seeded it with these basic authentication we will open up our suit and
we will inspect our packet before we actually start coding our brute force.
So open the Burchett
they should take a few seconds.
And right after we open it we need to do the regular soft such as turning the intercept off and also
the using the verb suit this proxy in our Firefox.
So right here go intercept off now then right here you go to your three lines right here.
Go to Preferences.
Now if you skipped the Web site penetration testing section you will not know how to do this.
That's why I'm spending once again.
So scroll down all the way to the lower part where it says network proxy.
Click on the settings right here and here instead of the no proxy you want to setup manual proxy configuration
which will be HDP proxy on your local coast at Port 88.
You want to make sure to select all of these to be the same and also use Sox 5 before we wi fi by them.
So we want to Sox 5.
Click here.
OK.
And now we are good to go.
So right now if I just go right here and turn the intercept back on and call right here and the first
page now you will see it will ask us for a back if we want to forward this packet.
Right now it will prompt us for the username and password so we can type here anything.
It doesn't really matter we click here OK.
And here we have the the packet where we actually send the authentication for that page as we can see
we know that it is basic authentication.
As it says in the lower part of authentication or pardon me authorization basic.
So this is the authorization that we will actually try to brute force.
So this program will work for every website or every logon page or every quarter that uses basic authentication.
Now this is the most simple use of it.
So we'll will try to code the the program to actually use multiple threads in order to perform that
route.
After that we will add some of the passing options with our parser which will actually specify the options
indices argument.
Now what I mean by that is let me just close this right now since we do not need to repurpose it anymore.
I just wanted to show you this what it looks like.
And right here we can set back the preferences to be no proxy since we will not really be needing burp
suit anymore.
We only used it in order for me to show you.
So just set everything back as normal and we can close this page.
Now what I mean we will set be that we will be setting up options.
I mean for example if you as Max changer it will ask you for these options or for the available options
for this device or basically for these programs if you just type your Mac how Mac change does this how
people say you need specify these options in order for it to perform these tasks right here.
So will try to code something similar to this.
We will add our own options and we will actually say which option does what.
And then we will be able to run our program.
So right here let us make a directory which is called for example brute force.
Now let's change our direct route to the brute force.
Here we do not have anything since we didn't code anything yet.
But let us now our basic authentication not be why.
So now basic out in the nation lot.
B Why not a little bit long name but it doesn't really matter.
You can call it anything you want as usual but the specified path to our python.
Now let's see what really we really need to perform in order to code this properly.
So we will actually need to import e threading library since we are using these threats in order to
brute force.
We will also need to import a deceased library which allows us to actually select the options to be
as IndyMac changed program for example.
What we will need to do we will need a file that will contain all the password lists that we will actually
use in order to brute force.
That is also something that we will need.
What we will also need basically we can add some additional options such as for example banner for our
program.
And we also need the usage in order for users to know how they can use our program.
So let us start off with this.
So let us first in order for us to actually send anything over the Internet whether it is basic authentication
or sending packets or this or that we need to import the requests library that library allows us to
actually send packets and send usernames and passwords with a simple one line comment.
So let us import requests then let us import threading.
But let us a supporter be different so from threading import thread we also need to import.
As I said before in order for us to parse the arguments way to import.
Well from now on that will actually be at CES.
So we can actually use the system arguments and to parse the options we actually need to import to get
opt libraries.
So import pops.
Now we used all of these libraries instead of this one.
So you will be not familiar with this library but it is not that hard.
We have a few lines with it.
So it won't really present any problem.
And right now let us see what we can actually do in order to make our program work.
So let us actually add a banner to our program so users get notified it looks pretty or so and that
is very simple to do that to start a function called banner.
It will not take any arguments we will just call it and we can print something that looks well that
looks pretty.
So we can just go like I don't know we can just type here hashes that we print.
Once again bring something like this for example our basic basic brute force.
It doesn't really matter.
You can name it anything you want.
This just so it looks a little bit prettier so at the double quotes at the end and here let's print
another row of the hashes
so this is what I call a simple banner.
And in order for us to run it you can just type your banner and save this file and check out if it works.
Now this is something that we want to run for example at the beginning of every program.
So it actually prints out this banner which can be a little bit prettier but it doesn't matter in our
case.
So let us continue this.
Not really anything important.
So what right now what we actually want to do is let the sexually cool D function where we will actually
pass our arguments.
So in those arguments we will actually specify all the things that people use in order to run a command
and we will specify the other functions that we will use in our program.
So let's call that function start.
So start right here.
And what we want to pass in this function is our arguments.
So in order to pass multiple arguments select your R B and then the close brackets and then go basically
to the to the function itself.
But before we call the function itself let us actually call the main part of the program which will
call this function.
And in order to do that let's just type here.
If that dash dash name that Def equals equals and then under the double the double code that dash may.
This is something that Python has.
So just copy this.
It is the syntax for the python program and then try.
We will run the try and accept.
So we will try to run the program with easy arguments which is basically the arguments that we will
specify in our terminal code or terminal command and what we want to try is actually run the commands
one from the end above.
Now why am I using one and then 2 1 and above is basically because the first the command or first actually
word in our command will be the program name itself.
So we do not want to pass that command as well.
We only want to pass everything that comes after the program name which would be for example dash w
or dash something else or we will see.
So we only want to pass the arguments that are not the name of the program.
So we go from day one and above.
Now we can run this to accept keyboard interrupt
so it actually stops once we interrupt with keyboard we can print interrupted.
So this is our main part of the program.
Basically what we call the trade now is a simple banner which will print out the the simple banner for
us.
Then we call that if name equals man try to start this function that we go code in the next video.
In other in any other cases if we actually want to stop the program we can just press and a key and
it will print interrupted and in full closed the program.
So this is just our basic for our brute force sir.
We will continue with these start functions in the next video and hope I see you there.
But.