From 93738a6134c3319f81c48c971f48c271221f2ddb Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Sat, 4 Jul 2026 16:07:37 -0400 Subject: [PATCH 1/8] Fix con script to have unique keys --- make_conference_full.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/make_conference_full.sh b/make_conference_full.sh index d1cd947..0ffde86 100755 --- a/make_conference_full.sh +++ b/make_conference_full.sh @@ -17,6 +17,10 @@ for challenge in bluetooth/iBeacon bluetooth/classic_discoverable wifi/wifi_ap_c fi popd > /dev/null 2>&1 done +if [ -f "$(date +"%Y")${1}.txt" ]; then + printf '%s%s.txt already exists, please remove it or pick a different name\n' "$(date +"%Y")" "${1}" + exit 1 +fi # Safety checks complete, define functions and do the thing threewords() { @@ -27,6 +31,7 @@ threewords() { dictionary='/usr/share/dict/cracklib-words' shuf -n3 "${dictionary}" | paste -sd ' ' } +export -f threewords for challenge in bluetooth/iBeacon bluetooth/classic_discoverable wifi/wifi_ap_client; do pushd "${challenge}" > /dev/null 2>&1 @@ -42,7 +47,11 @@ for challenge in bluetooth/iBeacon bluetooth/classic_discoverable wifi/wifi_ap_c popd > /dev/null 2>&1 done printf "Seeding keys for %s%s... " "$(date +"%Y")" "${1}" +#sed -i \ +# -e "/RFHS_CHALLENGE_NAME/i -\n----------------------------------------------------------------\n$(date +"%Y")${1}\n$(threewords)\n" \ +# "$(date +"%Y")${1}.txt" sed -i \ - -e "/RFHS_CHALLENGE_NAME/i -\n----------------------------------------------------------------\n$(date +"%Y")${1}\n$(threewords)\n" \ + -e "/RFHS_CHALLENGE_NAME/{h; s/.*/printf -- '-\\n----------------------------------------------------------------\\nConference: %s%s\\nFlag: %s\\n\\n' \"\$(date +%Y)\" \"${1}\" \"\$(threewords)\"/e; G;}" \ "$(date +"%Y")${1}.txt" + printf "complete\n" From 2606f775d098d0ba2621c341b6bc9ea3f47686a2 Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Mon, 6 Jul 2026 16:39:12 -0400 Subject: [PATCH 2/8] update report readability --- make_conference_full.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make_conference_full.sh b/make_conference_full.sh index 0ffde86..4c0e887 100755 --- a/make_conference_full.sh +++ b/make_conference_full.sh @@ -29,7 +29,7 @@ threewords() { exit 1 fi dictionary='/usr/share/dict/cracklib-words' - shuf -n3 "${dictionary}" | paste -sd ' ' + shuf -n3 "${dictionary}" | tr '[:lower:]' '[:upper:]' | paste -sd ' ' } export -f threewords @@ -53,5 +53,5 @@ printf "Seeding keys for %s%s... " "$(date +"%Y")" "${1}" sed -i \ -e "/RFHS_CHALLENGE_NAME/{h; s/.*/printf -- '-\\n----------------------------------------------------------------\\nConference: %s%s\\nFlag: %s\\n\\n' \"\$(date +%Y)\" \"${1}\" \"\$(threewords)\"/e; G;}" \ "$(date +"%Y")${1}.txt" - +sed -i '1iSet font to "Roboto Mono' "$(date +"%Y")${1}.txt" printf "complete\n" From 4c9abefd2c81ba38ec98f2dfbbf315288eb82cb6 Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Mon, 6 Jul 2026 20:50:52 -0400 Subject: [PATCH 3/8] fix client mode, add additional wifi tests --- README.md | 6 ++-- wifi/wifi_ap_client/README.md | 4 +-- wifi/wifi_ap_client/platformio.ini | 24 +++++++------- wifi/wifi_ap_client/src/main.cpp | 50 +++++++++++++++++++++++------- 4 files changed, 55 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index a147b05..2ab7019 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,13 @@ RF CTF Fox code [![Build Test All](https://github.com/rfhs/kitsune/actions/workflows/build-test-all.yaml/badge.svg)](https://github.com/rfhs/kitsune/actions/workflows/build-test-all.yaml) -|Hardware |Bluetooth iBeacon |Bluetooth Classic Discoverable |Wifi AP |Client | +|Hardware |Bluetooth iBeacon |Bluetooth Classic Discoverable |WiFi AP |WiFi Client | |------------------- | :---------: | :------: | :-----: | :-----: | |M5Stack Atom-lite |✅|✅|✅|✅| |M5Stack AtomS3-lite |✅|❌|✅|✅| |M5Stack StampS3 |✅|❌|✅|✅| -|Arduino Nano ESP32 |✅|❌|✅|❌| -|Seeed XIAO ESP32C5 |❌|❌|✅|❌| +|Arduino Nano ESP32 |✅|❌|✅|✅| +|Seeed XIAO ESP32C5 |❌|❌|✅|✅| We will accept PRs to extend support to other platformio supported hardware. diff --git a/wifi/wifi_ap_client/README.md b/wifi/wifi_ap_client/README.md index 1c91b56..2e3f176 100644 --- a/wifi/wifi_ap_client/README.md +++ b/wifi/wifi_ap_client/README.md @@ -31,8 +31,8 @@ seeed-xiao-esp32c5-hard-ap Platform upload Upload |M5Stack Atom-lite |✅|✅|✅| |M5Stack AtomS3-lite |✅|✅|❌| |M5Stack StampS3 |✅|✅|❌| -|Ardunio Nano ESP32 |✅|❌|❌| -|Seeed Xiao ESP32C5 |✅|❌|❌| +|Ardunio Nano ESP32 |✅|✅|❌| +|Seeed Xiao ESP32C5 |✅|✅|❌| To use: - [Install PlatformIO](https://platformio.org/install/cli) diff --git a/wifi/wifi_ap_client/platformio.ini b/wifi/wifi_ap_client/platformio.ini index c4fc60b..ba16c11 100644 --- a/wifi/wifi_ap_client/platformio.ini +++ b/wifi/wifi_ap_client/platformio.ini @@ -66,15 +66,15 @@ build_flags = ${difficulty.hard} ${mode.client} [env:arduino-nano-esp32-easy-ap] extends = arduino_nano_esp32 build_flags = ${difficulty.easy} ${mode.ap} ${arduino_nano_esp32.board_flags} -;[env:arduino-nano-esp32-easy-client] -;extends = arduino_nano_esp32 -;build_flags = ${difficulty.easy} ${mode.client} ${arduino_nano_esp32.board_flags} +[env:arduino-nano-esp32-easy-client] +extends = arduino_nano_esp32 +build_flags = ${difficulty.easy} ${mode.client} ${arduino_nano_esp32.board_flags} [env:arduino-nano-esp32-hard-ap] extends = arduino_nano_esp32 build_flags = ${difficulty.hard} ${mode.ap} ${arduino_nano_esp32.board_flags} -;[env:arduino-nano-esp32-hard-client] -;extends = arduino_nano_esp32 -;build_flags = ${difficulty.hard} ${mode.client} ${arduino_nano_esp32.board_flags} +[env:arduino-nano-esp32-hard-client] +extends = arduino_nano_esp32 +build_flags = ${difficulty.hard} ${mode.client} ${arduino_nano_esp32.board_flags} ; Client mode gets the wrong mac address, not sure why [env:seeed-xiao-esp32c5-easy-ap] @@ -83,18 +83,18 @@ build_flags = ${difficulty.easy} ${mode.ap} ${seeed-xiao-esp32c5.board_flags} [env:seeed-xiao-esp32c5-fiveeasy-ap] extends = seeed-xiao-esp32c5 build_flags = ${difficulty.easy} ${difficulty.fiveeasy} ${mode.ap} ${seeed-xiao-esp32c5.board_flags} -;[env:seeed-xiao-esp32c5-easy-client] -;extends = seeed-xiao-esp32c5 -;build_flags = ${difficulty.easy} ${mode.client} ${seeed-xiao-esp32c5.board_flags} +[env:seeed-xiao-esp32c5-easy-client] +extends = seeed-xiao-esp32c5 +build_flags = ${difficulty.easy} ${mode.client} ${seeed-xiao-esp32c5.board_flags} [env:seeed-xiao-esp32c5-hard-ap] extends = seeed-xiao-esp32c5 build_flags = ${difficulty.hard} ${mode.ap} ${seeed-xiao-esp32c5.board_flags} [env:seeed-xiao-esp32c5-fivehard-ap] extends = seeed-xiao-esp32c5 build_flags = ${difficulty.hard} ${difficulty.fivehard} ${mode.ap} ${seeed-xiao-esp32c5.board_flags} -;[env:seeed-xiao-esp32c5-hard-client] -;extends = seeed-xiao-esp32c5 -;build_flags = ${difficulty.hard} ${mode.client} ${seeed-xiao-esp32c5.board_flags} +[env:seeed-xiao-esp32c5-hard-client] +extends = seeed-xiao-esp32c5 +build_flags = ${difficulty.hard} ${mode.client} ${seeed-xiao-esp32c5.board_flags} ; known issues: ; serial isn't working diff --git a/wifi/wifi_ap_client/src/main.cpp b/wifi/wifi_ap_client/src/main.cpp index 374a22c..cef5d41 100644 --- a/wifi/wifi_ap_client/src/main.cpp +++ b/wifi/wifi_ap_client/src/main.cpp @@ -15,18 +15,22 @@ void setup() { // Initialize Wi-Fi with default configuration to set MAC address wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); - WiFi.mode(WIFI_MODE_NULL); + #if defined(AP) + WiFi.mode(WIFI_AP); + #elif defined(CLIENT) + WiFi.mode(WIFI_STA); + #endif esp_wifi_init(&cfg); // esp_wifi_start(); // esp_wifi_set_mac() only requires Wi-Fi to be *initialized* #if defined(AP) // Create Wi-Fi network with SSID and password - Serial.println("Setting AP (Access Point)…"); + Serial.println("Setting up AP (Access Point)…"); // Interface to set MAC address wifi_interface_t interface = WIFI_IF_AP; #elif defined(CLIENT) // Connect to Wi-Fi network with SSID and password - Serial.println("Setting WiFi Fox Client…"); + Serial.println("Setting up WiFi Client…"); // Interface to set MAC address wifi_interface_t interface = WIFI_IF_STA; #endif @@ -66,7 +70,6 @@ void setup() { snprintf(mac_str, sizeof(mac_str), "%02X:%02X:%02X:%02X:%02X:%02X", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); - Serial.println("Requested MAC address: " + String(mac_str)); #if defined(AP) #if CHANNEL > 0 int set_channel = CHANNEL; @@ -81,8 +84,6 @@ void setup() { // 128, 132, 136, 140, 144, 149, 153, 157, 161, 165 //}; */ - - // All other channels were refused due to reg domain static constexpr uint8_t CHANNEL_LIST_5G[] = { 36, 40, 44, 48, 149, 153, 157, 161, 165 }; @@ -91,29 +92,54 @@ void setup() { uint8_t set_channel = CHANNEL_LIST_5G[random_index]; #else // Intentionally limited to worldwide allowed channels - int set_channel = esp_random() % 11; + uint8_t set_channel = esp_random() % 11; set_channel++; #endif #endif - Serial.printf("Setting channel to: %d\r\n", set_channel); - Serial.flush(); WiFi.mode(WIFI_AP); WiFi.softAP(FSSID, PSK, set_channel, SSID_HIDDEN, MAX_CLIENTS); + delay(100); // Let AP start before we run our checks Serial.printf("Set power status: %s\r\n", String(WiFi.setTxPower(TXPOWER))); Serial.println("Started AP with MAC Address: " + WiFi.softAPmacAddress()); if (WiFi.softAPmacAddress() != mac_str){ + Serial.println("Requested MAC address : " + String(mac_str)); Serial.println("Read MAC Address != Requested Mac Address"); + Serial.flush(); + disableWiFi(); rfhsledfatal(); } + uint8_t currentChannel = WiFi.channel(); + Serial.printf("Operating channel: %d\r\n", currentChannel); + if (currentChannel != set_channel){ + Serial.printf("Requested channel: %d\r\n", set_channel); + Serial.println("Operating channel != Requested Channel"); + Serial.flush(); + disableWiFi(); + rfhsledfatal(); + } + String currentSSID = WiFi.softAPSSID(); + Serial.println("Operating SSID: " + currentSSID); + if (String(FSSID) != currentSSID){ + Serial.println("Requested SSID: " FSSID); + Serial.println("Operating SSID != Requested SSID"); + Serial.flush(); + disableWiFi(); + rfhsledfatal(); + } + Serial.flush(); ledcolor(0x00ff00); // GREEN #elif defined(CLIENT) WiFi.mode(WIFI_STA); WiFi.begin(FSSID, PSK); + delay(100); // Let Client start before we run our checks Serial.println("Started Client with MAC Address: " + WiFi.macAddress()); if (WiFi.macAddress() != mac_str){ Serial.println("Read MAC Address != Requested Mac Address"); + Serial.flush(); + disableWiFi(); rfhsledfatal(); } + Serial.flush(); ledcolor(0xff8c00); // ORANGE #endif @@ -126,9 +152,9 @@ void setup() { ledcolor(0x880000); // HALF RED disableWiFi(); ledcolor(0xff0000); // RED - delay(75); // adjust the esp_deep_sleep if you change this - // subtract sleep time on line 91 - int sleepy_tyme = uS_TO_S * TIME_TO_SLEEP - 75 ; + delay(75); // Give the led time to set before sleeping + // subtract sleep time on line 101, 134, 155 + int sleepy_tyme = uS_TO_S * TIME_TO_SLEEP - 75 - 100 ; if (sleepy_tyme < 0 ) { sleepy_tyme = 0; } From 66522c90b433417738517100134893d1ba1d3b6f Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Mon, 6 Jul 2026 20:51:08 -0400 Subject: [PATCH 4/8] shut down wifi harder --- include/rfhswifi.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/rfhswifi.h b/include/rfhswifi.h index f37bd54..acd96f9 100644 --- a/include/rfhswifi.h +++ b/include/rfhswifi.h @@ -9,4 +9,7 @@ void disableWiFi() { WiFi.disconnect(true); #endif WiFi.mode(WIFI_OFF); + esp_wifi_stop(); + esp_wifi_deinit(); + esp_wifi_set_mode(WIFI_MODE_NULL); } From 67ba93741b104029425c5ce66fc2848c60084a04 Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Mon, 6 Jul 2026 20:55:11 -0400 Subject: [PATCH 5/8] add serial reading helper script --- fastcat | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 fastcat diff --git a/fastcat b/fastcat new file mode 100755 index 0000000..7c399b5 --- /dev/null +++ b/fastcat @@ -0,0 +1,12 @@ +#!/bin/sh +until ls /dev/ttyACM0 > /dev/null 2>&1 || ls /dev/ttyUSB0 > /dev/null 2>&1; do + sleep 0.1 +done +if ls /dev/ttyACM0 > /dev/null 2>&1; then + stty -F /dev/ACMUSB0 115200 raw -echo + cat /dev/ttyACM0 +fi +if ls /dev/ttyUSB0 > /dev/null 2>&1; then + stty -F /dev/USB0 115200 raw -echo + cat /dev/ttyUSB0 +fi From 5be4eb458a42af3e11df8e60a7512553e56e3850 Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Mon, 6 Jul 2026 21:00:11 -0400 Subject: [PATCH 6/8] add five GHz demos --- .../wifi_ap_client/src/conferences/9999demo.h | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/wifi/wifi_ap_client/src/conferences/9999demo.h b/wifi/wifi_ap_client/src/conferences/9999demo.h index 6a5c14e..aede177 100644 --- a/wifi/wifi_ap_client/src/conferences/9999demo.h +++ b/wifi/wifi_ap_client/src/conferences/9999demo.h @@ -55,6 +55,48 @@ #define TIME_TO_SLEEP 45 #define TXPOWER WIFI_POWER_7dBm #endif + +#if defined(FIVEEASY) +#define RFHS_CHALLENGE_NAME "WiFi 5GHz AP Easy Fox" +// Network config +#define FSSID "Rex WiFi 5GHz AP Easy Fox" +#define PSK "0123456789" +// set mac address +#define MAC_ADDR {0xF2, 0xC6, 0xB7, 0xE2, 0xE9, 0x85} +// 1-13 permitted 0 means random +#define CHANNEL 36 +// 0 broadcast 1 hidden +#define SSID_HIDDEN 0 +// 1-4 permitted +#define MAX_CLIENTS 1 +#define TIME_TO_WAKE 15 +#define TIME_TO_SLEEP 5 +// checks run during startup so we want to stay +// running no longer than a few minutes to force +// checks to run and led to update +#define TXPOWER WIFI_POWER_17dBm +#endif + +#if defined(FIVEHARD) +#define RFHS_CHALLENGE_NAME "WiFi 5GHz AP Hard Fox" +// Network config +#define FSSID "Liberty WiFi 5GHz AP Hard Fox" +#define PSK "0123456789" +// set mac address +#define MAC_ADDR {0xF2, 0x81, 0x41, 0xD1, 0x30, 0xD1} +// 1-13 permitted 0 means random +#define CHANNEL 0 +// 0 broadcast 1 hidden +#define SSID_HIDDEN 0 +// 1-4 permitted +#define MAX_CLIENTS 1 +// checks run during startup so we want to stay +// running no longer than a few minutes to force +// checks to run and led to update +#define TIME_TO_WAKE 30 +#define TIME_TO_SLEEP 45 +#define TXPOWER WIFI_POWER_7dBm +#endif #endif #if defined(CLIENT) From c15f4e123a012a68cc74332fd87866a68bc99371 Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Mon, 6 Jul 2026 21:07:31 -0400 Subject: [PATCH 7/8] add demo to the ssid --- wifi/wifi_ap_client/src/conferences/9999demo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/wifi_ap_client/src/conferences/9999demo.h b/wifi/wifi_ap_client/src/conferences/9999demo.h index aede177..971490f 100644 --- a/wifi/wifi_ap_client/src/conferences/9999demo.h +++ b/wifi/wifi_ap_client/src/conferences/9999demo.h @@ -59,7 +59,7 @@ #if defined(FIVEEASY) #define RFHS_CHALLENGE_NAME "WiFi 5GHz AP Easy Fox" // Network config -#define FSSID "Rex WiFi 5GHz AP Easy Fox" +#define FSSID "Demo Rex WiFi 5GHz AP Easy Fox" #define PSK "0123456789" // set mac address #define MAC_ADDR {0xF2, 0xC6, 0xB7, 0xE2, 0xE9, 0x85} @@ -80,7 +80,7 @@ #if defined(FIVEHARD) #define RFHS_CHALLENGE_NAME "WiFi 5GHz AP Hard Fox" // Network config -#define FSSID "Liberty WiFi 5GHz AP Hard Fox" +#define FSSID "Demo Liberty WiFi 5GHz AP Hard Fox" #define PSK "0123456789" // set mac address #define MAC_ADDR {0xF2, 0x81, 0x41, 0xD1, 0x30, 0xD1} From a9a5d3899565cf526f8108dfff386ffc9d309df2 Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Mon, 6 Jul 2026 21:15:29 -0400 Subject: [PATCH 8/8] fix ssid length --- wifi/wifi_ap_client/src/conferences/9999demo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi/wifi_ap_client/src/conferences/9999demo.h b/wifi/wifi_ap_client/src/conferences/9999demo.h index 971490f..fdb5616 100644 --- a/wifi/wifi_ap_client/src/conferences/9999demo.h +++ b/wifi/wifi_ap_client/src/conferences/9999demo.h @@ -80,7 +80,7 @@ #if defined(FIVEHARD) #define RFHS_CHALLENGE_NAME "WiFi 5GHz AP Hard Fox" // Network config -#define FSSID "Demo Liberty WiFi 5GHz AP Hard Fox" +#define FSSID "Demo Liberty WiFi 5GHzAPHardFox" #define PSK "0123456789" // set mac address #define MAC_ADDR {0xF2, 0x81, 0x41, 0xD1, 0x30, 0xD1}