start	end	text
1950	3150	Good afternoon.
3310	4990	Thank you for coming to the talk.
5790	12150	And yeah, it's the 33rd edition of WebCon, and it's better than ever.
13090	18750	So, the talk, as you can see, is based on the title of the talk, as you can read, right?
18750	20530	No radios, no problems.
25270	30530	The title of the talk, as you can see, is No radios, no problems, Hacking Wi-Fi in the virtual world.
30530	41750	So, what we are going to do in this is, we are going to talk about the first principles, the basics that you can use to emulate Wi-Fi in a VM, in a cloud, anywhere.
42030	49030	And we will also discuss why it is important, what are the other easy ways of doing it.
49270	58690	But the idea is, there are so many tools out there that you can use, but they don't really give you the full understanding of the basics that you are using.
58690	65450	And some of these basics are also related to containers, you know, Docker containers, Podman, all the other things, right?
65470	70030	So, we'll talk about them, and yeah, I'm looking forward to this.
71230	76690	A little bit of introduction, my name is Nishant, I've been doing Wi-Fi for 10 years now.
76970	85350	I was in cyber security education for almost all of my career, currently serving as the Head of Research at Square Enix.
85350	89710	So yeah, this is my second time at RF Village.
90370	95590	I have also taught Wi-Fi hacking classes at Black Hat for 2-3 years.
95770	97370	So yeah, that's all.
98370	102050	So first question is, why exactly do we want to do this?
102310	119370	The simple answer is, you can buy one device, you can buy it for 2.4 GHz, you can buy it for 5 GHz, but then when things get more complicated, there is a limit to how many devices you will be able to buy, how many devices you will be able to set up, how many devices you will be able to play with,
119370	120110	right?
120290	131210	And if you want to simulate complicated scenarios, for example, you want to simulate 100 devices, 10 access points, they are connecting, disconnecting, they are moving farther, backward, right?
131210	134590	And then you also want to do Wi-Fi security on it.
134590	142090	When we talk about it, Wi-Fi security is your monitoring, after that you analyze it, and then you also attack the older schemes.
142090	148130	We know that WPA3 is practically unhackable, if you want to put it that way, right?
148130	156970	If you are not talking about social engineering and all the other kind of deceiving attacks, if you are talking about technical attacks, WPA3, they have kind of locked everything down.
156970	163770	However, if you talk about WPA for some reason, WPA2 enterprise, you have your MSCHAP, V2 and all of that, right?
163770	169230	That still you can hack, and a lot of places, that is what you are going to find as well till today, right?
169230	170070	Even today.
170370	174690	So if you want to practice that, these setups give you more flexibility.
175390	182010	And the reason we had built this is because at one point of time, we were building Wi-Fi labs in the cloud.
182010	184490	We did that, all of that worked great.
184570	186470	So same things we are going to discuss.
186470	190690	It's scalable, it is easy to set up, you can set up it in the cloud, in the VM.
190690	195030	If you make a mistake, you just take it down, run it again, good as new, right?
195050	199690	And for the new people who are trying to learn Wi-Fi security, it is very, very, very helpful.
199690	205150	Because you don't have to deal with all the uncertainty that comes with real packet capture, right?
205150	213330	You are not able to find the packet, and I'll say 50-60% of the mistakes that are there when you are capturing it.
213330	216710	So again, this doesn't really mean that you can get away with that part.
216710	221350	If you are doing it in real world, obviously you have to learn how to catch the packet correctly.
221430	227710	And that's the combination of your tools, bands, and the hardware.
227710	241930	If it is an 11 AC that you are trying to flip, you have to make sure that your device is also 11 AC, and you are also supporting the bands and the MIMO and all the other things, right?
241930	245770	You have the throughput requirements of the same, and all of that.
245770	248990	So 60-70% work is there, and it still needs to be done.
248990	254470	However, if you just want to skip that part, you are like, OK, I get it, it is complicated, I can do it.
254470	263230	But right now I just want to talk how to analyze it, how to create my own scenarios, how to attack these things, in a VM, that's what we are going to talk about.
264270	269370	So, this is pretty much what you need in terms of basic principles.
269370	285570	This will create your first setup, and then on this setup, just like you use your Kali attacker tools here, you use your air mons, air dumps, and then all the other, WPS, Wi-Fi, all of that can run on top of this.
285570	297090	Because all of these tools, they assume that you have a Linux machine, you have a Wi-Fi adapter, which is in monitor mode, and then you are doing things on the basis of that.
297090	307750	So, we are talking about this lower stack, how to emulate it, because once you have it, it's on a Linux machine, you can pretty much install anything and everything that is there on a Kali box.
308230	309830	So, what all is this?
309830	312910	First thing, obviously, Linux required.
312950	320830	The main secret of this recipe, again, it's not really a secret, this thing is there for multiple years now.
320830	325870	So, I'm talking about 80211-SWC.
325870	329170	This is the hardware simulation for the Wi-Fi module.
329250	331230	It is there in the Linux kernel.
331330	338330	It doesn't come as a package, but you can pretty much use two to three commands and get it on your machine.
338610	346290	It is there for multiple years now, but most people don't know about it, most people are using it when they are using some other tools, and we'll talk about them as well.
346290	352770	But behind the scenes, on Linux machine, if you are emulating Wi-Fi, this is what is going to be used.
352770	358630	Because this thing gives you the exact packet capture as you'll get in the real world.
358790	368530	If you do a raw packet capture on it, if you do a monitor mode capture on it, it is the same beacon frame, it is the same probe request, it is the same probe response that you're going to see in the real world.
368610	369590	So, that's there.
369970	372310	Then comes namespaces.
372310	377490	So, Linux namespaces is a concept that we'll talk about, why it is needed in our setup, we'll talk about that.
377490	381250	After that, hosted PD, I'm very sure most of you are already aware of it.
381250	385170	It is the most used, I'll say, access point creator.
385170	386710	That's the easy term for it.
386710	405970	If you have a Linux machine, if you have an IoT device which is running Linux, like most of your access point devices, your open word and all of that, on that, if you want to create an SSID, that's the Wi-Fi network, wireless network, this is what you use.
405970	409450	It is battle-tested, it is around for more than 15 years.
409450	415190	Most of your enterprise-grade machines, APs, they actually use this thing.
415190	418030	And you can pretty much use it in like two commands.
418030	420650	We'll use that to create our access point.
420890	423370	Then wps-applicant is the another part.
423370	425470	It comes installed in your Linux.
425470	433130	This is the thing that makes your Wi-Fi card to connect to your SSID if it is protected.
433130	442670	So when you are connecting to a WEP, WPA2-PSP, WPA-EEP, this is the thing which is making that handshake, and you can see all of that in the logs as well.
442670	446510	So we will be using this to create or emulate the client.
446510	455630	So we'll do this for one thing, and the same logic with some shell scripting, Python, you can actually then replicate it, you can create a big scenario.
455630	463970	So in one PC, in one virtual machine, you can have like hundreds of these devices connecting to each other, roaming.
464070	472970	And if somebody just takes a look at the packet capture, barring the signal strength, that's the part that another tool will take care of.
473050	475890	It will look like it's a high-density Wi-Fi environment.
475890	478530	You are seeing all of this traffic, it behaves just like Wi-Fi.
478530	483590	You will have channels, and you will have to hop the channel here to all of this.
483830	487490	So till here, you are covering layer 2.
487490	492730	So your layer 1 is obviously physical, second is the MAC layer, that's where your Wi-Fi actually operates.
492870	495150	Then comes the IP layer connectivity.
495150	498350	Because if you really want to emulate it, this part is simple.
498390	501830	The main complexity comes after this, because you have one machine.
501830	506510	On that one machine, obviously, you can create two of these interfaces.
506970	512250	And you can make one of them as access point, another one is a client, you connect them up.
512250	516950	After that, you need to give them IP addresses if you really want to simulate traffic.
517210	519870	And that is where the namespaces and all other things will come.
519870	522870	So yeah, dnsmasq is going to be our DHCP server.
523050	528070	And then dhclient is going to be the client which you will use to request for an IP.
528070	537750	And once you have layer 3 connectivity, after that, you can pretty much run any server, any appliance, and simulate all the traffic that you want to do.
537750	545210	Once layer 3 connectivity is there, after that, the only thing that remains is to install stuff and then use it using some scripting.
545370	547230	So this is the whole stack.
547230	548950	That is how it looks like.
549390	550830	So what do you need?
550830	553330	You need a Ubuntu desktop.
553330	556610	I have used 24.04 just to keep it fresh.
556610	562550	Once you have this machine, and you can either install it from Ubuntu's website.
562550	564790	You can take an ISO or VM from there.
564950	568290	Or if you want to save some time, you can go to osboxes.org.
568290	569210	It's a free site.
569210	571090	I'm very sure most of you have used it.
571090	574670	You can directly download a ready-to-use VM from it.
574810	575910	And you download it.
575910	577330	It is ready to use.
579250	583690	And obviously when you run it, I'll obviously not go through the setting up part.
583690	586130	I'm very sure that most of you already know it.
586930	588410	VirtualBox you can use.
588490	590550	VMware player you can use for it.
590550	593930	You're running it on a Linux machine, Windows machine, doesn't really matter.
593930	595430	It's a guest VM.
595590	600770	Once it is up, if you go inside, you'll see that obviously there is no Wi-Fi.
601150	603930	Because again, we have not plugged any adapter to it.
603930	605750	We have not started our work yet.
605750	615390	So once you're here, after that we are going to use this Mac 802.11 hardware simulation.
615510	622910	So what it allows you to do is, it will allow you to create these fake radio adapters.
622910	628030	On which then you can make them act like any way you want.
628250	629610	So there is no limitation.
629610	632770	It will replicate what your real device does.
632770	634190	It will behave in the same way.
636290	638270	So these are the commands.
638270	640810	First command obviously is to check the kernel version.
641070	644430	And second command is to install the build essential.
644430	645590	That will be required.
645590	649090	As I mentioned, it does not come with the default kernel.
649110	651890	You have to download some extra Linux modules.
651950	656750	And then you have to inject this to create these fake Wi-Fi adapters.
656750	658590	And that is what we are doing here.
658710	661270	If you take a look at this third line.
661270	663810	So in the second line we are installing build essentials.
663810	668170	We are also downloading and installing Linux modules.
668170	669450	The extra ones.
669450	670190	It's a package.
670190	670810	You download it.
670810	672390	A lot of other things come in.
672550	675650	Once it is done, you have to use the third command.
675650	676690	That is modprobe.
676690	678410	So modprobe is a generic command.
678410	679570	It's not specific to this.
679570	682850	You use it to inject kernel modules on runtime.
682910	684590	So that is what we are doing here.
684650	692630	So when I say kernel modules, these are the packages which are going to enhance or increase your functionality of your kernel.
692630	698330	And the reason it is not shipped with the default kernel is because you don't really want to make it bulky.
698330	701810	There are like hundreds of these things which are specific to some purpose.
701810	703650	You don't want to make it heavy.
703950	708870	But at the same time, you want the people who really want to use them to have an option to use it.
708870	710090	And that's what it is.
710090	711630	So you can use modprobe.
711630	713590	You can give the name of the module.
713650	716390	And then, as you can see, there is an argument.
716550	718210	Radio is equal to 3.
718210	722850	It means we are asking it to create 3 virtual radios.
722890	724650	And that is what it will do.
724650	730430	So once you do this, on the Ubuntu machine, you are going to see 3 of these interfaces.
730610	733330	wlan0, wlan1, and wlan2.
733330	736430	And you can verify that using this ip link show command.
736430	738910	This is how it will look.
739390	746110	So it is that easy till this point to actually get 3 virtual Wi-Fi interfaces.
746110	751010	These interfaces are going to behave just like your real adapter will behave.
751450	752930	Minus all the limitations.
752930	756330	You don't have to worry about if it is a 2.4GHz, 5GHz.
756330	759470	Does it support 80MHz or 160MHz or not.
759470	761270	You don't have to worry about it.
761270	762730	They support everything.
763290	766410	And they will capture all the traffic perfectly.
766410	768070	Because again, it's software layer.
768070	769130	There is nothing.
769130	771890	There is no unknown in this.
771890	777850	And that's why this makes a very good bed for lab and practice.
777870	782870	And the same is also being used by people to simulate high-density environments.
782870	784770	To run simulations there.
785770	788750	So here, the thing that we have highlighted.
789750	794330	swsim0 is the device that will tell you that yes, it is working.
794690	798810	Then wlan2, wlan1, wlan3 are the virtual ones.
798810	800130	And there is no limit.
800230	803830	You can actually put 16, 17, 20, 25.
803890	806190	And you will see all of these devices here.
806670	808390	So once this part is done.
808710	813710	If you do iwdev, just like you do when you connect any kind of adapter to your Linux machine.
813750	815130	You see all of these, right?
815130	816210	Same thing.
817530	820190	And now if you go back to your UI.
820410	823750	Suddenly there are 3 WiFi adapters with you.
823750	826730	Which you can use to connect or to do something else.
826730	830790	This UI part obviously is just to show you that it is system-wide.
830790	833210	It's not happening just on the command line.
833230	834750	But it will happen here.
834750	839090	If you try to interact with it, it will work just like a real device.
839610	841130	And even if you take a capture.
841130	843970	You will see the exact same thing that you see on the real devices.
843970	847350	Apart from the fact that it is not from the outer world.
847350	848690	It is from the inner world.
849710	851450	So now what you want to do.
851450	852830	And what we are doing here.
852830	854250	For this example.
854450	855970	So you are seeing 3 of these.
855970	856910	Now what we will do.
856910	858210	We will take one of these.
858210	861170	And we will make it play as client.
861430	863170	And that's where the complexity starts.
863170	865050	So till here only 3 commands.
865310	866930	Not much difficult.
867430	869270	So what we are doing here.
869310	873430	Whenever you are plugging anything to your desktop Ubuntu.
873430	876150	It has a network manager running in the backend.
876170	879010	And that will create a lot of problems when you are doing these things.
879630	881410	If you know what you are doing.
881410	882290	Just turn it off.
882290	884530	If you are not using that VM for anything else.
884530	885250	Just turn it off.
885250	887490	It is going to do a lot of other things otherwise.
887510	888970	But here what I am doing is.
888970	891810	I am just removing one of these devices.
892090	892650	WLAN2.
892810	894290	From the managed world.
894430	897470	So that this network manager is not messing it up.
897470	899790	Because I want to move it to an isolation.
900190	904350	Where I can make it use or work like a client.
904610	906610	And we will do all of that in the same machine.
906610	907550	That's the beauty of it.
907550	909170	And you can do it multiple times.
909170	912750	You can have 15, 20, 100 of these on the same VM.
912750	916770	And the good thing is you don't even need a very powerful machine.
916770	919830	You can actually take a bare minimum VM stack.
919830	921190	And it will run online.
921950	923830	So once that part is done.
924090	925730	If you go here.
926070	930270	What I am doing here is pretty familiar to I think most of the people.
930450	935730	So this is a bare minimum open network configuration for HostAPD.
935790	938670	HostAPD as you remember I just described.
938670	942690	It is the software that all of your enterprise devices.
942690	946090	All of your Wi-Fi devices which are running on Linux.
946090	947930	Use to create your Wi-Fi networks.
947930	950310	The SSIDs are created using this.
950310	952550	The configuration are also like this.
952550	955790	The only difference is when you do it in real world on real devices.
955790	957710	You will see much more parameters here.
957710	962370	So HostAPD in total actually supports over 150 plus parameters.
962370	964730	Good thing is even if you don't define them.
964730	967050	It will assume default values.
967050	970450	And it will only take the values that you are providing.
970450	971790	And make them different.
972090	974570	So you have provided that part.
974750	978870	And then here you are just running it with the configuration file.
979030	980830	HostAPD is very easy to install.
980830	983070	You can do apt-get install hostapd.
983070	984430	It just works.
984430	988290	And the reason I am not going into each and every command.
988290	990590	Is now because you have chat-gpt file.
991090	992210	So yeah.
992310	993590	Very easy to see.
993590	997350	I feel that the way today's world is working.
997350	999010	If you know what you are looking for.
999010	1002270	It is very very very easy to start from there.
1002390	1005910	However a lot of people don't really understand the basics of it.
1005910	1007370	And that's what I am trying to clear up.
1007370	1010130	Rest using chat-gpt and clod and all of that.
1010130	1014010	You can write very powerful simulations around these basics.
1014010	1015970	Which will create the main setup.
1016110	1017490	So once you do this.
1017490	1019310	You have an access point running.
1019310	1020670	You have an SSID.
1020670	1022390	The name is OpenTestNet.
1023250	1024550	It's on channel 6.
1024550	1025950	You can assign it a MAC.
1025950	1028110	Because by default when you inject these.
1028110	1031150	The MAC is 0000.2 or something.
1031150	1032390	Which looks very odd.
1032390	1034670	When you capture traffic on it.
1034770	1036310	But yeah once you have this.
1036310	1037790	You have SSID running.
1037830	1041090	And if you go back to your GUI.
1041110	1044590	You will actually see that there is a network operating here.
1044590	1048070	Just like you see in the real world on your machine.
1048430	1050470	Because again exact same thing.
1050470	1051470	And if you click on it.
1051470	1052910	On the HostCPD side.
1052910	1055570	You will actually see all of these logs appearing.
1055810	1057270	So what we just did.
1057410	1059570	We made layer 2 connectivity.
1059570	1061690	Between these two interfaces.
1061690	1063050	On the same machine.
1064210	1066630	Again it is a layer 2 connectivity.
1066630	1069570	We don't really are dealing with netmasks.
1069570	1071590	And layer 3 complications as of now.
1071590	1074930	So that's why we can keep them in the same space.
1075070	1077690	And nothing will break loose.
1077890	1080230	However when you want to move forward.
1080230	1081890	And you really want a real lab.
1081890	1083070	A real connected lab.
1083070	1085010	Where you are maybe running a web server.
1085010	1086450	Or something on one side.
1086450	1088570	And client is then trying to access it.
1088610	1091810	Or you have a P2P application.
1091810	1093830	That is running on different clients.
1093830	1095790	Exchanging traffic through that access point.
1095790	1098810	You will need layer 3 connectivity.
1099270	1103510	And that is where the concept of Linux namespaces will come in.
1103510	1108430	So I am very sure that most of you guys have already worked with Docker containers.
1108430	1112090	So your Docker containers or for that matter any kind of Linux containers.
1112090	1114570	They are built using Linux namespaces.
1114570	1115890	What are namespaces?
1115950	1119470	This is a way to isolate the system resources.
1119670	1122330	So if you want that on the same machine.
1122330	1124850	When I list my interfaces.
1124850	1127990	I should be able to see two resources on one side.
1127990	1130570	And another one in another section.
1130570	1135730	And these resources should not know that there are other resources on the same machine.
1135730	1137050	So you are isolating them.
1137050	1139070	Same way your containers do.
1139070	1141390	So when you are running a process in a container.
1141390	1145150	It does not know what is happening outside of container.
1145150	1147370	What is happening in another container.
1147370	1150870	And that is also implemented using namespaces.
1150970	1154590	So for the containers we use process namespaces.
1154590	1156230	And network namespaces.
1156230	1157610	And IPC namespaces.
1157610	1158950	And mouth namespaces.
1158950	1160430	However in this case.
1160430	1164690	Because we are just concerned with the network part of it.
1164690	1166830	We can just use network namespaces.
1166830	1170450	So this is how you set a network namespace.
1170450	1172390	You do ip netns.
1172390	1174830	Again stands for network namespaces.
1174910	1176210	Then you say add.
1176230	1178490	And then there is the name of the namespace.
1178490	1179770	It can be anything.
1179850	1181870	It's a construct that you are creating.
1181870	1184570	So that you can isolate these on the same machine.
1184570	1186650	Because if you don't isolate it.
1186650	1188470	Then there is a problem called.
1189970	1191630	R... R what?
1191630	1192630	Not R flooding.
1192630	1193890	R confusion or something.
1193890	1194790	So there is this thing.
1194790	1197650	If you have two interfaces on your machine.
1197730	1199230	They are able to see each other.
1199230	1201890	And if they have IPs from the same subnet.
1201890	1205470	The machine doesn't know which interface is the right one.
1205470	1208470	So it tries to send the traffic from both of these interfaces.
1208470	1209390	And what will happen?
1209390	1211770	Your machine will actually lose connectivity.
1211770	1212970	It won't be able to work.
1212970	1214290	Because your packets.
1214290	1215490	They are going from one interface.
1215490	1218450	And then they are trying to come from another interface.
1218510	1220610	So to avoid that confusion.
1220610	1223490	That's where your network namespaces are required.
1223490	1224810	So what we are doing here is.
1224810	1227210	We are setting up one more namespace.
1227410	1229110	So when you log into your machine.
1229110	1231130	There is always a default namespace.
1231130	1233630	That is where you are playing most of the time.
1233630	1235970	You only go into creating additional ones.
1235970	1238290	When you want to do something like containers.
1238370	1239690	Containers do this all the time.
1239690	1242930	That's how you can see a ETH0 inside the container.
1242930	1244810	And outside as well.
1244810	1246050	So same thing we did here.
1246050	1247450	We created a namespace.
1247450	1248370	After that.
1248370	1252430	We made sure that that namespace has a local interface.
1252430	1254430	It is the local host.
1254430	1256250	Local interface that you see.
1256250	1259050	And if you want to check the namespaces that are created.
1259050	1260190	If you do list.
1260190	1263170	You will see the one that you have created here.
1264610	1266050	Once that is there.
1266050	1267290	What you can do.
1267290	1269550	You can take one of these devices.
1269590	1272830	And you can move it over into the new namespace.
1272870	1275370	So this command here precisely does that.
1275370	1277110	When you say iw.
1277110	1282010	This is the utility that you use to play around with the WiFi companies.
1282010	1284710	PHY stands for Physical Device.
1285210	1288090	PHY2 stands for Physical Device 2.
1288110	1289570	So if you go back.
1289770	1292790	And if you take a look at this here.
1292790	1295210	What you will see is that every device.
1295210	1296250	Every virtual device.
1296250	1298610	Just like the real device that you plug in.
1298610	1300330	Is marked with the name.
1300450	1303770	In this case it is PHY2 that we want to move.
1304270	1306990	So go back here.
1307110	1309170	And that is what you have done.
1309170	1310590	Now after doing this.
1310590	1312310	If you run iwdev.
1312710	1313510	Surprisingly.
1314010	1315690	Or not surprisingly.
1315690	1317610	Because we knew this is going to happen.
1318890	1321030	PHY2 is not there anymore.
1321030	1322110	It has moved.
1322230	1324090	And currently the command that you are running.
1324090	1326270	It is running in the default namespace.
1326430	1328190	So that is why you are not able to see it.
1328190	1330010	Your commands are not going to see it.
1330010	1331950	And that is precisely what we want.
1331950	1334990	If we really want to do layer 3 connectivity.
1334990	1336030	On the same machine.
1336030	1337450	Using the same subnet.
1337450	1338910	And this can be extended.
1338910	1341390	And that is how your containers also work.
1341590	1342790	They are on the same machine.
1342790	1344390	They have different interfaces.
1344390	1346210	You are doing networking between them.
1346210	1347550	They are in the same subnet.
1347550	1348890	Still everything runs.
1348890	1349270	Why?
1349270	1352210	Because these interfaces are not seeing each other.
1352310	1354170	They feel that they are in separate machines.
1354170	1355730	And that is what we are doing here.
1356110	1359150	So you have PHY1 and PHY2.
1359270	1360670	In this namespace.
1361250	1363250	If you go to another namespace.
1363250	1364230	So here.
1364670	1366170	When you run ip link.
1366170	1366930	Like this.
1366930	1368790	It runs in the default namespace.
1368990	1372270	You are seeing two of these devices here.
1372330	1374970	And then you use ip net ns.
1374970	1377130	So this is the command that you use.
1377130	1379770	When you want to run a specific command.
1380230	1384270	In a specific network namespace.
1384270	1385930	So you do extc.
1385930	1387630	That is execute.
1387730	1390450	Name of the network namespace.
1390450	1392510	And then the command that you want to run.
1392510	1393890	So now when we are running it.
1393890	1396430	It is not in default namespace.
1396430	1398890	It is in the namespace that you created.
1399090	1400630	And as you can see.
1400630	1402510	It also has a local one.
1402510	1404230	And then WLAN2.
1404370	1408850	So now WLAN2 cannot see WLAN1 and WLAN0.
1409070	1415490	And that is the magic behind your virtualization of this kind of lab.
1415590	1418730	It is the same concept that we have borrowed from the containers.
1418730	1421390	This is how containers are working behind the scenes.
1421390	1424030	And you can extend the same logic for this.
1424030	1427290	There is also one more module on similar lines.
1427290	1430570	It is MAC8015.
1430710	1434210	So you can also use that to simulate that network.
1434350	1435850	As far as my knowledge goes.
1435850	1440490	Currently there are only two of these modules that you can use to simulate very closely.
1441170	1443830	There are multiple other options as well.
1443830	1446150	But most of these options they actually emulate.
1446150	1447130	They don't simulate.
1447130	1448970	So if you take a packet capture.
1448970	1451750	And if you take a look closer on their behavior.
1451750	1456330	You will actually see that their behavior is very different how real devices work.
1456350	1460610	But in this case it is as good as your physical device.
1460610	1466550	Apart from the fluctuations in the power and the physical disturbances.
1467070	1469410	So once our setup is ready.
1469550	1471370	What we need to do now.
1471970	1477210	We are taking this one interface WLAN1 on which we have already created an SSID.
1477210	1479930	Because we are now talking about layer 3 connectivity.
1479930	1481210	We need IPs.
1481210	1483330	So we are setting an IP address on it.
1483650	1485430	Then we are turning it on.
1485430	1488290	If it is not on, it is already on but just to be sure.
1488650	1490190	And then we are creating this.
1490370	1493710	This is the same file that we have used to run that access point.
1493730	1498190	You can also run it as a daemon by using "-b".
1498190	1499390	So that's what we did.
1499390	1500790	Access point is enabled.
1501670	1506350	And this is the default namespace that we are currently dealing with.
1507510	1509170	SSID will start.
1509170	1515590	If you do IWDEV, you will see that instead of saying managed, now it will say access point.
1516690	1518770	Because it is operating an SSID.
1518910	1520970	HostAPD is making it do this.
1521130	1523170	The second one we are not playing with.
1523170	1526870	This is the one that network manager is currently playing with.
1526870	1529070	The Ubuntu desktop network manager.
1529070	1531170	You can safely ignore it for now.
1532270	1534470	Then comes the client part.
1534470	1540030	And this is where you actually run this logic in the other namespace that you have created.
1540290	1543270	So you first switch into the other namespace.
1543270	1549250	What I am doing here, I am launching a bash shell in this new namespace that I have created.
1549410	1552090	Once you do that, you are inside it.
1552090	1555090	If you do IWDEV, it will run any other commands now.
1555090	1558210	Because you are inside the bash which is running in this namespace.
1558210	1562730	It won't show you the interfaces that are there in the default namespace.
1562730	1565450	But only the one that you moved and the local one.
1566090	1571050	And after that, we created this very simple configuration file.
1571090	1574550	It is to connect to this open network that is there.
1574770	1577970	And then we will use WPSApplicant.
1578010	1580050	We will give it the interface name.
1580050	1582250	And then we will give it the configuration file.
1582250	1586030	So whenever you are using a Linux machine and you are connecting to any network.
1586030	1589930	Back in the back, WPSApplicant is the one that is running and doing all the jobs.
1589930	1592610	So here we are just running it using the command.
1592610	1597270	Otherwise, when your network manager has to connect it, it also is going to call it.
1597570	1600890	So by doing this, now you have that connectivity.
1601270	1611370	And after that, the only thing that remains is on the access point side, you have to run dnsmasq or any other tool which can run a DHCP server.
1611870	1612930	That part is done.
1612930	1619630	Then you come on this side and you run dhclient, which will request for the IP address and it will get the IP address.
1619630	1623310	And you have full layer 3 connectivity on the same machine.
1623310	1625630	So this is the basic construct.
1625670	1631710	Now, once you have this, as you saw, everything was done using Linux commands.
1631710	1633470	How do we automate it?
1633470	1645950	You write a shell script, which will generate random names, random IDs, and then you loop over it again and again and again, depending on what exactly you want to make.
1645950	1655190	If you want to simulate 5 to 6 of these networks, you can make a more elaborated or multiple post-APD computation file.
1655190	1661350	You can run it and you'll have 10 or 20 or 30 or 40 networks there.
1661350	1666130	You want to create roaming clients, just create clients, run WPA supplicant on it.
1666130	1667190	They'll start probing.
1667190	1669150	If they find the network, they'll connect.
1669150	1675230	If they connect, then if you're running DHCP, they're automatically going to get IP connectivity.
1675230	1678250	So this way, you can pretty much simulate.
1678270	1679830	Even WPA3 you can simulate.
1679830	1682090	That's another thing that you won't be able to break it.
1682090	1689770	But if you really want to quickly capture packets of the handshake, for WPA2, WPA3 as well, there is a handshake.
1690190	1698450	Even if you want to simulate WEP for some reason, you're trying to look at packets, you want to see how exactly those attacks used to work.
1698510	1700690	It will work perfectly in this case.
1700690	1700970	Why?
1700970	1702530	Because you're not missing any packet.
1702530	1704030	You'll see everything.
1704030	1706770	And again, this also has a channel of concepts.
1706790	1716210	So you still have to use your error dump to jump around, to see all the things, and then to set on one channel, then to lock on one target, and then to do all of this.
1716630	1719390	So yeah, this is how you do it.
1719430	1722470	It will run on any kind of VM that you run.
1722470	1725010	It actually even runs on open word.
1725010	1727870	So if for some reason you want to do that, you can do that.
1727870	1729390	It also runs on Raspberry Pi.
1729390	1731010	We tried it there as well.
1732010	1742350	The only thing is that when you do this on IoT devices, sometimes you might have to compile their kernel and their firmware using the buildchains.
1742410	1745250	In desktop it is easy, that's why I'm showing this to you.
1745250	1751550	If you try to do this with open word, you have to take the whole source code, you have to make the changes in the configuration file.
1751550	1754950	So when the kernel is compiled, at that time you can do this.
1755010	1759110	So it is a little bit more difficult, but not impossible, you can do it.
1760470	1764970	So next thing is, what if I'm too lazy to do all of this?
1764970	1771490	I understand there are namespaces, I understand there is hostcpd, nwps-applicant and all of this, right?
1771490	1780250	But I don't really want to get into scripting and to fix it, even with Cloud or other things.
1780250	1783690	So in that case, people have created something like this.
1783690	1785870	They have Mininet Wi-Fi.
1786550	1788290	How does this work?
1788290	1790450	Exactly the way I stated.
1790850	1793950	So what they have done, they have taken the same construct.
1794230	1796970	They have done all the plumbing for you.
1796970	1799070	So you can just run commands.
1799410	1804110	And by using these commands, you can pretty much simulate all the things that we just discussed.
1804110	1811070	You can have multiple clients, multiple APs, all of that, by using very simple things.
1811070	1814990	And here, you are seeing a diagram that I have taken from their site.
1814990	1818670	And the reason for that is just to show you that all of this, you already know now.
1818670	1822210	So you have these WLAN1, WLAN2, WLAN3, same thing.
1822210	1823570	How they are doing it.
1823570	1825190	Same module we talked about.
1825190	1828250	Now we know how to inject it, how to do it on our own.
1828950	1831590	This is called Netlink Socket.
1831610	1834210	It is here for depiction purpose.
1834210	1835390	This is how it actually works.
1835390	1837470	But yeah, you don't need to know about it.
1837470	1840130	It automatically just works if you are on Linux.
1840610	1843630	And here, they are creating different namespaces.
1843630	1846830	And in the namespaces, they are mapping these.
1847710	1849830	Same way, like we did.
1849950	1853130	And on top of that, you will have your connections and all.
1853330	1856770	So easy way, very good documentation as well.
1856770	1862010	Till the time you are not trying to simulate something very complicated, it will just work.
1862850	1866390	And then, what is more that these guys are providing that we didn't discuss?
1866390	1868970	So we didn't discuss the physical part of Wi-Fi.
1868970	1876890	Because as your access points are at one place, your clients, if they are moving, the signal strength is going to be varying.
1876910	1885410	Even if the access point is stationary and you are also stationary, due to the physical factors, there are so many things that actually interact with Wi-Fi signals.
1885410	1892450	So even if I stand here, the Wi-Fi is stationary right there, you will still get packets of varying signals.
1892610	1896770	So all of that, if you want to simulate, then this thing can do that.
1896770	1898450	It simulates moving targets.
1898450	1906810	So you can actually code or tell it to create moving clients from one access point to another access point.
1906810	1909410	And you will also see the switching being happened.
1909430	1914010	So when you are moving in a very big campus, you see a lot of these access points deployed.
1914010	1919150	And what happens is when you move from one location to another, automatically a handover happens.
1919150	1926070	So you switch from one access point to another one, the same way you switch your mobile networks when you move through space.
1926070	1928670	This thing can also simulate that part.
1928670	1931390	So you will see one client disconnecting and connecting on the other side.
1931390	1935950	And that's the reason why you can use this to run simulations on a bigger scale.
1936290	1939930	Propagation also, but that's not really for security purposes.
1939930	1943110	That is if you really want to understand how the propagation works in Wi-Fi.
1943130	1944450	So that's also there.
1945310	1950570	And the good thing is that now they also have an easy-to-deploy container board.
1950570	1953710	So you can just run these commands.
1953710	1956130	It will create multiple containers.
1956130	1963270	These containers, if you go into these, these will behave like different, different machines, which are connected using Wi-Fi.
1964310	1967330	So it was very easy to do in Docker.
1967330	1976570	Now you can also do it using Wi-Fi, where it feels like that you are using a wireless network, but essentially it is nothing but software.
1976930	1978710	So yeah, very easy to use.
1978810	1980210	What are other options?
1980210	1982190	You have NSP.
1982210	1985010	It's called Network Simulator 3.
1985190	1989650	It's more for the wired thing or the protocol part.
1989650	1992990	But can we do 802.11 on it?
1992990	1993870	Yes, you can.
1993870	2003110	However, if you try to capture the packets, the captures won't work the same way as they will with 802.11 SW-SIM.
2003190	2005250	You have another thing called Core.
2005250	2006450	You can look it up.
2006450	2007450	That's another solution.
2007450	2009610	It is more tightly coupled.
2009610	2011770	So you cannot change a lot of things there.
2011770	2015070	That's why not really the best place to start.
2015190	2018010	Then you have MiniNet Wi-Fi and then obviously DNS3.
2018010	2022130	But DNS3 does not really support the Wi-Fi frames.
2022130	2024790	So you'll only see these being emulated.
2024790	2029670	You'll see the traffic of Layer 3 and above, but Layer 2 you won't be able to see.
2029670	2047110	So these are the different ways by which you can create your own cloud Wi-Fi lab or your home Wi-Fi lab, where you can have multiple of these devices and then you can run simulations, attacks, floods, de-auths, if you wanted to do that and now WP3 is not letting you do that.
2047110	2050430	You can create one and then do a de-auth there.
2050430	2051890	You can study the behavior.
2051890	2055150	You can see in MiniNet.
2055150	2063470	In MiniNet, you can actually see that when you move a client and you do de-auth it, it will go for the nearest one with stronger signals.
2063470	2070550	All of these things you can literally see, which are very, very, very difficult when it comes to similarities in real world.
2070550	2074370	In real world, you can speculate and then you can observe.
2074450	2076990	Still, you are going to be wrong for the most part.
2077230	2077870	So, yeah.
2078590	2079970	So that's all.
2079970	2083430	If there are any questions, please throw them my way.
2084810	2085570	Thank you.
