Instructor: From the previous lectures,
we learned the basics of how networks work.
We learned that devices on the same network communicate
with each other using packets.
So regardless of what you do on the network,
whether you're watching a video,
whether you're logging into a website,
sending chat messages, sending emails,
regardless of what you're doing,
all the data is sent as packets.
Now, in the network,
devices ensure that these packets go
in the right direction using the MAC address
so each packet has a source MAC and a destination MAC
and it flows from the source to the destination.
So in this example, we have the client,
it has this MAC,
we have the access point which has this MAC
and as an example, if this client wanted
to send a packet to the router,
it will set the destination MAC
to the router's MAC address.
Therefore, by default,
each device only receives data that has the destination MAC
as its own MAC address.
But if you remember, I said in wireless networks,
if you're within range,
then you'll be able to capture all of this communication
because these packets are literally sent in the air.
So we can just capture them
even if they do not have our MAC address
as the destination MAC.
To do this, we need to change the mode
of operation of our wireless interface
so that it operates in monitor mode.
So let me show you what I mean.
If I go to my computer here,
and run iwconfig this time,
so we've seen ifconfig which lists all the interfaces,
we can use iwconfig to see the wireless interfaces only.
And you can see, we have lan0 right here
which is my external wireless adapter.
And you can see the mode of this adapter
is set to Managed.
What this means is basically this is the default mode
of all wireless devices
and what it means is this device
will only capture packets
that has the destination MAC
as the MAC address of this device.
So basically it'll only capture devices
that are directed to my Kali machine.
But this is not what we want.
What we want is to be able to capture all the packets
that are within our range,
even if they are sent to the router
and even if they are set to another device.
So to do this, we need to set the mode
to Monitor mode instead of Managed mode.
So as usual, before you can change the options
of your interface, you have to disable it
and previously, we've seen we can do that
by doing ifconfig, the device name
which is lan0 in my case, down.
Then we can enable monitor mode.
But before we do that,
I'm actually going to run a command
to kill any process
that could interfere with using my interface
in monitor mode.
So the command that I'm gonna run right now
is not mandatory
but running it will actually give you better results
when you come to running the attacks
that you will learn as we go in the course.
So this command is gonna be airman-ng check kill.
Now you'll notice when you're on this command,
it'll actually kill the network manager
that usually runs in here.
So you'll completely lose your internet connection.
But this is no problem
because we will only need to be in monitor mode
when we are running pre-connection attacks
so attacks that do not require us
to connect to any network.
So we actually do not need internet connection
to run any of the attacks that require monitor mode.
Now we're gonna enable monitor mode.
So we're gonna do iwconfig.
Followed by the interface name
that we want to enable monitor mode on
which is lan0.
We're gonna say that I want to change the mode
and I want to change that to monitor.
So very, very simple command.
We're using iwconfig to change the mode.
We're giving the name of the interface
that we want to change its mode.
We're saying I want to change the mode
and I want to set it to monitor mode.
Now, if I hit Enter, you'll see the command will run
with no errors which means the command got executed properly
and finally, we'll need to enable the interface,
again similar to what we did
when we changed the monitor address.
So we just have to do ifconfig lan0 up.
That's done.
Now, if I run iwconfig again,
you'll see that the mode is set to Monitor now.
So basically this interface now can be used
to capture any packet that is within our range,
not only the packets that are directed
to this computer.
That's why in the future you'll see how we can use it
to sniff packets, to analyze them
and even break into networks.
So in the future,
if I say use your interface in monitor mode,
this is what I mean.
You'll basically have to enable monitor mode
as shown in here.
Now, I've also included a YouTube video
in the resources of this lecture
to show an alternative method
to enable monitor mode
just in case you got errors with this method
or you tried to follow something
that I do in the next lectures
and it didn't work.
Then you can come back and try the alternative method.
But if this worked and if monitor mode
is enabled successfully,
then you don't need to watch that video,
you can just continue with the course.
One more thing to keep in mind,
not all wireless adapters support monitor mode.
So for this to work,
you need to make sure
that your actual adapter supports monitor mode.
There are a number of adapters that support that
and I've included another video again in the resources
of me talking about wireless adapters,
hot to pick the best one
and which ones that I recommend and use
when I'm testing the security of networks.