Welcome to Packet Sniffer program.
In this program, we are going to build a program that capture the data that is flowing to our computer.
In the previous section we learned how to create a Arpspoof program.
In that section we created this program.
Okay.
That was uh, making this victim and also access point or forcing them to or fooling them to, uh,
to send their data through this hacker computer.
Okay.
We were we were able to receive the data that is, uh, coming from victim.
Okay.
And then we were sending it back to this access point, and also we were receiving data from access
point and then sending it back to victim.
Now, in this section, we are going to build a program that is, um, capturing the data that is flowing
through our computer, which is a hacker computer.
Okay.
We will be able to capture the data that is coming from victim.
Okay.
Here we will be able to capture it, modify it, and then send it back right here to the access point.
So how can we do that?
Let's come back to here.
Here I created a folder called Packet sniffer.
Okay.
And I created a file called packet sniffer.py.
Again here we are going to use from Scapy.
Okay.
So let's import the Scapy Scapy dot all as Scapy.
What happened?
Okay.
Now I just imported this and now it is time to use it.
Okay.
So here I need to create a function that sniff the packet.
Okay.
So let's create that function or that method or define that method.
I'm going to name it sniff.
You want you can and name it anything you want okay.
Here I need to get the interface okay.
So interface will be provided here as an argument.
And here this escape has a function called sniff.
And here it has a what is it called.
It has an argument it called Iface okay.
Iface is the interface the interface that we are providing from argument.
And in the argument right now you see that we have something called interface.
Okay.
So we are going to write that here.
So interface very beautiful.
And what is next.
The next thing that we are going to provide is something called stir.
I don't want to store the data that is flowing through my computer.
So I'm going to define this to false.
Okay.
I will assign this to false.
So that means any packet that is coming and moving through my computer, I will not store it in my computer
because it is bringing too many load to my computer.
So the next part is something called PRN.
Okay.
This PRN is equal to any function, any callback function that anytime you capture, uh, something
okay.
Anything uh, a packet.
So here you will be, uh, okay.
Anytime you, you capture a packet, this function that you're providing will be called.
Okay.
So here you will provide a function and a callback function that later you can create it.
Okay I'm here.
Process sniffer or sniffed package is a callback function that I will provide right now.
You see that it is not provided, so it is giving me an error.
No problem here I will provide that function and I am going to name this this function that is called
process.
Sniffed.
Packet function.
And I'm going to give that packet as argument okay.
Packet.
Good.
And you can do anything you want into these process.
Sniffed packet function okay.
So here, right now I am going to just print this packet and let's see that while we are capturing the
packet.
And how does it look like.
Okay I want to print that.
And also let's call this new function here and give the interface what is our interface.
Okay.
You know it is ETH zero.
For me it is zero.
If you're in a wireless LAN or LAN network you can use w uh lan okay.
So I'm going to save this and let's open this.
Right here.
CD I want to come back here.
Use LZ packet sniffer.
Do you have.
Yes CD packet sniffer.
Uh, Alice we have it.
Let's use clear.
Now let's use a pseudo python code snippet dot p y.
Provide this.
And right now you see nothing.
Okay.
That is because we are not capturing anything.
Okay.
So right now here I'm not going to be man in the middle.
Okay I'm going to test this on my own browser.
Later we will be able to test it on other stuff.
Okay.
Here.
Let's, uh, if we have network access, uh, I want to access something.
Anything.
Like being Google anything.
And let's see if we are able to capture the data into the there or not.
Let's use Bing.
Okay.
We are able to.
We are not able to.
Okay.
It looks like I don't have internet connection.
I will provide that connection.
and then we'll be back.
Okay, now it looks like we have internet connection.
And let's go back here.
I want to re-execute this.
Okay.
So Python packet sniffer.py hit enter.
Provide your password which is calling okay.
Right now you see nothing here.
Let's come back here I want to again try to search for Bing.
Hit enter.
Uh, right now you see that we capture a lot of thing here.
You see?
Row row row row row a lot of thing.
And all these are udps okay UDP UDP packet.
These are TCP packets.
And also you see we have https.
And also we have google.com.
These are some um links that we captured.
We have bing okay.
Google.com.
These are all the packets.
That is that is that we are able to capture.
Okay.
Anything that we see here, these are packets that we capture.
Okay.
Right now you see this.
And later we will be able to do a lot of cool stuff with this program.
Okay.
And right now you see a lot of thing here.
But you may not understand, uh, what are these all thing?
Okay.
We will be analyzing them and modifying them and capture what we want.
Again, not everything.
Okay.
In some lectures.
So let's go and see that.