DEV Community

Chris Thompson
Chris Thompson

Posted on

Pwnagotchi, waveshare 2.13v3, pisugar 3

I recently built a couple of pwnagotchi devices. These devices grab wifi handshakes for later cracking, so should only be used on wifi networks you have permission to attack.

The latest version of pwnagotchi is v1.5.5, but this lead to some problems. This supports the Waveshare 2.13" v2 eInk display, but I could only find the v3 for sale. I also wanted to use the PiSugar 3 battery/UPS which is not natively supported. Finally, the 1.5.5 version can not switch from AUTO to AI mode. Here's how I solved all these issues.

The Waveshare 2.13" v3 eInk display support was the easiest fix. Instead of using the official pwnagotchi image, I used the alternate image referenced in this comment, the pwnagotchi_1.5.5_WSV3Patched image.

Supporting the PiSugar 3 battery pack is a bit more work. Sign in to the pwnagotchi via ssh, then follow the instructions at taiyonemo/pwnagotchi-plugin-pisugar3. In my case, I did this:

# Become root
sudo -i
# Copy the pisugar 3 file into the right location
cd /usr/local/lib/python3.7/dist-packages/pwnagotchi/plugins/default
wget https://raw.githubusercontent.com/taiyonemo/pwnagotchi-plugin-pisugar3/main/pisugar3.py
Enter fullscreen mode Exit fullscreen mode

Now, I wanted to run the PiSugar power management software so I followed the official instructions.

curl http://cdn.pisugar.com/release/pisugar-power-manager.sh | sudo bash
Enter fullscreen mode Exit fullscreen mode

You should then be able to load the settings page in your browser by going to http://10.0.0.2:8421. I turned on Safe Shutdown with a Battery Level <= 20%, then went in to Settings and enabled Battery Input Protection, ensured Soft Shutdown was enabled, and set Soft Shutdown Shell to Shutdown. Now's a good time to update the firmware, too.

curl https://cdn.pisugar.com/release/PiSugarUpdate.sh | sudo bash
Enter fullscreen mode Exit fullscreen mode

I modified /boot/config.txt by adding the following:

# If running Pi 4, downclock for more battery.
# No point on the Pi 0.
arm_freq=800

# Enable real-time clock
dtoverlay=i2c-rtc,ds3231
Enter fullscreen mode Exit fullscreen mode

Now, let's take a look at my /etc/pwnagotchi/config.toml file:

# General config
main.name = "pwnagotchi4"
main.lang = "en"

main.plugins.grid.enabled = true
main.plugins.grid.report = false

# PiSugar 3 UPS
main.plugins.pisugar3.enabled = true
main.plugins.pisugar3.shutdown = 15

# eInk display
ui.display.enabled = true
ui.display.type = "waveshare_3"
ui.display.color = "black"

# Reduce writes to SD card
fs.memory.mounts.log.enabled = true     # switch
fs.memory.mounts.log.mount = "/var/log" # which directory to map into memory
fs.memory.mounts.log.size = "50M"       # max size to put into memory
fs.memory.mounts.log.sync = 600         # interval in seconds to sync back onto disk
fs.memory.mounts.log.zram = true        # use zram for compression (recommended)
fs.memory.mounts.log.rsync = true       # use rsync to copy only the difference (recommended)

# ignore networks
main.whitelist = [
  "your network here",
]
Enter fullscreen mode Exit fullscreen mode

This leaves one remaining problem. The pwnagotchi won't switch into AI mode. Running linux_connection_share.sh on my laptop to ensure the pwnagotchi has Internet access, I ssh in to the pwnagotchi and update numpy:

sudo pip3 install --upgrade numpy
Enter fullscreen mode Exit fullscreen mode

On the Raspberry Pi 0, this takes several hours. It's a bit faster on the Pi 4 but still takes a while. Once the update is complete, reboot and give it about twenty minute and you should see the pwnagotchi switch into AI mode.

Phew, we are done!

Top comments (2)

Collapse
 
hexsiu profile image
hexsiu • Edited

Hi,
I`ve spent a lot of hours to tet up and run AI mode.
You help me a lot. Thank You very much.

My last problem witch pwnagotchi is bettercap. I cant login :(
Always says: Can't connect to pi.local:8081/api
(login and pass the same pwnagotchi).
Have you any suggestion, what should I do with it?

Have a best day!

Collapse
 
disane profile image
Marco

Thank you so much! Got it working with Waveshare v4 and SugarPi3 :)