start	end	text
0	2800	All right, let's get started.
2880	4780	Thanks for coming to my talk.
5160	8260	Weird and wonderful things your access point never dreamed out.
12060	16260	Yeah, this guy said I smell good, so you should come closer and enjoy that.
19720	21480	Yeah, come up closer.
21480	22980	It's not very loud here.
25920	27100	It's not loud down there.
27100	28180	It's perfect up here.
30380	43770	All right, so the idea I had, it was a few years ago, I was playing around with some basic Wi-Fi hacking stuff and I realized how low level you can actually go.
44030	49570	And I had way too much fun with it and I thought I'd share with you guys some of the fun I had.
49570	54990	And yeah, it's for fun and certainly not profit because it's ridiculous.
54990	62090	It's not really very useful, but it's a lot of fun and interesting to see very alternative ways you can use Wi-Fi.
62430	71250	If you don't bother with access points or association or any kind of retransmissions, all the stuff you get from the higher layers, just drop that.
71250	76490	You can do some stuff that's more like ham radio, more low level.
76790	83250	So it turns out it's possible to send frames with very little overhead, very few headers.
84610	89050	You can put your socket into this raw socket mode or you can use Scapey, it's a little shorter.
89050	89910	I'll show both.
92230	97330	So I'm mostly going to be showing some CLI demos and I'll be showing you some code.
97330	101630	It's all code that mostly fits, at least the first couple of them, mostly fit on one screen.
101630	109110	It's like short code, just to get an idea of the way too much fun I had when I was playing around with this stuff.
110090	112870	And I'll show in Wireshark that it's actually going out in the air.
112870	114830	So I have a couple of these.
114830	121750	I have another one here that allow injection of raw 8 or to 11 frames.
122110	130650	So the first I just show you the absolute, I think most bare bones, how can you just send a frame and receive a frame with as few lines as possible.
131430	134590	And I'll use that to do something like AirDrop.
135590	137670	I won't call it AirDrop, I'll call it FileDrop.
137670	143070	And I'll show a walkie-talkie idea, which is a similar idea.
144110	147290	And then MeshTastic, I don't know if any of you play with that.
147730	158150	It's an interesting mesh network that doesn't use Wi-Fi at all, but you can kind of shoehorn it in to use Wi-Fi and that's what I'm going to show.
158970	166790	And then WifiFS is another interesting idea of a completely alternative view of Wi-Fi, different way than Wireshark.
167770	174890	Okay, so first of all, the simplest possible, I think at least this is the most minimal 8 or to 11 frame possible.
175210	179490	Just use the socket mode or you escape, I'll show you both.
184730	188570	Here's some code that transmits.
188650	193510	I open a socket and bind it to my Wi-Fi interface.
193510	198910	There's a few headers unnecessary like a source, destination, and what access point you're connected to.
198910	201410	So I just made up some headers there.
201950	210850	And there's some radio, because of the way injection works, you do need to add another kind of a header for the injection to even happen, but that isn't actually transmitted, that part.
211190	216770	And there's some very minimal 802.11 header you need, so I just hard-coded that.
216970	220490	Actually, this is the header that includes the source, destination, and so on.
220590	221690	And then send.
223650	225190	So let's try it.
225190	237090	So by here, this tab I'll be transmitting, probably sending now.
237090	242490	And in this tab, I'll be receiving the low world.
242490	244890	Okay, that was what we saw here.
244890	246690	And with a number that comes after.
246690	248630	Oh, I should share the receive as well, of course.
248630	249810	Receive is even simpler.
249970	255430	Again, open the raw socket, and then just call receive, how many bytes, like up to that many bytes you want.
255430	259750	But then you need to peel away the header, and then you're good to go.
259750	262750	You got completely raw packets.
263090	265270	But I mean, obviously, there's no retransmission.
265270	268350	If the listen device doesn't get it, it just doesn't get it.
268350	276830	There's nothing to know whether the frame actually went through, and there's no security, no anything, because you have all the normal niceties of Wi-Fi.
276890	280390	So it's more like a very basic radio, right?
281590	283470	Here's the Scapey version.
283470	293050	So Scapey is a Python library that makes it a little nicer, so you don't have to deal with this sort of bytes manipulation.
294610	300650	So a transmitter with Scapey, it has this funny syntax, actually, with slashes, that's a little weird.
300770	309430	But you basically, yeah, very few lines, call send, it's a function in Scapey, and there you go, you get the same.
309430	310870	Let me run that one.
311750	313210	Simple Scapey.
313370	314170	Transmitter.
315330	316910	Oh wait, this is a receiver .
317610	319370	Go over here to the transmitter.
319650	321110	Simple Scapey.
321750	322550	Transmit.
323630	324730	Then a receiver.
324730	326110	Yeah, starting from zero again.
326450	328110	See, it's the same kind of fact.
328110	329270	Okay, so that's the very basics.
329270	330090	It's baseline.
331810	334930	Now , take that, and you could build all kinds of weird things.
334930	337890	Like, the great thing about AirDrop is you don't have to be on the same access point.
337890	341370	You don't have to to have, like, authenticated, and connected, and so on.
341370	346350	You can just use two completely unrelated devices, and as long as both of these are in send and receive mode, they work.
346350	347590	I mean, Apple's AirDrop, right?
347590	350910	So I just wish something like that existed for other things than Apple.
351630	354250	And it's pretty easy to craft something like that.
354250	363530	Here's a really simple version that doesn't have any retransmission, doesn't have anything you probably want, but, you know, it works.
364770	367790	So the sender, the transmitter, again, I do the same.
367790	368930	I open the Wi-Fi interface.
368930	370630	I could have used Skate, but it would have been a bit shorter.
371650	373050	I open a file.
373670	375990	I read from the file.
377570	379110	Read back to the file.
380550	384350	Pack it up with the headers, and so on, and call send, because that's the basic idea.
384350	385670	I could open a file.
388450	390890	Oh, I read the whole file into memory here.
390890	391610	Actually, that's what I did, right?
391610	394490	And then I'm looking over the bytes of the file and sending them out.
394490	394970	There's a limit.
394970	399010	You can't send a megabyte in one frame, a frame to max to like 2k or something.
399310	401110	So that's why I'm doing like that.
401250	406930	And on the receive side, very similar, opening it in raw mode and receiving.
407630	414430	And I'm doing a little bit of, like, I made my own little header because I don't want to just receive any random frames that's going around.
414430	416490	I want to make sure it's the frame that I intended to receive.
416490	422830	So I put a little magic number in the beginning of the frame to see, like, oh, is this a frame that's part of my mini file pub here?
423070	424230	So anyway, let's try it out.
430320	437100	So I'll start a receiver in one tab and a transmitter over in this tab.
437520	442160	First, I'm going to just transmit a file that just had the words hello world in it.
442160	444000	It's really short, so it fit in one packet.
444160	445500	See that the receiver get it.
445820	446480	It got it.
446480	448160	It got the whole packet and it got it.
448160	453400	I made a little, like, MD5 hash that also sends WIP, just to make sure that it got the whole packet.
453660	456820	So in my receive directory now, I got my hello world.
456920	458020	That was what I sent.
459360	460800	It gets tricky.
460800	462720	Like, it's fine for tiny things, right?
462720	469020	But when you have bigger files, like this picture of CAC sent 30 packets.
469020	470260	Let's see over here.
470420	475460	We got it receive, receive, receive, packet by packet, but it only got 96% of them.
475460	477060	It didn't get all 30 packets.
477280	478760	So, okay, it's pretty good still.
478760	480880	We got... actually, it looks all right.
481600	483660	It got a viewable file.
483660	485500	There's going to be some missing bits in that file.
485500	486900	There's going to be some missing chunks.
487380	488580	So I can just retransmit it.
488580	492160	I made it so that just run it again, will send the same things again.
492160	495940	And, oh, yeah, finally, we got all the... this time, like, whatever was missing before came through.
496580	499360	And, you know, so run it a couple of times until it gets 100%.
499360	502180	And then you got the whole file and it matches.
503760	504580	So, yeah.
506320	507040	Okay.
507620	509560	Another idea, similar idea.
509580	510300	Let's take the same.
510300	513960	Instead of reading a file, let's read an audio stream and you get a walkie -talkie, basically.
513960	515280	You don't need connections or anything.
515280	520620	You don't need to be, you know, dialing each other at any kind of handshake, just like a walkie-talkie, basically, right?
520760	521520	Let's try that.
523860	528800	So first I'll start a receiver here.
528800	531140	Oh, actually, let me show you a clip real quick.
531380	532980	We have time.
535760	537320	Walkie-talkie receiver.
537720	539860	Yeah, let's look at the receiver first.
540940	544940	Receiver, again, open the raw socket, find it's a network interface.
545600	549060	And then here we're opening an output screen.
549060	552320	So like, oh, this is from this library called sound device in Python.
552520	558600	So like that's basically a place where just throw your raw audio frames and it'll play them.
558600	562720	At least, as long as you kind of keep up the pace and you don't have gaps, otherwise it will sound terrible.
562720	566200	But if you manage to pace it right, it'll sound all right.
567120	569220	So there's a thread that just plays.
569220	574280	I think I had another thread for, yeah, there's another thread that receives from this raw socket.
574280	576260	I unpack it a little bit.
576320	580360	Oh, I wanted to print out the loudness because maybe it's going to be hard to hear.
580360	581820	So at least we can see something.
582820	584140	Changing the sample rate a little bit.
584140	590400	It would be a little intense to send a very high resolution audio over this unreliable link.
590400	595720	So I'm like trying to lower the resolution a little bit to decrease the chance of success.
595720	598780	Okay, anyway, let's run the receiver.
599980	601340	And let's run the transmitter.
601340	603280	I won't bother looking at the converter inside.
603280	604760	Very similar, you get the idea.
605160	609300	It's opening an audio device and opening the raw sockets.
612860	617660	Okay, so let's... I got a speaker here.
617840	618340	Hello?
619440	625320	Oh, hello, hello?
626480	629920	Oh, okay, you can't really hear it.
629920	631500	But we can see something is coming through.
631500	633040	I'm printing how many packets per second.
633040	635480	And this is, I guess it's just really noisy here.
635960	637780	We can probably see when I blow into the microphone.
637780	639280	This isn't the receiver side, right?
640720	644860	The meter shows that there's more volume here.
651430	653430	That doesn't... Nope, not working right now.
653430	655890	Anyway, but packets got through.
655890	656870	The microphone part worked.
656870	657950	The receive part worked.
658150	659350	Sorry, the send part worked.
659350	660410	The receive part worked.
660410	662330	But it didn't play out the speaker, that part.
662330	663850	I don't know why it's broken right now.
663850	665790	Anyway, you get the idea.
666290	669370	Xdemo is this Meshtastic.
670230	680790	Meshtastic, like I said, it's this mesh network based on, not Wi-Fi, based on something called LoRa, which is like a long-range, low-power radio technology.
681670	688230	And it's popular with, you know, if you want to be like off-grid and be able to do messaging, it's popular for that.
689470	690630	I quite enjoy it.
690630	696450	I'm giving a talk about that specifically tomorrow because it's also 1 o'clock or 1.30.
696550	698970	But so here I did something strange.
698970	700970	Let's go back slides.
703070	704750	I did something strange.
704750	706690	A very elaborate and weird setup.
707030	713730	But normally Meshtastic is something that runs on a microcontroller, like an Arduino or something, with one of these special LoRa radios.
713730	716730	And then you talk to it using Bluetooth from your phone.
716730	718230	You can send messages that way.
718950	725370	But I thought it would be fun to just send, like, replace the LoRa layer and just use Wi-Fi instead.
725370	737410	So basically, if you had many laptops in here at DEF CON running this, you could, like, mesh network, like , it would retransmit your packet and get you to the other side of the hall without using any access points or anything, right?
737410	740250	So that's the basic idea.
740310	743230	So Meshtastic has this special Linux build.
743450	745310	They have a Docker image for it.
745570	756590	And it's kind enough to send out UDP frames on a multicast address instead of LoRa, like, just for this Linux build, for, like, testing purposes.
756630	764130	So what I did is just, like, listen to these UDP packets and then retransmit them out on the Wi-Fi as raw 802.11 frames.
764150	766970	And then there's a receiver side that does, you know, the same, the opposite.
766970	769450	They both, I mean, they both do the same both ways.
771210	774030	So script
779050	786930	for this is, basically, have a familiar open the raw socket thing.
786930	795590	And then I'm also doing something complicated to get the, the escapee for that, to get the packets from the multicast address.
795630	796990	A similar idea.
797950	799750	So basically, yeah, it bridges.
799750	800830	There's a Wi-Fi loop.
800830	806250	There's a UDP loop that watches for these UDP multicast packets on Meshtastic's kind of test interface.
806250	809650	And then it just bridges those to basically send them one to the other.
827150	828990	Oh, actually, first, let me show you.
828990	840610	So Meshtastic has, it's normally a phone app, like I said, but they have this web interface, which you could also use with the microcontroller-based one, same kind of web interface.
841010	851510	And right now, so I have two tabs open here with these two instances, this hexadecimal CAAB and hexadecimal D00D.
851650	866270	And if I write hello here from YouTube, the cafe, oh wait, hello was my,
870800	871460	here .
879330	880750	Okay, this is what I wanted.
880750	884330	I'm sending it from one, it's not coming to the other, because I'm not running the bridge, right?
884330	889030	But they're two isolated Docker containers are not connected right now, so they cannot speak Meshtastic.
889630	898830	So if we run our bridge script that I showed you before, but I've got it already.
905540	910880	Running, bring the bridge script from one of the Meshtastic containers, and I'm going to write to the other one.
913540	916720	Then, if I send, oh sorry, too many tabs.
917460	919980	Let's send the hello again.
921260	932480	Okay, now the bridge script picked up that there was one of these UDP multicast packages and sent it on the Wi-Fi, and the other bridge script got it on the Wi-Fi and sent it back on the other one's UDP interface.
932580	933620	It's opening the other tab.
933620	935180	Yeah, we got the hello again.
935420	938900	We didn't get the hello, we got the hello again, so that works.
939320	941040	Send the other way, hi.
941460	947600	We got the hi the other way, so theoretically, oh, I should show you proof that this is actually happening.
947600	960040	If I restart my Wireshark over here, so it's just capturing right now, and I'm just filtering it for the word Mesht, because I used that as my magic number in the beginning of my packets.
961200	965260	Send a message, hi, there we go.
965260	975240	And then it came out on the Wi-Fi interface, back into the other Wi-Fi interface, and yeah, it's encrypted, like the Meshtastic is encrypted, so you wouldn't see if Wayne's X here.
976640	981900	And there's two packets, because, you know, it has X, it has the transmission stuff kind of at that layer, right?
981900	984020	So, see all that.
987340	990020	All right, the last demo is
993840	994880	at site...
995940	998560	is this thing, Wi-Fi FS.
998600	1002580	So, FUSE is this amazing technology I've had way too much fun with.
1002580	1008100	It allows you, with really simple code, to make your own file system, basically.
1008180	1022900	Use this item package, you implement this interface they've defined, they expect there to be a read directory function, where you return what directories there should be in this file system, and a read function, so like, if, you know, if the OS wants to open a certain file path,
1022900	1027420	what should we, what bytes should we return to the OS, and a super simple interface.
1027420	1035960	So, you can imagine how we could plug this in with Scapey, to get a kind of a file system view of the Wi-Fi around us.
1035960	1036980	So, let's do that.
1041960	1049540	The code for this is a little bit more complicated, so probably won't go through that much of it, but a lot of helper functions.
1050900	1064760	And, but basically, you see things like here, read directory, where I'm doing things like, for different levels of the directory, like top level directory is going to be interfaces, which Wi-Fi interface do you want to, you want to look at.
1064760	1072580	It's going to be channels, and going to be, yeah, you'll see in a minute, but the point is, it's so nice and easy to implement these FUSE file systems.
1072580	1079920	We just implement these, read directory, and get attributes, these sensible file system functions.
1088690	1104350	So, the way you run a FUSE file system is, simply just run the Python script, and I had a parameter in my CLI, the program here for the, for this Python file, that I want to mount this directory as my virtual file system is supposed to do it.
1107190	1109830	So, that's this mount directory here.
1110290	1111950	So, let's look in your file browser.
1111950	1113990	Okay, I got two Wi-Fi interfaces.
1113990	1116850	Let's look at my USD1.
1116910	1117470	Boom!
1117470	1127970	It was like, it called the readdir function of the subdirectory under my USD1 Wi-Fi interface.
1128050	1137290	So, it stated, it wanted to enumerate all channels, and also, I guess the file browser likes to like, go into every, or you know, what's, it goes into every folder.
1137290	1142930	So, every time a channel folder is accessed, it switches channel.
1142930	1144470	That's how I've set it up, right?
1144550	1148350	So, let's go under channel six, and initiate.
1148350	1149550	So, now it's switched to channel six.
1149550	1158810	Like, when I go into a directory, the FUSE file system function gets invoked for read that directory, and it sees, okay, I need to change channel, but it went to channel six now.
1159110	1161150	And it's constantly monitoring for packets.
1161150	1164090	If I press F5, there we go, we got new packets.
1166790	1171270	As I refresh, I'll be getting more and more BSSIDs.
1171270	1179150	So, these are access point, basically, or at least the packets that had that MAC address in their BSSID field.
1179410	1193630	And also, it collects the broadcast packets with the beacons, you'll see there's, here's the RF villages, one of the CTFs, for example.
1193630	1200910	So, we could go in there, and then it just makes a file for each packet it's captured.
1200910	1203290	So, this is an alternative way.
1203390	1207330	Wireshark is probably a lot better for this, but it's just a different way to do it.
1207330	1217290	So, you can do interesting things with this, like, so here, I'm just LS-ing a directory, right?
1218450	1220470	So, let's transmit something.
1222790	1224190	Let's transmit something.
1224190	1231010	I'm just, like, transmitting my first example, the escapee hello world on channel six.
1231270	1240350	And so, if I go into my CD, into that directory of my Wi-Fi FS, I'm now in the channel six directory.
1240350	1249090	Now, unless I get all these directories with BSSIDs, like my, this example over here, the escapee example, it was just transmitting hello world, right?
1249550	1253350	So, now I could just grep in the file system, like I would grep in any other file system.
1254230	1261270	And there's probably hundreds of megabytes, oh, there we go, hundreds of megabytes already, because it's just capturing whatever packets comes by it, right?
1262090	1266050	And you got file, there's some garbage in the beginning, that's, oh, it says the file name, first of all.
1266790	1271650	And then there's some garbage, because that's, well, what looks like garbage here, that's the headers stuff, right?
1271650	1275950	And then we got the actual, I mean, the minimal headers there are, has to be some, right?
1276130	1280210	And then we got our actual contents that we transmitted.
1280230	1287270	So, a different way to filter packets, an alternative to Wireshark, probably not better, but it was fun.
1290310	1291590	And that's it.
1293730	1298370	If anyone has any questions, I'll be happy to answer them.
1299350	1300030	Yeah.
1302210	1303450	Is there what, sorry?
1305390	1308190	Oh, I'm sorry, no, I uploaded after this talk.
1308190	1309110	Yeah, I didn't upload it yet.
1309110	1309910	I will.
1315180	1316980	Sorry, you have to speak louder.
1323020	1326680	Do you mean whether there are other protocols that kind of go lower level like this?
1326800	1334920	I don't really know, actually, but I'd imagine something like AirDrop, they probably wrote their own, you know, standards, probably in a similar way, but I don't really know what Apple did there.
1335680	1351040	Yeah, actually, a friend of mine does like some drone technology where, like, up in, like, high up in the sky with great distances, you don't want to be, like, relying on, on, you know, on being constantly connected to an access point and so on.
1351040	1352880	So I think they're doing some, like, low-level stuff.
1352880	1354260	They might be useful for that kind of thing.
1354820	1356920	So, yes.
1361800	1365600	Oh, usually the ones built into laptops don't support it, unfortunately.
1365600	1372080	I mean, actually, this Samsung, where this Samsung laptop happens to support it, the built-in one does, but I'm actually not using the built-in one.
1372080	1373740	I'm using these external ones.
1373860	1376440	And I got, like, an Edimax something.
1376440	1377680	This one is a more expensive one.
1377680	1379080	I don't remember, actually, how much.
1379980	1382200	This Edimax one, it's a tiny USB dongle.
1382200	1383380	It's much cheaper.
1383820	1389320	But just, like, search for interfaces, you know, that support injection, you'll find a ton.
1390780	1391500	Yes.
1399580	1400600	Oh, oh, yeah.
1400600	1402700	I was experimenting on several computers.
1402700	1403500	Is that what you meant?
1403640	1404020	Yeah, yeah.
1404020	1406440	It definitely works across several computers, but it would be hard to demo.
1406440	1411400	So that's why I just put two access points, sorry, two interfaces on one computer here.
1413800	1417220	It's, sorry, I haven't yet hit publish on it, but I will after this talk.
1417720	1418740	There also.
1420320	1421120	Yes.
1423200	1425180	Have I tried, what did you say?
1427000	1428480	Like, other languages?
1429980	1430980	Ben 5 Thunder.
1431060	1432320	So I couldn't fight here.
1434880	1436220	Oh, MicroPython.
1436220	1438020	Oh, huh.
1438080	1440400	That'd be interesting, like, on an embedded device or something.
1441140	1442160	Yeah, I don't know.
1442160	1446660	I mean, like, on embedded devices, usually you, by default, have a very low-level access.
1446660	1451560	So I don't know how well Scapey, like, if there's kind of that supported in Scapey.
1452220	1456580	Yeah, no, I've not tried it, but I'd imagine it would be pretty straightforward as well.
1458540	1459380	Yes.
1473110	1474250	Oh, yeah.
1474250	1475610	Sorry, I should have been repeating the question.
1475610	1481630	You're asking, could we bridge any kind of TCP, any systems, like other protocols, ImageTastic?
1481690	1490550	Yeah, in theory, but then you might as well just use normal access point because they did all the hard work of, like, and TCP itself, you know, does read transmission.
1490670	1494230	So you might as well not use this for that.
1494290	1496170	It's not really meant for that.
1499660	1500680	All right.
1500680	1502360	Thanks for your attention.
