1 00:00:00,060 --> 00:00:06,780 Hello, everyone, welcome to another video of our five p.m. testing series, last time we modified 2 00:00:06,780 --> 00:00:13,350 our code to detect associated clients and of course, you can add the request and clear to send and 3 00:00:13,350 --> 00:00:20,010 detect them when they are sending and receiving data means they are already connected to the access 4 00:00:20,010 --> 00:00:20,340 point. 5 00:00:21,000 --> 00:00:22,640 We might add that later as well. 6 00:00:22,860 --> 00:00:27,870 But today we need to know how to make our Python script to switch channels. 7 00:00:29,040 --> 00:00:33,980 If you notice from before, we were only listening on one specific channel. 8 00:00:34,620 --> 00:00:36,070 But what about the other channels? 9 00:00:37,300 --> 00:00:45,510 Yeah, now we will modify our code a little bit to listen on all channels in order for us to do that. 10 00:00:45,520 --> 00:00:52,390 First, we need a function to change our channel from Python like this switch from one channel to another. 11 00:00:52,800 --> 00:00:54,630 Do you remember this command? 12 00:00:58,590 --> 00:01:04,230 And also there is another command using the idea, but this command is switching from one channel to 13 00:01:04,230 --> 00:01:04,680 another. 14 00:01:05,520 --> 00:01:07,920 So let's try it our function. 15 00:01:13,190 --> 00:01:19,760 Again, I'm going to pause the video, write the function and explain later just to save time. 16 00:01:21,940 --> 00:01:30,990 First line in our function, this line is a command that we are using to change the channel I have that 17 00:01:31,060 --> 00:01:39,100 we your mom said channel followed by the channel number, then a list of channels we want to switch 18 00:01:39,100 --> 00:01:39,390 to. 19 00:01:40,720 --> 00:01:46,360 Then in a while loop, we need to loop through the list and use our always the system function to use 20 00:01:46,360 --> 00:01:48,710 the system command and change the channel. 21 00:01:49,930 --> 00:01:57,820 The reason why I'm using a statement here to check for 111 or six is what I want to wait for one full 22 00:01:57,830 --> 00:02:00,040 second between each one of these. 23 00:02:00,550 --> 00:02:07,270 Like if it's one or 11 or six, wait for one second. 24 00:02:07,540 --> 00:02:13,120 Why I'm doing this is because most access points, they like to use those three channels. 25 00:02:13,130 --> 00:02:20,770 So I want to pause or wait for one second if it's one of these channels, if not just three hundred 26 00:02:20,770 --> 00:02:21,410 milliseconds. 27 00:02:22,540 --> 00:02:23,560 OK, now what? 28 00:02:24,190 --> 00:02:25,420 We created our function. 29 00:02:25,870 --> 00:02:28,410 Now we need to run this function in the background. 30 00:02:28,900 --> 00:02:30,040 Well, how do we do that? 31 00:02:30,190 --> 00:02:35,350 You remember from the back door series, we need to use a threading function. 32 00:02:35,380 --> 00:02:35,830 Right. 33 00:02:36,910 --> 00:02:39,920 So we need to import threading function first at the top. 34 00:02:40,390 --> 00:02:43,000 I really have it here in import threading. 35 00:02:43,270 --> 00:02:43,630 Right. 36 00:02:45,350 --> 00:02:53,360 Now let's create our threading object, all right, to 37 00:02:58,700 --> 00:03:01,120 that thread. 38 00:03:04,010 --> 00:03:07,490 Give it the argument, which is the function, name 39 00:03:12,050 --> 00:03:13,970 one, said Damon. 40 00:03:15,680 --> 00:03:21,530 We want to read as Damon Drew and then t one start. 41 00:03:23,820 --> 00:03:29,550 But first, just for the sake of, you know, like checking things were just plain common these days 42 00:03:29,550 --> 00:03:36,320 from now, leave it just so we can control the channels that we want to listen to 43 00:03:40,110 --> 00:03:45,470 so we know that we most of our channels, most of our access points are on Channel 11. 44 00:03:45,480 --> 00:03:48,900 So let's just switch for maybe five. 45 00:03:59,460 --> 00:04:01,980 OK, we have only one access point. 46 00:04:03,590 --> 00:04:04,580 But that's it, right? 47 00:04:04,650 --> 00:04:05,450 Just one, right? 48 00:04:05,810 --> 00:04:15,980 So now let's go back to our script again and common these three lines, which they will start our function. 49 00:04:17,010 --> 00:04:21,550 And the function will it will switch all channels, right, one by one. 50 00:04:28,680 --> 00:04:32,020 Oh, let's see, we got some other channels here. 51 00:04:33,270 --> 00:04:38,630 We're still getting some nice good the means is working. 52 00:04:39,180 --> 00:04:41,730 We can listen now in old old channels, right? 53 00:04:48,150 --> 00:04:49,320 That was good, wasn't it? 54 00:04:50,100 --> 00:04:52,330 All right, that was it for this video. 55 00:04:52,500 --> 00:04:54,470 Next time, we will go for the offensive mode. 56 00:04:55,050 --> 00:04:55,980 Thanks for watching. 57 00:04:56,010 --> 00:04:57,150 See you in the next video.