Instructor: From the previous lectures, 2 2
we learned the basics of how networks work. 3 3
We learned that devices on the same network communicate 4 4
with each other using packets. 5 5
So regardless of what you do on the network, 6 6
whether you're watching a video, 7 7
whether you're logging into a website, 8 8
sending chat messages, sending emails, 9 9
regardless of what you're doing, 10 10
all the data is sent as packets. 11 11
Now, in the network, 12 12
devices ensure that these packets go 13 13
in the right direction using the MAC address 14 14
so each packet has a source MAC and a destination MAC 15 15
and it flows from the source to the destination. 16 16
So in this example, we have the client, 17 17
it has this MAC, 18 18
we have the access point which has this MAC 19 19
and as an example, if this client wanted 20 20
to send a packet to the router, 21 21
it will set the destination MAC 22 22
to the router's MAC address. 23 23
Therefore, by default, 24 24
each device only receives data that has the destination MAC 25 25
as its own MAC address. 26 26
But if you remember, I said in wireless networks, 27 27
if you're within range, 28 28
then you'll be able to capture all of this communication 29 29
because these packets are literally sent in the air. 30 30
So we can just capture them 31 31
even if they do not have our MAC address 32 32
as the destination MAC. 33 33
To do this, we need to change the mode 34 34
of operation of our wireless interface 35 35
so that it operates in monitor mode. 36 36
So let me show you what I mean. 37 37
If I go to my computer here, 38 38
and run iwconfig this time, 39 39
so we've seen ifconfig which lists all the interfaces, 40 40
we can use iwconfig to see the wireless interfaces only. 41 41
And you can see, we have lan0 right here 42 42
which is my external wireless adapter. 43 43
And you can see the mode of this adapter 44 44
is set to Managed. 45 45
What this means is basically this is the default mode 46 46
of all wireless devices 47 47
and what it means is this device 48 48
will only capture packets 49 49
that has the destination MAC 50 50
as the MAC address of this device. 51 51
So basically it'll only capture devices 52 52
that are directed to my Kali machine. 53 53
But this is not what we want. 54 54
What we want is to be able to capture all the packets 55 55
that are within our range, 56 56
even if they are sent to the router 57 57
and even if they are set to another device. 58 58
So to do this, we need to set the mode 59 59
to Monitor mode instead of Managed mode. 60 60
So as usual, before you can change the options 61 61
of your interface, you have to disable it 62 62
and previously, we've seen we can do that 63 63
by doing ifconfig, the device name 64 64
which is lan0 in my case, down. 65 65
Then we can enable monitor mode. 66 66
But before we do that, 67 67
I'm actually going to run a command 68 68
to kill any process 69 69
that could interfere with using my interface 70 70
in monitor mode. 71 71
So the command that I'm gonna run right now 72 72
is not mandatory 73 73
but running it will actually give you better results 74 74
when you come to running the attacks 75 75
that you will learn as we go in the course. 76 76
So this command is gonna be airman-ng check kill. 77 77
Now you'll notice when you're on this command, 78 78
it'll actually kill the network manager 79 79
that usually runs in here. 80 80
So you'll completely lose your internet connection. 81 81
But this is no problem 82 82
because we will only need to be in monitor mode 83 83
when we are running pre-connection attacks 84 84
so attacks that do not require us 85 85
to connect to any network. 86 86
So we actually do not need internet connection 87 87
to run any of the attacks that require monitor mode. 88 88
Now we're gonna enable monitor mode. 89 89
So we're gonna do iwconfig. 90 90
Followed by the interface name 91 91
that we want to enable monitor mode on 92 92
which is lan0. 93 93
We're gonna say that I want to change the mode 94 94
and I want to change that to monitor. 95 95
So very, very simple command. 96 96
We're using iwconfig to change the mode. 97 97
We're giving the name of the interface 98 98
that we want to change its mode. 99 99
We're saying I want to change the mode 100 100
and I want to set it to monitor mode. 101 101
Now, if I hit Enter, you'll see the command will run 102 102
with no errors which means the command got executed properly 103 103
and finally, we'll need to enable the interface, 104 104
again similar to what we did 105 105
when we changed the monitor address. 106 106
So we just have to do ifconfig lan0 up. 107 107
That's done. 108 108
Now, if I run iwconfig again, 109 109
you'll see that the mode is set to Monitor now. 110 110
So basically this interface now can be used 111 111
to capture any packet that is within our range, 112 112
not only the packets that are directed 113 113
to this computer. 114 114
That's why in the future you'll see how we can use it 115 115
to sniff packets, to analyze them 116 116
and even break into networks. 117 117
So in the future, 118 118
if I say use your interface in monitor mode, 119 119
this is what I mean. 120 120
You'll basically have to enable monitor mode 121 121
as shown in here. 122 122
Now, I've also included a YouTube video 123 123
in the resources of this lecture 124 124
to show an alternative method 125 125
to enable monitor mode 126 126
just in case you got errors with this method 127 127
or you tried to follow something 128 128
that I do in the next lectures 129 129
and it didn't work. 130 130
Then you can come back and try the alternative method. 131 131
But if this worked and if monitor mode 132 132
is enabled successfully, 133 133
then you don't need to watch that video, 134 134
you can just continue with the course. 135 135
One more thing to keep in mind, 136 136
not all wireless adapters support monitor mode. 137 137
So for this to work, 138 138
you need to make sure 139 139
that your actual adapter supports monitor mode. 140 140
There are a number of adapters that support that 141 141
and I've included another video again in the resources 142 142
of me talking about wireless adapters, 143 143
hot to pick the best one 144 144
and which ones that I recommend and use 145 145
when I'm testing the security of networks.