Okay, now we have this little program.
Extract from.
Now I'm going to ignore this for now.
And I'm going to do one more thing.
And that is to create a program that can this program, this website, for example, and extract everything
we need and then check for vulnerabilities.
And we are going to do that in this section in Vulnerability Scanner.
So in here I'm going to create two new files.
One of them is going to be scanner.
The next one is going to be Vulnerability scanner.
Okay.
What happened.
Okay.
It is going to be.
Into this scanner file, I am going to add a lot of files.
All the files here.
And then in vulnerability scanner we are going to call.
We are going to this use this scanner to execute our code.
Okay.
So first let's create a class.
I'm going to name this class scanner.
And here we had something.
Let me find that.
Not this one.
Okay.
We need this traveler 2.py because right here it is checking for a URL.
Okay.
And then it is checking it is searching for all the links.
And it is finding it and then printing that to me.
So in here I need to use this.
Okay.
Let's copy this.
And.
Let me copy this from here up to here we have two method here.
And let's put that boot method inside this class.
And in this class because it is a class.
So it is going to be kind of different.
Okay.
So in here we need to create a constructor.
You know how you define a constructor.
Okay.
So we use this keyword and then init.
And we remove some of this thing from here.
And then inside this uh in here we can give.
All the arguments that we need.
So the first argument that I am going to add is going to be the URL.
Okay.
Let's URL.
And here inside this I am going to access this URL and change the name of URL to something else.
Let's use this self dot.
I'm going to change it to target.
URL is going to be equal to URL.
So whenever someone use target URL that means they are going to access this URL that is here.
The next thing that we need to handle is that inside this extract link we need to add the self keyword
here.
Now because we have because it is inside the class, we need to use self keyword here.
And then we have the request here.
That means we need to import request.
Okay.
Import Requests and the next thing we have our e here means regex.
We need to import our e as well.
Okay.
We have response which is equal to request dot get and then the url.
Then we are returning here.
Everything looks good.
So this part is done now.
Now it is time to come here inside the travel and check for this.
We need a lot of things here.
One of them is extract link that is here.
As you see we have the extract link that is saying that it is not defined because before it was defined
because we were out of the class, we were not using class and constructor.
But now that we are using it, we need to use something else here.
That is self okay.
Self dot extract link.
And also here inside these travel method we need to add the self as well.
Okay now that is solved.
But as you see we have URL join here.
That is a library that we need to use it okay.
And that is here.
We need to import that from here just like this I will copy this and use it up here because it is very
easy to copy and paste something.
So now it is also solved and we have the target link here.
Let's see what I have, what I have done about this.
You see we have the target link here.
And you see that I defined the target link right here.
And you see it is an empty List and I need to handle that.
The same thing here.
Inside the constructor and in the constructor I need to define that.
So self the dot target underscore.
We have the URL.
This time it is going to be link.
It is equal to an empty string an empty list.
Target link.
Okay.
Now we have that as well.
And as you see right now it is giving me the kind of error.
Here you see.
And to solve this to use that you need to use self keyword as well here.
And also the same thing here.
Self dot target link happened.
Okay.
And also when you call this method here, inside here you need to use the self keyword.
The same thing here.
Okay.
So now uh, it is almost complete that we need to complete the vulnerability scanner here.
We need to call this scanner inside this file.
And we need to use it okay.
Um okay.
We have the URL here.
We have the target link here target URL and target link.
We have two things here okay.
And in here I need to first import the the file okay.
So let's use import scanner.
And the next thing is that we need is the target URL.
So this target URL is equal to the URL that we want.
And the next thing that I want is to create an object from this Is a scanner.
I'm going to name it one scanner.
It is equal to scanner dot.
Let's see.
We have the class here.
You see.
Okay.
That is must be capital.
Let's see if it is capital or not.
Of course it is capital.
And now that we are going to create its object.
And in here into the constructor, you see we have only one argument and that is URL or target URL.
Okay.
So we need to provide it here I am going to name it target URL or give the target URL that is here.
The next thing is that we need to call the function or the method that is called gravel okay.
And.
That is going to be in here.
So we have its object that is called wall scanner dot Gravel and it is going to get the URL.
And right now it is going to be the target URL.
Okay.
Now I'm going to save this and let's give a URL to this.
And it is going to be.
This one.
So use Ctrl C here and use Ctrl V in here Matilda.
Okay let's save it.
And also let's come here.
Use Ctrl S to save that as well.
And here let's use Clear and Python.
We have vulnerability scanner dot p y and then hit enter.
As you see it is working perfectly and it is scanning for all the links and whatever we need okay.
And finally we get all the link links that we need and it is working perfectly.
So let's go and improve this in the next lecture.