Remote wifi data logger with ESP8266

ESP8266 is a wonderful board with wifi cheapest supported monitoring mode and package injection. ESP8266 is available for only 4$ on Amazon, might be programmed with both Arduino C and micropython. To do so, on python, we need to flash the board with appropriate fireware.

Today, I would show our simple Arduino project inspired by AlexLynd esp-bug.

First, let’s go to console and install nginx and PHP:

$ sudo apt install nginx
$ sudo apt install php-fpm php-mysql

The next step is cd to /var/www and get latest ESP-logger:

$ git clone https://github.com/cybertechtalk/esp-logger
$ cd esp-logger/web

Now, we need nginx server up and running in esp-logger directory:

$ nano /etc/nginx/sites-available/default

Targets web server to esp-logger web location.

Please check if correct PHP version. In my case this is PHP8.2

Ensure php-fpm socket is up and running:

$ sudo service php8.2-fpm start 
$ sudo service nginx start

Modify access to web site root to be able write log information and display on GUI:

$ sudo chmod -R a+rwx /var/www/web 

Now, it is time to open backend sketch and target ESP device to send information to web frontend hosted locally on nginx server. You may host web application with any free web hosting provider to be able access to logger interface from anywhere in internet.

To make thing easer, I will use local nginx server. Open ino sketch, set remote server endpoint, your access point SSID and PASS as below:

If you can’t find your esp8266 board in Arduino IDE, please go to File -> Preference -> Additional boards manager URLs and paste https://arduino.esp8266.com/stable/package_esp8266com_index.json. Click OK. After, under Tools -> Boards Manager search for esp8266 plugin and install latest version (3.1.2 at the moment of writing the post). Now, we able to select our ESP8266 from list of supported board. The last step is to specify correct usb port of esp board connected.
$ dmesg | awk '/tty/ && /USB/ { print "/dev/"$10 }' | tail -1

Find ESP device port information using:

Now, we have to erase ESP8266 and flash backend into the board:

$ python3 -m pip install esptool
$ python3 -m esptool --port /dev/ttyUSB0 erase_flash

So, we are ready to flash sketch:

Press Ctrl+Shft+M. It should show wifi status ‘3’, esp-logger ip address and remote server connection status code 200, it means you are on right way:

Now, check remote server http://192.168.1.37/index.html. Voilà, here there is an information about ESP logger device, all wireless networks which the ESP8266 sees in the air and devices connected to.

So, I have shown you a very simple way to gather information about any wifi networks and connected devices using cheap ESP8266 chipset and Arduino IDE, just leave it connected to a outer and track malicious activities or even integrate it the SIEM.

Be an ethical, apply the knowledge only on network you own,

respect privacy.

subscribe to newsletter

and receive weekly update from our blog

By submitting your information, you're giving us permission to email you. You may unsubscribe at any time.

Leave a Comment

Discover more from #cybertechtalk

Subscribe now to keep reading and get access to the full archive.

Continue reading