Hello everybody.
And welcome back.
And in the previous video we finished actually coding our program.
Right now we should be good to go and we should actually try to run it so that there is another thing
that we actually need to add but we can edit after we actually test the program itself and see if it
actually works well.
Now I will test with tell you that the past four list you can use any pastoralist you want.
Basically right now we are not trying to actually brute force it.
Right now we are trying to see if it actually works.
Then after that we will specify the correct user name and password in some list and we will see if it
can find the username and password that is actual correct.
After that since if I just open my program loops that I write here you can actually see that I don't
have an actual function that will actually print the users what the usage of this program is so we'll
have to code that as well.
But that is rather simple and not needed at the moment.
So we can just run this program right now.
Let me just delete the basic authentication has not by that saves since I renamed the file to be basically
called the PI since it is a lot less short term.
And right now we know that we can run it with this and then we can specify all the options that we added
in our program which is minus W for the U.R.L. which will be a GDP 182 the 168 that one that one for
the IP address of my router then minus you for the user name I will use anything.
Doesn't really matter.
No we will not be able to brute force it with his user name but it does matter a number of threats to
be five and the father we will use.
Let's set the path to be user share one of this and then rocket up the steep.
And right now we can actually presenter and see if this will work well with our code it brute force
or so we can see it is running through all these passwords and we can see our program actually works
well it is it went through like 15 passwords right here they are not valid of course and after I specified
the controls see it said interrupted our program works good right now before we actually try to actual
brute force with the correct user name and password let us actually let me just restart the terminal
since it is being a little bit laggy now let's actually add the function that will actually print the
users the users of this program.
So now know basic authentication to buy and we can add that function right here.
It doesn't really matter what we want to do is just give the user the simple usage of this program specification
of all the commands and our simple example of the command itself.
So it can do that with several print commands or with one print command we the three single quotes as
we saw in my back the creation we can use three single quotes at the beginning and at the end of the
string in order to specify a string that will be multi line.
Now we do not have to do that.
We can just use print option for everything.
Let's use a function called usage and we can print usage which is may be the first line.
The second line can be moved like one tab.
So mine is W and then the URL and then let's specify in the brackets for example a TTP some site dot
com so we specify in the brackets we closed the double quotes we print the next usage so minus you for
the user name.
So let us set these two so that people know that they need to separate it so it will be user name like
this then print the next one.
So minus C for the threads I believe the threads closed the double quotes and the last one or actually
the last option will be minus F for the file itself.
So password best
OK.
So right now what we want to do is actually pretty simple usage or a simple example of using so example
could be actually basic auth not be Y minus W for dealing.
So it's a DP slash that's lovely double down in some sites dot com minus you for the user name which
can be add mean minus T for threads for that can be five minus F for the file with passwords which can
be passed out the deep and when we put it to be string and we have our usage a function coded in our
program now all we have to actually do right now is actually call this function somewhere from our program
so let's see where we can add it we need to add it right here.
So as soon as we actually type the banner we need to set our simple if l slope basically that will check
if the usage needs to be printed out or not.
So for example if our user specifies a different number of arguments add those add some argument that
doesn't exist or doesn't use an argument that is needed for example they specified you are the user
name and threats but don't specify the password list our program will still not work so we need to specify
at the beginning of the program before it started doing anything else we need to specify whether the
number or the number of arguments is equal to 5 since we actually have 5 arguments.
Now I might be asking how do we have 5 arguments when we here only have 4.
Well basically the name of the file itself or the program itself is also counted as an argument so we
have to include that one too.
So how can we do that.
We can do that simply with this.
So if all ends of deceased arguments is a lesser than five basically as I said before 5 arguments we
will print the usage of our program.
So we will call this function which will then print this that we printed right here.
And then the user will know what they need to specify and then they will we can close the actual program.
So since the text and we should be good to go right now.
So let us see how this will work.
Everything is set.
We are good to go.
So that is control all this.
So control all that allow us.
Then let's say we just want to specify the EU or now.
So GDP Google dot com.
We only specify that we just found this and you can see we get the banner and the simple usage of the
command.
So right now if the user was writing this for the first time they would right now know what to do.
So let this actually test if this works.
Now the user name for my writer is telecom and the password is small so telecom.
I said that for this video so we can see if that will work.
So that we now know passwords that the extreme in this directory and here will specify some random password.
So admin wrote administrator password 1 2 3 4.
Hello world.
Basically we can just type anything call in numbers and then let's hear type your telecom then add something
more
and that should be about it.
So right now we have the correct password for my right right here.
And we will now check out if the program itself will actually manage to find this password right here.
So let me see if everything is set to go.
We run the basic order B Y and we see the use it.
So let us type the command minus W a CTP IP address on my router minus to the user name is telecom minus
still let's use 5 threats and minus F for the password list if we want to use which is in my current
directory.
So all I have to do is specify the name of the file itself.
Now if I press your enter we can see it really fast.
Found the correct password.
So right here you can see it went through these passwords is not valid is not valid and then it found
password found Telecom.
So we actually saw that our program works perfectly.
It can find a password it can brute force really fast using our threats and it most likely will work
in any case where you have the basic authentication protocol or basically basic authentication on your
log in page so that will be about it for this coding of our brute force sir.
Now we will continue with a few more with using the next lectures and then we will finish up and wrap
up our course.
Hope you enjoyed this coding section and I hope I see you in the next lecture by.