A while ago I found out about the amazing pwnagotchi project, the only thing is, I didn’t want to have any awkward situations with the law (pwnagotchi technically being a hacking project and all), so I set out to build pwnagotchi’s less sinister cousin. Originally the idea was to use MAC addresses to log new wifi routers – hence the name ‘Macagotchi‘ it has found, but due to devices often resetting and changing their MAC addresses, it was obvious that it wasn’t going to work. I then turned to logging SSID’s (the names of wifi networks) instead, which is the method that Macagotchi uses today.

A Screenshot and Explanation of Macagotchi

Looking for source code (there’s even a super-portable Raspberry Pi Macagotchi now) and other important links? Click here

But how does it work, exactly?

Macagotchi scans for wifi networks every 5 minutes or 30 seconds (depending on if you’ve activated War Driving mode or not) it hashes each network’s SSIDS and adds them to its log including timestamps of when they were found, then it compares them to the list of networks it has found so far. If a hashed SSID is not in the list, it adds it. This system means Macagotchi can tell if it has seen a network before or not, without having a loooooong identifiable log of all the networks a user has walked by, which might be used for malicious purposes.

Challenges and fixes

With Macagotchi being my first multi-platform app, it came with many challenges, so here’s a quick run down of the most annoying ones, along with how I fixed them:

  • pyinstaller and temp directories
    • pyinstaller, the packaging module for python scripts packages a python environment into an outputted executable which users can run, regardless of wether or not they have python installed. One issue with it, however is that it creates temporary directories where the packaged script is run, without bringing over other game assets that weren’t also package with the script.
    • To fix this, I mades sure that all of Macagotchi’s assets were stored in a folder inside the applications directory on macOS, or AppData on Windows, meaning wherever the script “teleported” to, it could always access them
  • Installer for windows
    • On macOS it’s standard to install applications in its Applications directory, however on Windows, users are used to just using installers or moving the app to wherever they want.
    • To make the Windows installation as normal for Windows users as possible. I did this by using the NSIS installer maker to install Macagotchi’s assets into the AppData directory.
  • WiFi scanning
    • On macOS, to get a list of all WiFi’s detected, you can just run the /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport -s command to get a human readable output of all the nearby networks, with just a bit of processing, this is easy for a script to read. On Windows, the norm is to use the netsh wlan show profiles command. Sadly, however, the list of the networks only updates when the user deactivates and reactivates their wifi connectivity.
    • To get around this, I used the amazing winwifi library, which allows python scripts to get a full and updated list of nearby networks. Originally, winwifi would open a command line window, which got annoying when trying to use Macagotchi in the background, so I re programmed it not to and instead run the necessary command in silence. winwifi also would never close handshakes(the system that lets an application communicate with Windows’ wifi API), instead continually opening new ones, eventually leading to a crash. I fixed this with a little help from ChatGPT
  • Windows defender
    • On macOS, after confirming that you’re OK with running a non Apple approved app, the app normal runs with no hiccups from the OS. On Windows, even after you’ve confirmed that you’re OK running a non Windows confirmed app, if Windows defender thinks that an app is possibly malicious, it will remove all traces of it without even telling the user or asking them.
    • I fixed this by sending a copy of Macagotchi to Windows security analysists, who confirmed that I wasn’t in fact cyber terrorists and stopped Windows defender from deleting it. I did have to keep sending them a copy of every update, though, to ensure it wouldn’t get wiped again. If you know that you’re going to be working and updating your program for a while, consider becoming part of the Microsoft Developer program, which adds your app to the Microsoft Store and keeps Windows Defender up to date from wiping your app.

This article does kind of dump on Windows (with absolutely no bias as a mac user), but honestly I do believe that Macagotchi was just the intersection of parts and requirements that made development difficult for the OS. There will always be OS-specific issues with application development, all I hope is that this article helps someone in a similar position as I was.

Important Links

App Installers:

Github Repos:

Other Sites: