diff --git a/README.md b/README.md index c7084deb64..e87968ed23 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Bruce is a versatile ESP32 firmware packed with offensive-security tools, built to make Red Team operations fast and portable. -It also supports [M5Stack](https://shop.m5stack.com), [LILYGO](https://lilygo.cc) and [Elecrow](https://www.elecrow.com) products, and works great with the Cardputer, Sticks, M5Cores, T-Decks and T-Embeds. +It also supports [M5Stack](https://shop.m5stack.com), [LILYGO](https://lilygo.cc) , [RockBase IoT](https://www.rockbaseiot.com) and [Elecrow](https://www.elecrow.com) products, and works great with the Cardputer, Sticks, M5Cores, T-Decks and T-Embeds. ## :zap: Get Our Official DevKit! @@ -245,6 +245,7 @@ Also, [read our FAQ](https://wiki.bruce.computer/faq/) | [Bruce RF Reaper](https://www.elecrow.com/bruce-pcb-rf-reaper.html) | :ok: | :ok: | :x: | :ok: but w/ ST25R3916 | :x: | :ok: | :ok: | :x: | :ok: | :x: | | [Elecrow 24B](https://www.elecrow.com/2-4inch-esp32-miner-lcd-display-2pcs-cryptocurrency-solo-miner-with-1000kh-s-hashrate.html) | :ok: | :ok: | :ok: | :ok: | :x: | :ok:¹ | :x: | :x: | :x: | :x:² | | [Elecrow 3.5"](https://www.elecrow.com/esp-terminal-with-esp32-3-5-inch-parallel-480x320-tft-capacitive-touch-display-rgb-by-chip-ili9488.html) | :ok: | :ok: | :ok: | :ok: | :x: | :ok:¹ | :x: | :x: | :x: | :x:² | +| [NM-CYD-C5 + RF HAT](https://https://rockbase.shop/products/nm-cyd-c5-colorful) | :ok: | :ok: | :x: | :ok: | :x: | :ok: | :ok: | :x: | :ok: | :x: | ² CYD have a LITE_VERSION version for Launcher Compatibility ¹ Core, CYD and StickCs Bad-USB: [here](https://wiki.bruce.computer/features/others/#badusb) @@ -258,6 +259,7 @@ Bruce stems from a keen observation within the community focused on devices like ![Bruce on M5Core](./media/pictures/core.png) ![Bruce on Stick](./media/pictures/stick.png) ![Bruce on CYD](./media/pictures/cyd.png) +![Bruce on CYD with NM-RF-HAT](./media/pictures/bruce-cyd.png) Other media can be [found here](./media/). diff --git a/boards/CYD-2432S028/CYD-2432S028.ini b/boards/CYD-2432S028/CYD-2432S028.ini index b7f5d2ccbf..45a581574e 100644 --- a/boards/CYD-2432S028/CYD-2432S028.ini +++ b/boards/CYD-2432S028/CYD-2432S028.ini @@ -58,8 +58,8 @@ build_flags = -DBAD_RX=GROVE_SCL ; SERIAL (GPS) dedicated pins - -DSERIAL_TX=1 - -DSERIAL_RX=3 + -DSERIAL_TX=3 + -DSERIAL_RX=1 -DGPS_SERIAL_TX=SERIAL_TX -DGPS_SERIAL_RX=SERIAL_RX @@ -75,14 +75,14 @@ build_flags = ;Infrared Led default pin and state -DIR_TX_PINS='{{"Pin 22", 22}, {"Pin 27", 27}}' - -DIR_RX_PINS='{{"Pin 22", 22}, {"Pin 27", 27}, {"Pin 35", 35}}' + -DIR_RX_PINS='{{"Pin 27", 27}, {"Pin 22", 22}, {"Pin 35", 35}}' -DTXLED=22 ;NEED TO SET SOMETHING HERE, at least -1 -DLED_ON=HIGH -DLED_OFF=LOW ;Radio Frequency (one pin modules) pin setting -DRF_TX_PINS='{{"Pin 22", 22}, {"Pin 27", 27}}' - -DRF_RX_PINS='{{"Pin 22", 22}, {"Pin 27", 27}, {"Pin 35", 35}}' + -DRF_RX_PINS='{{"Pin 27", 27}, {"Pin 22", 22}, {"Pin 35", 35}}' ;CC1101 SPI connection pins ; best connection pins for higher speed https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/spi_master.html#gpio-matrix-and-io-mux @@ -116,7 +116,7 @@ build_flags = ;Screen Setup -DHAS_SCREEN=1 - -DROTATION=1 + -DROTATION=3 -DBACKLIGHT=21 -DMINBRIGHT=160 @@ -339,7 +339,7 @@ build_flags = extends=env:CYD-2432S028 build_flags = ${env:CYD-2432S028.build_flags} - -DTFT_INVERSION_ON + ;-DTFT_INVERSION_ON -DDEVICE_NAME='"CYD-2USB"' [env:LAUNCHER_CYD-2USB] diff --git a/boards/CYD-2432S028/interface.cpp b/boards/CYD-2432S028/interface.cpp index 1280adca96..17b9ac5e76 100644 --- a/boards/CYD-2432S028/interface.cpp +++ b/boards/CYD-2432S028/interface.cpp @@ -112,6 +112,40 @@ void _post_setup_gpio() { pinMode(TFT_BL, OUTPUT); ledcAttach(TFT_BL, TFT_BRIGHT_FREQ, TFT_BRIGHT_Bits); ledcWrite(TFT_BL, 255); + + // Force sync color inversion to prevent bruceConf.json from overriding + // the value set in _setup_gpio(). For CYD variants with TFT_INVERSION_ON, + // the init() sequence sends INVON; we send INVOFF here to ensure normal colors. +#ifdef TFT_INVERSION_ON + bruceConfig.colorInverted = 0; + tft.invertDisplay(0); +#else + bruceConfig.colorInverted = 1; + tft.invertDisplay(1); +#endif + + bruceConfigPins.gps_bus.rx = (gpio_num_t)GPS_SERIAL_RX; + bruceConfigPins.gps_bus.tx = (gpio_num_t)GPS_SERIAL_TX; + bruceConfigPins.gpsBaudrate = 9600; + + bool pinsChanged = false; + if (bruceConfigPins.rfTx != 22) { + bruceConfigPins.rfTx = 22; + pinsChanged = true; + } + if (bruceConfigPins.rfRx != 27) { + bruceConfigPins.rfRx = 27; + pinsChanged = true; + } + if (bruceConfigPins.irTx != 22) { + bruceConfigPins.irTx = 22; + pinsChanged = true; + } + if (bruceConfigPins.irRx != 27) { + bruceConfigPins.irRx = 27; + pinsChanged = true; + } + if (pinsChanged) bruceConfigPins.saveFile(); } /********************************************************************* diff --git a/boards/CYD-2432S028/pins_arduino.h b/boards/CYD-2432S028/pins_arduino.h index 823f440f6f..f190e835a8 100644 --- a/boards/CYD-2432S028/pins_arduino.h +++ b/boards/CYD-2432S028/pins_arduino.h @@ -45,6 +45,14 @@ static const uint8_t T9 = 32; static const uint8_t DAC1 = 25; static const uint8_t DAC2 = 26; +// I2C +#define GROVE_SDA 27 +#define GROVE_SCL 22 + +// InfraRed +#define RXLED 27 +#define TXLED 22 + // Deepsleep #define DEEPSLEEP_WAKEUP_PIN 36 // Touch interrupt #define DEEPSLEEP_PIN_ACT LOW diff --git a/boards/nm-cyd-c5/interface.cpp b/boards/nm-cyd-c5/interface.cpp index 46a6144fc9..ea903b882f 100644 --- a/boards/nm-cyd-c5/interface.cpp +++ b/boards/nm-cyd-c5/interface.cpp @@ -37,12 +37,6 @@ void _setup_gpio() { digitalWrite(SDCARD_CS, HIGH); digitalWrite(W5500_SS_PIN, HIGH); digitalWrite(TFT_CS, HIGH); -#ifdef ST7789_DRIVER - bruceConfig.colorInverted = 0; -#endif -#ifdef ILI9341_DRIVER - bruceConfig.colorInverted = 0; -#endif } /*************************************************************************************** ** Function name: _post_setup_gpio() @@ -60,6 +54,24 @@ void _post_setup_gpio() { bruceConfigPins.gpsBaudrate = 9600; bruceConfigPins.rfTx = 8; bruceConfigPins.rfRx = 9; + + // Force disable color inversion for ST7789/ILI9341 on nm-cyd-c5. + // Must be done here because begin_storage() loads bruceConf.json which may + // override the value set in _setup_gpio(). +#ifdef ST7789_DRIVER + bruceConfig.colorInverted = 0; + tft.invertDisplay(0); +#endif +#ifdef ILI9341_DRIVER + bruceConfig.colorInverted = 0; + tft.invertDisplay(0); +#endif + + // Force set I2C bus pins for nm-cyd-c5. + // brucePins.conf may have stale/wrong i2c_bus values, so override them + // to ensure PN532 and other I2C devices use the correct GPIO9(SDA)/GPIO8(SCL). + bruceConfigPins.i2c_bus.sda = (gpio_num_t)GROVE_SDA; + bruceConfigPins.i2c_bus.scl = (gpio_num_t)GROVE_SCL; } /*************************************************************************************** diff --git a/boards/nm-cyd-c5/nm-cyd-c5.ini b/boards/nm-cyd-c5/nm-cyd-c5.ini index 7bdd0c80e1..f4872a17ff 100644 --- a/boards/nm-cyd-c5/nm-cyd-c5.ini +++ b/boards/nm-cyd-c5/nm-cyd-c5.ini @@ -28,8 +28,8 @@ build_flags = -DGPS_SERIAL_RX=4 ; grove pins ; defaults from https://github.com/espressif/arduino-esp32/blob/master/variants/esp32s3/pins_arduino.h - -DGROVE_SDA=8 ; default RF TX pin - -DGROVE_SCL=9 ; default IR/RF RX pin + -DGROVE_SDA=9 ; default IR/RF RX pin + -DGROVE_SCL=8 ; default IR/RF TX pin ;-DALLOW_ALL_GPIO_FOR_IR_RF=1 ; Set this option to make use of all GPIOs, from 1 to 44 to be chosen, except TFT and SD pins ; ir led pin diff --git a/boards/nm-cyd-c5/pins_arduino.h b/boards/nm-cyd-c5/pins_arduino.h index 53ffb73a81..4491477502 100644 --- a/boards/nm-cyd-c5/pins_arduino.h +++ b/boards/nm-cyd-c5/pins_arduino.h @@ -57,9 +57,11 @@ static const uint8_t LP_TX = 11; // UART #define SERIAL_TX 11 #define SERIAL_RX 12 + // I2C -#define GROVE_SDA 8 -#define GROVE_SCL 9 +#define GROVE_SDA 9 +#define GROVE_SCL 8 + // SPI #define SPI_SCK_PIN 6 #define SPI_MOSI_PIN 7 diff --git a/media/pictures/bruce-cyd.png b/media/pictures/bruce-cyd.png new file mode 100644 index 0000000000..e1857b49c5 Binary files /dev/null and b/media/pictures/bruce-cyd.png differ diff --git a/platformio.ini b/platformio.ini index 3a343da8eb..49d7584766 100644 --- a/platformio.ini +++ b/platformio.ini @@ -281,6 +281,7 @@ build_flags = -DCONFIG_ESP32_JTAG_SUPPORT_DISABLE=1 # Restrict IR protocols to save Flash on 4mb devices -D_IR_ENABLE_DEFAULT_=false + -DDECODE_HASH=true -DDECODE_NEC=true -DSEND_NEC=true -DDECODE_SAMSUNG=true diff --git a/src/core/config.cpp b/src/core/config.cpp index ab133884e4..feba199866 100644 --- a/src/core/config.cpp +++ b/src/core/config.cpp @@ -43,6 +43,8 @@ JsonDocument BruceConfig::toJson() const { JsonObject _wifiAp = setting["wifiAp"].to(); _wifiAp["ssid"] = wifiAp.ssid; _wifiAp["pwd"] = wifiAp.pwd; + setting["wifiHostname"] = wifiHostname; + setting["wifiHostnameEnabled"] = wifiHostnameEnabled; setting["wifiMAC"] = wifiMAC; //@IncursioHack setting["TerminalLog"] = TerminalLog; @@ -285,6 +287,13 @@ void BruceConfig::fromFile(bool checkFS) { log_e("Fail"); } + if (!setting["wifiHostname"].isNull()) { + wifiHostname = setting["wifiHostname"].as(); + } + if (!setting["wifiHostnameEnabled"].isNull()) { + wifiHostnameEnabled = setting["wifiHostnameEnabled"].as(); + } + //@IncursioHack if (!setting["wifiMAC"].isNull()) { wifiMAC = setting["wifiMAC"].as(); @@ -650,6 +659,11 @@ void BruceConfig::setWifiApCreds(const String &ssid, const String &pwd) { saveFile(); } +void BruceConfig::setWifiHostname(const String &hostname) { + wifiHostname = hostname; + saveFile(); +} + void BruceConfig::setTerminalLog(bool value) { TerminalLog = value; saveFile(); diff --git a/src/core/config.h b/src/core/config.h index bd3cde1aab..6cb823bce5 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -62,6 +62,8 @@ class BruceConfig : public BruceTheme { Credential webUI = {"admin", "bruce"}; std::vector webUISessions = {}; // FIFO queue of session tokens WiFiCredential wifiAp = {"BruceNet", "brucenet"}; + String wifiHostname = "Bruce Firmware"; + bool wifiHostnameEnabled = true; std::map wifi = {}; std::set evilWifiNames = {}; String wifiMAC = ""; //@IncursioHack @@ -159,6 +161,7 @@ class BruceConfig : public BruceTheme { // Wifi void setWebUICreds(const String &usr, const String &pwd); void setWifiApCreds(const String &ssid, const String &pwd); + void setWifiHostname(const String &hostname); void setTerminalLog(bool value); void addWifiCredential(const String &ssid, const String &pwd); void addQrCodeEntry(const String &menuName, const String &content); diff --git a/src/core/menu_items/ConfigMenu.cpp b/src/core/menu_items/ConfigMenu.cpp index a2e77261a5..7dc8aea782 100644 --- a/src/core/menu_items/ConfigMenu.cpp +++ b/src/core/menu_items/ConfigMenu.cpp @@ -204,6 +204,11 @@ void ConfigMenu::advancedMenu() { if (name.length() > 0 && name != "\x1B") bruceConfigPins.setBleName(name); } }, {"Network Creds", [this]() { setNetworkCredsMenu(); }}, + {String("Hostname: ") + (bruceConfig.wifiHostnameEnabled ? "ON" : "OFF"), + [this]() { + bruceConfig.wifiHostnameEnabled = !bruceConfig.wifiHostnameEnabled; + bruceConfig.saveFile(); + } }, {"Factory Reset", []() { // Confirmation dialog for destructive action diff --git a/src/core/menu_items/WifiMenu.cpp b/src/core/menu_items/WifiMenu.cpp index f0c283a3ae..c15ddea117 100644 --- a/src/core/menu_items/WifiMenu.cpp +++ b/src/core/menu_items/WifiMenu.cpp @@ -108,6 +108,7 @@ void WifiMenu::configMenu() { std::vector