Tom we have installed a program that will help us in capturing packets.
The next thing we need to do is we need to learn how to use this package.
So in order to do it let's first start working with fining devices over the network and then we will
try to work with these devices.
So first we need to use a sub package called B gap.
So this package is also part of Google go package load ready.
And we need to use it.
So the first thing we need to do is we need to find devices on our machine so we can say B gap.
Find
so I have to install it here for.
Go get it.
Todd Combs knows Google's flash back in previous lecture I installed to go back it as a router user.
Now I also have to install it as a disk only use it so I can find it here.
So I'm going to be up dot find and let me take some time to get it.
Let's clear it
let's start the program.
We learned
Okay so somehow we will use this package B gap to find devices.
So I'm going to a bigger Dot.
Fine I'll devices and you can see that it automatically imports a sub package which is B cap from go
pack it.
So this is going to return for your open documentation you will see that it returns.
And the interface which contains a list of devices and that if it finds no device.
So let us store this in a variable called devices
and and add a
so the next thing we need to check is you need to check if there is an error while finding devices that
mark.
So if error is not equal to nil.
I can log that panic and then add it if there are devices then we can trade all these devices and try
to figure out what devices they are and what is their IP addresses.
So to do this we can trade over a Ford index and then device equals to range and then we need to provide
the list array of devices which would be devices in this case it would be a list of interfaces then
we can simply print out the device name using empty dot print and then and then we can provide rich
index is it
and then we can say device dot name.
And this will be done now.
The name of our device once so you have this device name you can if you write device dot and you can
see there are various options and then there is an option called addresses which contains a list of
addresses.
So this addresses will return a list of addresses that are associated with this device.
So we want to print out all the addresses so we create an internal loop here.
So let's say for us we are going to ignore that ad and then I'm going to say address equals through
range of device dot addresses.
So now we are iterating over to each address.
Now what we need to do is we need to print out address and it subnet mask.
So I am going to say FMD dot printer Len backslash D.
The first we are going to print out IP.
So I am going to say
and press dot IP and this will print out the IP of this address.
This device then we will print out to subnet mosque.
So I'm just going to duplicated this.
So control press control D and this is duplicated and then we are going to print out that mosque which
should be addressed.
Dot net mosque.
Okay.
So now we have a program which finds that devices on the network can then print out their name and their
corresponding IP addresses.
So I can just run it by using go.
Uh.
Just run from the terminal.
So currently we are we.
Okay.
So we are in the room.
So I want to go to go and then let's see see the source and then I want to go to the packet capturing
and this represents the file that we just created.
So I'm going to clear it and run it from here.
So go on P1 and you can see that it is searching.
So it is that there is an uh.
Which is.