Okay, now you see that the program is working perfect.
And still there is ways that we can improve this program.
Okay.
And how can we improve this?
Let's first once again I want to execute this.
And let's see.
Okay.
It is sending the packets.
And now if I come back to here go to right here use this one.
You see now it is changing the Mac address.
Okay.
And if I browse the internet multiple times.
And also if I use Ctrl C here if I came back to windows.
And.
Try to see that.
ARP table again.
You see that it is not changing back.
So it is better to whenever we finish our doing attacks or our ARP spoofing, it is better to restore
the table.
Okay, so for doing restore that table it is better to create a new function.
Okay.
So here I am going to create a new function for restoring the ARP table.
Okay.
So it is going to be restore and it is going to get or take two arguments.
One of them is going to be destination IP and also source IP.
Okay.
So let's use destination underscore IP.
And also we need to provide another thing that is called source IP.
Very good.
Beautiful.
Now in here inside this we need two things okay.
Destination Mac address.
And also the source Mac address.
And just like this one, we need to provide we need to create a packet.
Okay.
And here we are sending a packet to spoof or to fool the target and also the source.
But here we are going to send a packet to give the real IP to target and also the real IP of the computer
to router.
So again here I am going to create a packet okay.
It is equal to p dot ARP.
And just like that OP is equal to number two because it is a response.
And pdst which is the destination.
Okay.
Which is the destination.
It is going to be equal to the destination IP.
And also we have, uh, again, we have.
It's okay.
This time it is going to be equal to, um, destination Mac address here it was target Mac address.
And now it is going to be destination Mac address okay.
Destination Mac that we don't have destination Mac okay.
Now let's go and create that destination Mac.
Destination Mac is equal to.
We have a function called Get Mac by using that destination IP address okay.
Now we provided the destination Mac address here.
And again let's try the other one which is going to be the source IP.
Okay is RC is equal to source IP.
That is provided as argument here.
And also we need this source Mac address.
So I'm going to use h w rc.
It is equal to source underscore Mac.
I don't have it here but I am going to use source underscore Mac is equal to it Mac.
And here let's use source IP to get source Mac.
Let me see if.
Copy this and let's see if this book is the same or not.
Okay.
Now we have it here.
Okay.
Now I can, uh, I can see the details.
Okay.
The details for this.
And if I want to see the details, I can use print statement here.
And let's use the packet that we have.
Dot show method.
And.
Okay.
And also print.
Packet dot summary.
Okay I can call this function right here.
Let's use uh restore.
And here I need to provide two things.
One of them is destination IP and also the source IP destination IP which is going to be IP for uh windows.
Okay.
And also the source IP.
Is going to be ten 0 to 1 which is the router IP.
So right now let's execute this and let's see the details of the packet.
Okay.
Beautiful.
Let me use Ctrl C here.
You see we have this op which is uh is at type okay.
And also we have hardware source which is changed back to what it was okay to a mac address of the router
and also the source IP.
And also we have the Mac address of destination and the Mac IP for uh destination.
Okay.
Perfect.
Uh, let me use ifconfig.
And make sure that okay, now I'm sure that it is not my, uh, Mac address.
Okay.
It is the Mac address for Windows 7.
Now, that is, now that you see that it is working, you need to,
Okay.
Instead of, uh, doing this here printing, we need to use, uh, send method here.
Okay, so let's just use that.
Okay.
Scapy dot send and give the packet.
And also let's use count is equal to number four.
And also we have the verbose is equal to false.
Okay.
Now we have these all I think correct.
Let's see that once again.
Okay.
Right now we are not printing anything and it's working perfect.
And now that we have the restore function here We don't need to use it.
Uh.
Right here.
Okay.
Okay, now that you see, we are using restore here, I don't need to use it.
The app here, I need to use it after I use, uh, control C okay.
Let's provide the target.
Uh, target IP is going to be equal to, uh, ten .0.2. 15.
And also we need to have the gateway.
Gateway IP is also going to be equal to ten .0.2.1.
And now I don't need to call this function like this okay I will remove it later.
Here.
I can add that function here.
So let's call our restore method here.
And I will give the target IP and also get away IP.
This is for the first one.
And use Ctrl C and control V.
Let's change this this time to target IP and also gateway.
Gateway IP okay so it is almost completed.
Let me remove this.
Now it is not necessary.
And also here you see we are using a lot of text here okay IP is text.
Now instead of using them like this I can use target IP.
And this one is going to be gateway IP.
And also this one.
Gateway IP.
And also this one is going to be targeted.
Okay.
Also we need to change this.
Okay.
This text the text in control C quitting.
Let's change this to something else like resetting your table.
Resetting the ARP.
Table.
Let's say please wait.
And let me save it.
Sending two packets per packet plus Ctrl c okay, it is working.
Now let me again come back here and do CLS.
Now you see that it is restarted okay.
Let's execute this again.
Right now it is doing the ARP spoofing.
And now let me move to windows.
Try to check the ARP table.
Right now you see that the Mac address is 36.
And I want to cancel that attack.
Now use Ctrl C okay.
Now let me go back here and try to see if it has changed.
Of course it is changed now to what it was.
Okay so thanks for watching and I will see you later.