the only thing better than programming
micro Python is programming micro Python
over Wi-Fi which we'll do on this
episode of cyber weapons lab one of the
key benefits of micro Python is how
simple it is to use and the web
interface is no exception because while
the serial interface is helpful if you
don't have access to a data cable then
you can't really use it so after an
initial setup where we enable the web
interface we'll be able to log into an
Access Point and then upload our code
from a handy web interface now to use
this you can check out the null-void
article because there are a list of
products you'll need in order to do this
including an esp8266 base module which
could be either at the UN Mini or like
this anode MCU although if you want to
just use a bare esp8266 module I guess
you could also do that too you'll also
need a micro USB cable and a computer
although the operating system doesn't
really matter for this you just need to
initially be able to connect over the
serial interface once you have all those
things together then we can begin now if
you get started with this we're going to
go ahead and first plug in our esp8266
and then run the command to find at
which serial port it is connected to in
this case we can see that it is
connected here and this is the address
we're going to address it at when we use
the following commands now I'm going to
run this from scratch and although I've
done a lot of these before we're going
to run through them again so that it's
really obvious we're going to go ahead
and use the ESP tool to erase the board
entirely and this will prevent any
lingering code from causing problems and
again make sure that you first make sure
that you're connecting to the right
serial port because if you do the wrong
one you'll either get an error which is
frustrating or you might flash the wrong
board or something else so there we go
we've gone ahead and flashed it and now
I'm going to use this command to
actually flash the board with the
correct firmware which will allow us to
then pop up an access point and access
this via the remote
face now I'm going to try this initially
and it probably won't work and I will
explain why
first we'll go ahead and upload the
micro Python binary and then in a little
bit once it finishes uploading we should
have the option to connect to it over
Wi-Fi now that that is done I'm going to
go ahead and go to the github here and
we can see the web read evaluate print
loop is a tool for micro Python that
allows us to directly connect to it
without needing any wires and what the
this is in general is a web interface
that you'll download and then when you
open it you will connect it to the board
I'll over Wi-Fi and it will allow you to
upload stuff download stuff and do all
sorts of great things so in order to use
this we'll need to click on clone or
download here we'll go to a terminal
window and then type git clone and you
can see that mine isn't empty because I
already downloaded it but once yours
downloaded you can type cd' web repeal
and then LS and you can see that what we
need is right here the web repeal HTML
okay so now I'm gonna look at my Wi-Fi
and we're going to select micro Python
and the password is micro Python with a
capital n at the end and it's not gonna
ask me I already put it in but micro
Python Capel behind at the end so now if
I type open web repo HTML it's probably
gonna fail so here we can see that we
have the web interface if I hit connect
this is disconnected it fails it doesn't
work so if you're frustrated if you get
disconnected over and over and just feel
like this isn't gonna work out for you
do not fear there's a really simple way
of fixing this so let's go back to our
terminal interface and we're going to
access our board and this is what
happens if you don't update where it is
so I need to update the serial port
because it changed after I unplugged it
here we go all right so now we're in our
micro Python read evaluate print loop
via serial and this is we're connected
directly over the wire and we need to
actually enable something for this to
work and I did not know this and was
very frustrated to find this out so I
found this in this great Adafruit guide
you need to import web recall set up
very important so we're gonna go ahead
and go over here haste and you can see
if you want to enable or disable it
running on boots we're gonna type e for
enable now go ahead and set up a
password and make sure to make it
something super secure and then type it
in again and make sure it matches and
once that's done then you'll get the
option to reboot and once this is
complete we should be able to connect
via the web interface alright so it is
restarted I'm going to go back to the
web interface I guess I'll just open it
again so I'll control a ok to kill the
window and then open the web interface
and let's hit connect and it'll ask for
our super secure password and there we
are we're connected now the way that we
can go ahead and upload and download
code is super easy if we want to upload
code we can simply go here and for some
reason I'll just upload maybe maybe not
any of these a dot PI file and if we
click on send to device there we go
it's sent the code and it is now on our
microcontroller now to prove that I have
a active interface I can just do a quick
hello worlds
[Music]
as you can see I'm able to execute
Python code from the command line on
this microcontroller over Wi-Fi and of
course this isn't encrypted or anything
but is a great way to be able to both
program and upload our existing programs
without any sort of cables over Wi-Fi
the web interface of micro Python is an
incredible way of interacting with the
board that otherwise requires you to
have a serial connection however best
practice has definitely to apply when it
comes to Wi-Fi security now if you never
change the default password and have
micro Python setup to be programmed this
way then somebody can take control of
your board and embed all sorts of things
in it so make sure to change the default
password as soon as you set this up
because if you have this enabled and
left open then anybody can seize control
of your micro Python board that's all we
have for this episode of cyberweapons
lab make sure to LIKE comment and
subscribe and if you get confused you
can check out the null byte article
linked in the description for various
troubleshooting tips if you have any
ideas for future episodes you can send
me a message on twitter at cody kinsey
cuz i'd love to hear from you we'll see
you next time