Wednesday, April 27, 2022

Updating the Kernelcon 2022 Badge Wifi

So you got home, powered up your Kernelcon 2022 badge, and discovered that it won't boot without the conference wifi network?  It took me a little bit, but I finally figured out how to reflash the thing with new wifi settings.  Turns out you just need to teach an Arduino IDE to talk to an ESP 8266 board, and you can upload the code with new wifi settings easily.

Let's do the Arduino set-up first:

  1. Download and install the Arduino IDE
  2. Open it up and go to File > Preferences
  3. In "Additional Boards Manager URLs" add
    https://arduino.esp8266.com/stable/package_esp8266com_index.json
  4. Hit "OK"
  5. Go to Tools > Board: ____ > Boards Manager
  6. For "Filter your search" type "ESP8266" and let it find the module
  7. Click "Install" and it should download and install the add-on
  8. Click "Close" when that's done
  9. Select Tools > Board: ____ > ESP8266 Boards > Generic ESP8266 Module
  10. Select Tools > Flash size: ____ > 4MB (FS:1MB OTA:~1019KB)
  11. Plug in your badge and switch it on
  12. Go to Tools > Port and select the port it's on.  (Kali picked /dev/ttyUSB0)

At this point, you can load whatever Arduino code you like.  The official Kernelcon badge code uses a JSON library, so if you're going to reload the official code, install the JSON library first.

  1. In the IDE select Tools > Manage Libraries
  2. Search for "ArduinoJson" and click "Install" to add it
  3. Click "Close" when it's done installing.

Finally, let's fetch the original badge code, update the wifi settings, and upload it to the badge.

  1. Download and unzip the ZonkSec kernelcon-2022-badge code
  2. In the Arduino IDE, open kernelcon_watch_v4.ino
  3. This opens all the source files.  Select the wifi.h file tab
  4. Update the SSID and password values and save the file
  5. Select Sketch > Upload and watch it compile and transfer
  6. The badge will restart, and it should use your updated wifi settings as it does.

That's it!  Mess around with the badge code some more, if you like.  Or go find some ESP8266 code and mess with the little guy.  For me, my next step is to try to get the original deauther code running.

Saturday, December 11, 2021

Installing wget on MacOS from source

I recently had the time-consuming pleasure of trying to get wget onto my Mac ... without using homebrew.  Don't get me wrong, I think homebrew is a really helpful project, but it also kind of feels like curling a script and piping it into a root shell.  Here's what I did (on MacOS Monterey) to build and install from source.

Step 1: You're going to need either OpenSSL or gnutls libraries (not just the binary) in order to build it.  I chose OpenSSL.  Honestly, I picked it simply because it was the only one I could get to compile.

git clone git://git.openssl.org/openssl.git
cd openssl
./config
make
make -n install   # Dry run, for a sanity check.
sudo make install # Actually do the install.

Step 2:  Now you can compile wget -- we just need an extra flag in the configure step, to tell it we're using OpenSSL.  The last command here updates your wget config to tell it where to find the trusted TLS certificates on a Mac.

curl -o wget.tar.gz https://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
tar -xzf wget.tar.gz
cd wget-*
./configure --with-ssl=openssl
make
make -n install   # Sanity check.
sudo make install # VĂ¡monos.

echo 'ca-certificate=/etc/ssl/cert.pem' >> ~/.wgetrc

There you go!  Three hours of your life back.

Sunday, September 26, 2021

Opening the Garage with a Wave of My Hand

So here's the story.  To get into my building's garage, I need to wave an rf-enabled key at a reader.  Problem is that I ride, so I have gloves on.  I have to stop just before the gate, take a glove off, fish the key out of my pocket, stuff it into my other glove, put the first glove back on, then ride up to the gate, scan, and ride in with it still in my glove, fully expecting it to fall out on the way.

A blue cloner, a blue keyfob, and an empty tequila glass.
I don't know how many commas I used enumerating that long sequence of events.  Clearly too many.  Something must be done.  Think of the children.

(Attention span ruined by TikTok?  TL;DR: get a cheap blue writer and copy your fob to a ring with a read-write T5577 chip in it.)

So, I know that people are getting teenty-tiny rfid chips crammed into their hands.  What if I could glue/sew one of those onto my gloves?  (Spoiler: I ended up going a different way.)  Then I could just ride up, wave my glove, and ride on in!

Step one was to try to duplicate the key at all.  So I popped over to eBay and looked for a duplicator.  The popular match (a blue thing from China) says it's for 125 KHz and a quick search on the interwebs indicated that my keyfob likely is one.  They all come with a few blanks included, even.  I found a US shipper and committed twelve dollars to the experiment.

It arrived, I tried it out (beep boop!) and the duplicate fob it made worked just fine on the garage.  (And the building front door and the elevator.)  I enlisted friends and made copies of their keys for them -- those also worked!

Alright, now to duplicate my key onto a teeny-tiny chip.  That did not go so well.  I mean, I completely got the wrong type of chip, had no idea what I needed, and utterly failed.  (Though now I know exactly which one I needed.)

A simple black ring

There's something really magical about showing people how easy it is to clone these things.  Particularly because there's something really magical about how your apartment building wants to charge you a hundred bucks if you ask them for a spare copy.  These things cost fifty cents, dudes!  (There's a reason why land owners are the first against the wall when the revolution comes.)

Back to the project though.  During my research I discovered that you can actually get a ring with a chip in it!  Add to cart! Ship it!

And ... success!  Now when I ride, I put on my ring, and opening the garage is just a wave of my hand.  Total cost of the parts (that worked) is under fifty bucks.  And my friends love me because I can make them spares, too.  This was a good project!



Sunday, August 30, 2020

Running Kali 2020.3 on an original GPD Pocket

I recently needed to dust off my wifi skills, and to keep a low profile, I use my GPD Pocket laptop.  My install of Kali was old, so I decided to see if I could load Kali 2020.3 on it.  After much searching and futzing about, it turns out almost everything works right out of the box.  You need a couple files, some settings, and a trick with the installer.  I also found the archlinux wiki page on GPD really useful, oddly enough.
  • Run the text-mode installer.
  • When you're asked to load the brcm files from a USB drive, say "no."
  • It will successfully find all the APs around you, so select yours.
  • But, it *won't* be able to negotiate WPA2 without the missing files.
  • Tell it you're using an open wifi network.
  • Let this fail.  (If you'd told it WPA2 it it would be in a loop of failing and re-asking you the PSK.)
  • Now, select the option to continue without a network connection.
  • Install and reboot.
  • Log in to your new system.
  • (If your screen is rotated, click to the Kali logo, pick Settings, then Display, and set Rotation to "Right.")
  • Put a copy of this brcmfmac4356-pcie.gpd-win-pocket.txt file on a USB drive.  (Kali can read FAT.)
  • Write a copy into /lib/firmware/brcm/brcmfmac4356-pcie.gpd-win-pocket.txt on Kali.
  • Reboot.  (I know, I know, I could use modprobe.)
  • Log in to your system.
  • Click the Kali icon, choose Settings, then Advanced Network Configuration.
  • Double-click your SSID.
  • Go to the Wi-Fi Security tab.
  • Update your settings to reflect that you use WPA, and provide a password.
  • Save

You'll also need to tweak the touchscreen configuration, which doesn't know it is rotated, yet.

  • Edit /usr/share/X11/ xorg.conf.d/40-libinput.conf
  • Inside the "InputClass" stanza for "libinput touchscreen" add this:
  • Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
  • Restart