the note MCU is capable of detecting
trackable Wi-Fi signals coming from
nearby smartphones allowing it to turn
on an LED anytime we detect a friend or
enemy nearby we'll show you how this
works on this episode of cyber weapons
lab
[Music]
[Applause]
[Music]
it's
smartphones are supposed to randomize
your MAC address and hide the real one
when scanning for nearby Wi-Fi networks
this is important because otherwise your
phone is super trackable in the past
this has been a problem because everyone
from grocery stores to police would
track people's MAC address now new
devices such as iPhones and Android
devices all attempt of randomized or MAC
address as much as possible however in
practice this is actually pretty easy to
defeat
if you create a fake Wi-Fi network
that's similar to one that someone is
connected to before or even turning on
your phone opening your screen or
navigating to your Wi-Fi selection menu
all will send out a burst of identifying
probe frames which is what your phone
uses to identify itself as needing to
connect in your by Wi-Fi networks now we
can use that to be able to detect either
when our own phone is putting out these
signals or when a friend is nearby
by detecting these programs coming from
their smartphone now we can use this
node MCU and program it with this friend
finder code which I've also added the
ability to turn on an LED in one of
three colors depending on how many
friends you're tracking now I also
needed to implement a cooldown timer so
the LEDs will turn off after 1000
packets have been receive that do not
match any of the MAC address as we put
on the list now in order to get started
with this project you'll need a node MCU
which is kind of like on Arduino and
then Arduino IDE and a three color RGB
for pen LED in order to get started once
you have all those we can begin now this
project is based on the esp8266 friend
detector by ricardo oliveira and you can
see the original Hacksaw i/o page here
now you can also see the code which Oh
in the original version outputs to
serial but in our version we'll go ahead
and add a three color LED and also add a
cooldown timer in order to overcome some
of the timing problems I had when trying
to implement my solution now I really
like this because it detects the MAC
address not just in probe frames but
also in data frames and management
frames so all in all this is a super
cool project and I really enjoyed going
through the code and working on it now
the first step will actually be going
into the edge
we know homepage and downloading the IDE
now once you have this you'll need to
open it up and go into preferences and
go to the section here additional board
manager URL and copy and paste this URL
into it in order to make sure that we
have the correct libraries now as soon
as this is done you can go ahead and go
into tools boards and then board manager
and when you're in the board manager
window you can just type in esp8266 and
you should be able to find the community
package which we need to install here
you can see esp8266 by community is
available so go ahead and install this
and once you have it you should be able
to go into your tool setting and select
the node MCU as the module that you are
using now this is all we need to do in
order to start outputting code to the
node MCU so we can consider that stuff
done and go on to the github page where
we're going to get our code now here we
can go to the github for the fork that I
created for this project and we can go
into the front detector and see that
there are three different things we'll
need to download now you can go ahead
and get clone this by clicking on clone
or download and then opening a terminal
window and typing git clone and then
just pasting this in here and then
you'll be able to go into the folder and
see these three files now the first is a
dot Ino sketch which will be able to
open up in arduino ide
and then you will also notice two
libraries that ricardo actually wrote
for this project which again is super
cool now you'll need to include these so
i'll show you how to do that but first
you can go ahead and either copy and
paste this or just take the file and
open it up in arduino ide now if you are
going to copy and paste this make sure
you click on raw because otherwise these
numbers will appear and you can just
copy and paste this and be ready to
start working on the code
now this is the friend detector so we'll
go ahead and use this in order to modify
it a little bit to include the MAC
addresses we want to track now this
looks a little bit longer than your
standard MAC address I don't want to
explain how to translate it because I
didn't understand exactly the first time
now the 0x is just a prefix and when
you're translating your MAC address or
your friend's phone's MAC address into
this little list right here the first
thing you'll need to do is add a 0x in
order to make sure that it's formatted
correctly so you can get your MAC
address or the MAC address of your
friend by going on let's say thing and
doing a network scan in order to
determine the IP address and the MAC
address of your device but often you can
also just look it up by tapping on
settings or going through the menu of
your phone and looking for the device
information now once you have that
information here you'll need to adjust
the list size for however many people
you're tracking and then in this
variable here you'll go ahead and put
the names of the people that you're
tracking in the order that you put the
MAC addresses here
now lastly I've added some some color
functions that I created in order to
pulse the LEDs but I'm not able to use
the last solution I had which was to
raise the LED to a high voltage create a
delay and then bring it back down
because the watch timer actually freaks
out and crashes everything by killing
the process so instead we create a
detection ratio that basically allows us
to fine-tune how many packets we need to
detect that are not the packets we're
looking for before we turn the LED off
otherwise it just turns on for a very
small amount of time and isn't super
useful so within this code we can see
the actual functional part is right here
so what we're saying is if the packet
that we receive matches one of the MAC
addresses in our list then we are going
to say that that person is here and this
is the string formatting that Ricardo
used and I went ahead and added a
cool-down of 1000 meaning we have one
thousand packets detected that are not
from the packet we're looking from the
device we're looking for before we go
ahead and run this last function which
is to turn off all the
Deas so if we detect one depending on
whether it's the first or second person
in the list it'll either turn on a blue
or red LED and then if this cooldown
timer gets all the way to zero
aka if we get through and we get to this
last part then it will check to see if
the cooldown timer is at zero and if not
it just subtracts one now obviously
it'll just keep going a thousand times
until it gets to zero and when we get
there it'll turn off the LED and in real
life because there's so many packets
flying around it takes about 12 seconds
for the light to turn off so now that we
have this explained and I've explained
how you can modify it you'll need to add
the libraries in order for all of us to
work and you can see them included here
now the way that you include these is to
click on sketch and then include library
and you'll be able to also go and click
add file at the bottom if you don't see
it appear in that window now here you
can just scroll through and see that I
have a whole bunch of libraries but if
you navigate to the folder where you
previously downloaded both the library
and the Ino file you should find the
libraries there and be able to simply
include file with both of them and find
them appearing right next to the sketch
that you're working on now that means
that they'll be included when you upload
your sketch to the node MCU so once
these are all together and you've
modified your variables to make sure
that the list size matches the number of
MAC addresses you have included and the
names are in order so you have the the
name of the person along with the order
of the MAC address then you should be
ready to go the last step will be
actually to push this to the node MCU
which you can do by first clicking the
check to verify the sketch and make sure
that there are no mistakes now this is
the step where as you can see we have a
mistake and we'll need to fix something
before we go ahead and push it now in
this case there's actually a character
that's wrong that can't be converted
into a MAC address so we'll fix it here
before checking again and making sure
that everything in our sketch is ok
there now we can see that everything
checks out so the last step will be to
plug in the nodes MCU into the USB port
and go ahead and click the upload button
to start the upload this usually takes a
little bit of time but once it does your
node MCU will be ready to wire and
you'll be
able to detect when your cellphone is
putting out identifying signals once
this process completes we can go ahead
and disconnect it and start taking a
look at wiring up the led now in our
code we've selected pins d5 d6 and d7 to
control our 3 color 4 pin RGB LED that
we'll be using for this project now
that's really convenient because on the
note MCU these are all lined up right
next to the ground and these are RGB
LEDs will require a ground pin right
next to the other three pins we're using
to control it so we can just plug this
into a mini breadboard and wire it up
without needing to get involved in a
bigger breadboard and in this case I'm
not going to be going to use a resistor
now if you want to be proper about it
you should definitely use a resistor but
in this case because I know that the RGB
LED can handle it and also the snow
temps use not putting enough power to
fry it I'm just going to go ahead and
use this now I have another design of
this where I just use some salvaged LEDs
from a pool noodle toy and if you want
to do that you can also use something
like potentiometer to turn the power up
and down and make sure you don't fry
your precious LEDs with this project now
let's go ahead and test this now that it
is wired up we can go ahead and take a
smartphone where we have put the MAC
address in the node MCU and we can go to
the Wi-Fi settings menu in order to give
this a test
now you will generally see no matter
what kind of phone you have a flood of
packets as soon as you turn on the Wi-Fi
when it starts searching for nearby
networks so let's see if it works by
turning it on now and as you can see we
are detecting packets and an interesting
thing about this is we can also see that
it's as it connected is able to detect
data packets as well as just pro frames
now it's going to need to detect 1000
different frames that are not from this
device in order to turn off as it just
did but if you want to adjust this
detection ratio so it turns on for
longer or less long let's say that maybe
you're in an area that doesn't have a
lot of Wi-Fi traffic you can go back
into the code and adjust this variable
to change the amount of time that it
takes to turn on or off the LED and I'll
show you how to do that now now here
you'll see the variable cooldown which
is initially set to 0 and every time we
detect a packet that
is from a device that we're tracking it
sets it to a thousand now you can go
ahead and change this to a different
variable that's either less or more
depending on the ambient traffic in your
area because this setup will cause it to
require one thousand packets that are
not from the device that we're looking
for in order to turn off the LED with
this function here now again you can
just maybe make it ten if you just want
a quick light up and turn off every time
you receive a packet or ten thousand if
you want it to stay on for maybe five
minutes but either way this will allow
you to ratchet that up or down depending
on if you have a lot of ambient traffic
or a little bit or if you just want to
keep it on for longer or less long
privacy is becoming harder and harder to
come by
with everyone from private companies to
the government interested in tracking
your every move now when completing this
project you might notice that the LED is
turning on even when you're not
interacting with your phone meaning it's
putting out trackable signals pretty
much all the time
now even more worryingly you might turn
off your Wi-Fi and still see this
happening and I wanted to take a little
bit of time to explain why this might
occur now there's a feature in many
smart phones called a GPS or assisted
GPS which uses the position of nearby
wireless networks when the GPS signal
isn't available for example if you're in
a city where the signal might bounce off
a bunch of buildings now it sends out
signals and determines the nearest Wi-Fi
networks and finds your location via
that so it avoids needing to use GPS at
all but actually goes around to even
setting up airplane mode sometimes which
can be a pretty big concern if you don't
want to be tracked this way now to
disable it you can go into your GPS
settings and disable a high accuracy GPS
and that should set things up okay for
now but in general you'll want to turn
on airplane mode when you don't use your
Wi-Fi and if you're really serious about
changing your MAC address rather than
relying on the default device behavior
you're gonna want to go in and actually
route the device which does come with
its own privacy concerns itself that's
all we have for this episode of
cyberweapons lab make sure to LIKE
comment and subscribe and if you have
any thoughts on the show be sure to
reach out on Twitter cuz I would love to
hear from you we'll see you next time