We believe that we can work with to capture packets on the wire or network.
So the next thing to do is we need to write a definite statement to handle this the lawyer properly
so I'm going to write that for and not close.
Okay then and now that we have everything set up our goal would be to set a filter that we will use
to filter capture packets because we don't want to capture everything going over the network as it will
clutter our screen.
So first let's set up the filter and then we really start capturing packets so we can use this handle
to set up filters and we can use a method called Second BPA free pet.
So if you search the documentation
you will see that it compiled and sets a filter to this handle.
And then this handle will try to filter only those that are packets that have this special feature which
is defined by this filter and not that we have defined this filter over here which is DCP and port for
42.
So on any packages that contains the peacekeeping protocol and that are passed to board for 443 will
be captured and printed out by this filter.
So let's check for an area so that we can shimmy.
We can be sure that the filter has been set up properly so we can see if error is not equal to men locked
up pending an error.
So now you have a friend set.
Our last step would be to start capturing packets.
So in order to do this we first need to define which is our source.
So and we know that our source is this handle.
But we also need to define how do we decode this package from this source.
So we are going to use go packet dot new packet source.
So this function returns a source object which we can use to take over these packets that it captures.
So the first thing it requires is a packet dinosaurs.
So our packet data sources of our handle so I'm going to give my handle object here and then it needs
a decoder.
So how do you decode these packages.
So we will decode these packages using LINQ live.
So I am going to write handle art link type and then this is our decoder.
So this function is going to return an object called source so okay so if I go out and check documentation
it says that new packet source creates back packet puzzles so it contains a stream of data packets which
can be read and then printed out.
So in order to view these data packets what we can do is we can trade or if you check the documentation.
Again
you can see that it creates a packet that pencils and then we can isolate all this back in the source
using something like this.
So I'm going to write it here.
So let's start by creating or this source and checking reach packets we get so or you will create a
for loop and then we can see each packet equals to the range Source Thought packets locate this source
the packets will give us each packet and it will give us packet continuously and then we can I have
used these packages packets to find out what is their content.
So this function returns a list of packets which we can trade over each time.
So let's say yes us.
We just want to print each packet.
So now we will just print out whatever back instead of going to the port for our 443.
So now our function is complete.
So let's remove this.
So now we have everything set up we are creating a handle and then we have setting filter.
And at the last step we simply get creating a packet source and then we are generating a set of eating
packets over the livewire and next lecture and run this program and see how this program votes.