Okay, we can test and complete this program on any website, but it is better to start doing this on
a website or on Google.
Okay, it's better to use it on Google.
Here I have created something called subdomain.
Okay, let me move it inside this website.
Hacking.
Here I added some WWE mail connect account, log mail and some words.
Okay, here I want to test this.
For example, I test that WWE google.com.
If that exists I want to print that that that that is existing.
Also I want to print if mail is exist.
If connected google.com is exist as subdomain or not.
Okay.
And for me some of them is not going to work because these are filtered.
And in some cases it is not going to work.
But for you it is going to work perfectly and Good.
So, uh.
Here.
Let me.
Here.
I'm going to put this all into a function.
Let's create a method or function.
I'm going to name it request and giving the URL as argument here.
So let's hit tab to put this all inside here.
And also as you see we are printing this git request and blah blah blah.
I'm going to return it here because now it is a method okay.
So save this.
And also here you see that we are trying to access uh, this thing that is not what we want okay.
I want to access for example google.com
google.com and also everything else is good.
So it will come in http and then google.com.
Try to access that.
If it is possible then we will see something.
If not, then not.
So here I am going to open a file that is here.
Okay.
Let me okay this app domain dot txt I'm going to open this here.
Read it and then uh print it okay.
So.
Uh I'm going to open this with open here it was sub domain I think dot txt and I'm going to just read
it okay.
As something I'm going to name it word list.
You can name it anything you want On Tolkien.
So if you want to read that line by line.
So you need to use a for loop here I use for line in word list that we just created.
Okay.
So inside here we are going to strip this.
What does that mean.
Let me show you.
In here you see that on each line we have an enter okay.
Or in here when we write w-w-w then we have a backslash n or I mean we're going to go to New Line.
So when we want to print this we will be having something extra here.
So to remove that we need to use strip method.
So I'm going to create another variable name it word.
Word is going to be equal to line dot strip method.
This will remove that extra thing that it has.
Okay.
So let's use a let's create a URL variable.
It is going to be equal to word that we have Here.
And then I'm going to concatenate this with a dot.
And then again concatenate this with the URL that we just have it over here.
So that means for example in word we have something like mail okay.
So we will be having mail then dot then google.com.
So we have that here.
Now the test URL is completed.
And also as you see we have had a function called request here.
Okay.
So here I have the response.
This response is going to be equal.
We have request and we are going to give the URL to this.
So the URL now it is this URL.
Okay.
Very good.
Now we have this.
It will come and get this test URL here.
And we'll test this and then there's the request that git will return something.
And when we return that and we get it here, then we need to do something with that.
So first let's check if a response return or this response has a true value.
Then let's print that.
Sorry.
Okay here I'm going to tell this, uh, this dot, this domain is discovered.
Okay.
Or we can name it discovered
domains.
Okay.
So now also we need to concatenate this with something else.
And that is the test URL.
Okay.
And Now let me save this.
Now, if I try to access everything that is inside here and as you see these two file, for example
the alert P1 and also the subdomain this both are in the same directory.
So we don't need to use any extra slashes or something like that here.
And that is it okay.
So let's save this and try to execute this.
And let's see how many of these subdomain exist.
First it will come and check for WW.
And you know that WW google.com exists.
But for me it's not working because uh it is um filtered.
Okay.
So let's see if some of them is not filtered here.
It must work.
If not.
So it will not work.
If it doesn't work here in Kali color Linux.
I will test it in other system immediately and you will see that okay.
Right now you see that we see we saw nothing.
And like this.
Okay.
You see that some of them is not filtered like chatbot google.com logout google.com mobile google.com
tools.
And it's about news okay.
It is not also and images maybe it is, it is filtered for me or it doesn't exist.
So from all this thing that you see this part is exist okay.
So now like this, you can find uh sub domains for the main domain that you have.
Okay.
So how did I do this I use the request okay here request dot get.
And it only shows me if I get a response code of 200.
That means it can connect to this thing.
For example cloud.google.com.
It exists.
So now I can understand that the Google has this much subdomain from the whole thing that I provided
here.
So that's how it works.
And it is not only about finding subdomains.
You can use this on in a lot of places, like cracking some password and also a lot of things okay,
hacking WiFi and then using wordlist, a lot of things we can use something like this okay.
It is one of the very good way.
And you need to remember that we are going to use this in a lot of places.
So very good.
Thanks for watching and I will see you in the next lecture.