Welcome to Network Scanner section.
In this section we are going to create a program that do the scanning okay.
By using IP of a computer we need to get its Mac address.
So here just see we have a full computer one router that is here okay.
We have computer A, B C and D okay.
So here while we are trying to connect to another computer, first we need to know its IP address.
As you see here all this computer has IP okay.
This is the IP for router.
This is IP for computer B, C and D.
So now this A you may ask why doesn't this computer has any IP address or Mac address okay.
That is because it is the hacker computer we are going to.
Build a program that later on we we could use this computer as man in the middle.
Okay, so all the connection, all the packets that is moving through this computer, from this computer
to the router, they must move to computer A and then move it to router.
So here we can capture it and we can modify it and we can use it.
So here we are trying to find for example this computer okay 0 to 7 that is here.
So this is the computer for hacker okay.
It will send a packet and it is called ARP request.
You may ask what is ERP.
Okay ERP stands for Address Resolution protocol okay.
It allows us to link IP to Mac address.
So first it will send a mac a packet to all computer all clients okay.
There is a broadcast Mac a broadcast packet okay.
It will go to router there and say, who has this IP to this computer, to this computer, to this D
computer D and.
All this computer will not answer.
Only the computer will answer that has this IP address.
And that is here in 027.
And that is in here.
It will say that I have 027.
And my Mac address is this one okay.
And this packet is called ARP response.
The first one is called ARP request.
It is a broadcast packet okay that will send to all clients.
And the response is a packet that only hacker computer receives from the client that has this IP.
Okay.
The IP that is requested.
And here it is giving its Mac address.
Now the hacker computer has its Mac address and now it can do anything it wants.
Okay.
So Very easy.
Now here we are going to, uh, use, uh, library or, um, okay, a library called Scapy to do this.
Okay.
We need to use it.
You may know what is a module or what is a library because already I think in Python basic section,
I, I give you a simple introduction to what is a library or what is a module and how we can use it.
So here we are going to use Scapy module okay.
Let's first import that.
Okay.
Import Scapy dot all as something like Scapy.
Okay.
What is this man you may ask what is this mean okay skip dot all as something as something like scapy
or anything you want is this is called aliasing okay.
You don't use all this thing.
Okay?
Instead of using all this in your code, you rename it.
Okay.
You just use Scapy and it is very easy.
Or you can even use a C or ace or anything.
Okay.
It's just a name.
And then here we can use it.
Let's create a function or define a function.
I'm going to name it scan.
Here we need to give the IP of a computer that you want to send the packet to.
And here I am going to use this scapy that I just renamed okay.
And it has a function called ARP okay.
Use dot and then ARP or ping.
Ping.
And here just give the IP that is coming from here okay.
As argument.
And later on we can use this function or we can call it.
And here I am going to use or Recall the scan function.
And here I need to give the IP address for example for my router.
Let's come here and use route dash.
And let's hit enter.
You see we have a gateway here.
Okay.
This gateway is the router okay ten 021.
And now if I give this chain 0 to 1 and save it.
And let's go to city document.
Alice.
City Python project for ethical hacking.
Alice.
Okay.
We have network scanner.
Okay, so let's change the directory to network scanner.
Alice.
Now you see we have the network scanner file here.
Let's use pseudo python network scanner dot pi.
Hit enter.
Provide a password.
Hit enter.
And here you see.
It says receive only one packet.
Okay.
Got one answer remaining zero packet.
And you see this is the IP address for router.
And this one is the Mac address for router.
Okay.
Now by using this simple program that you see here only 12344 lines of code or with spaces, we have
six lines of code.
Now you're able to get the Mac address for any computer, any client that you have its IP address.
Now I have the Mac address for my router okay.
Very easy, very simple.
And through this section we will improve this program to get the Mac address for all the client.
Okay so thanks for watching and I will see you in the next lecture.