mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 07:40:58 -08:00
Add status LED for neopixel
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -18,6 +18,50 @@ void LedInterface::RunSetup() {
|
||||
}
|
||||
|
||||
void LedInterface::main(uint32_t currentTime) {
|
||||
if ((!settings_obj.loadSetting<bool>("EnableLED")) ||
|
||||
(this->current_mode == MODE_OFF)) {
|
||||
this->ledOff();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (this->current_mode == MODE_RAINBOW) {
|
||||
this->rainbow();
|
||||
}
|
||||
else if (this->current_mode == MODE_ATTACK) {
|
||||
this->attackLed();
|
||||
}
|
||||
else if (this->current_mode == MODE_SNIFF) {
|
||||
this->sniffLed();
|
||||
}
|
||||
else {
|
||||
this->ledOff();
|
||||
}
|
||||
};
|
||||
|
||||
void LedInterface::setMode(uint8_t new_mode) {
|
||||
this->current_mode = new_mode;
|
||||
}
|
||||
|
||||
uint8_t LedInterface::getMode() {
|
||||
return this->current_mode;
|
||||
}
|
||||
|
||||
void LedInterface::sniffLed() {
|
||||
strip.setPixelColor(0, strip.Color(0, 0, 255));
|
||||
strip.show();
|
||||
}
|
||||
|
||||
void LedInterface::attackLed() {
|
||||
strip.setPixelColor(0, strip.Color(255, 0, 0));
|
||||
strip.show();
|
||||
}
|
||||
|
||||
void LedInterface::ledOff() {
|
||||
strip.setPixelColor(0, strip.Color(0, 0, 0));
|
||||
strip.show();
|
||||
}
|
||||
|
||||
void LedInterface::rainbow() {
|
||||
strip.setPixelColor(0, this->Wheel((0 * 256 / 100 + this->wheel_pos) % 256));
|
||||
strip.show();
|
||||
|
||||
@@ -26,7 +70,7 @@ void LedInterface::main(uint32_t currentTime) {
|
||||
this->wheel_pos = this->wheel_pos - this->wheel_speed;
|
||||
if (this->wheel_pos < 0)
|
||||
this->wheel_pos = 255;
|
||||
};
|
||||
}
|
||||
|
||||
uint32_t LedInterface::Wheel(byte WheelPos) {
|
||||
WheelPos = 255 - WheelPos;
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
#ifndef LedInterface_h
|
||||
#define LedInterface_h
|
||||
|
||||
#include "configs.h"
|
||||
#include "settings.h"
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
|
||||
#define PIN 25
|
||||
#define Pixels 1
|
||||
|
||||
#define MODE_OFF 0
|
||||
#define MODE_RAINBOW 1
|
||||
#define MODE_ATTACK 2
|
||||
#define MODE_SNIFF 3
|
||||
|
||||
extern Settings settings_obj;
|
||||
extern Adafruit_NeoPixel strip;
|
||||
|
||||
class LedInterface {
|
||||
@@ -20,12 +27,23 @@ class LedInterface {
|
||||
|
||||
uint32_t Wheel(byte WheelPos);
|
||||
|
||||
uint8_t current_mode = MODE_OFF;
|
||||
|
||||
void rainbow();
|
||||
void ledOff();
|
||||
void attackLed();
|
||||
void sniffLed();
|
||||
|
||||
public:
|
||||
LedInterface();
|
||||
|
||||
void RunSetup();
|
||||
void main(uint32_t currentTime);
|
||||
|
||||
void setMode(uint8_t);
|
||||
uint8_t getMode();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -363,6 +363,8 @@ void WiFiScan::startWiFiAttacks(uint8_t scan_mode, uint16_t color, String title_
|
||||
this->wifi_initialized = true;
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.attackLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_ATTACK);
|
||||
#endif
|
||||
initTime = millis();
|
||||
}
|
||||
@@ -381,6 +383,8 @@ bool WiFiScan::shutdownWiFi() {
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.offLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_OFF);
|
||||
#endif
|
||||
|
||||
this->wifi_initialized = false;
|
||||
@@ -401,6 +405,8 @@ bool WiFiScan::shutdownBLE() {
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.offLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_OFF);
|
||||
#endif
|
||||
|
||||
this->ble_initialized = false;
|
||||
@@ -524,6 +530,8 @@ void WiFiScan::RunAPScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
Serial.println(text_table4[9] + (String)access_points->size());
|
||||
@@ -759,6 +767,8 @@ void WiFiScan::RunEspressifScan(uint8_t scan_mode, uint16_t color) {
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
@@ -794,6 +804,8 @@ void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
sd_obj.openCapture("packet_monitor");
|
||||
@@ -867,6 +879,8 @@ void WiFiScan::RunEapolScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
num_eapol = 0;
|
||||
@@ -1000,6 +1014,8 @@ void WiFiScan::RunPwnScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
@@ -1038,6 +1054,8 @@ void WiFiScan::RunBeaconScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
@@ -1075,6 +1093,8 @@ void WiFiScan::RunRawScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
@@ -1112,6 +1132,8 @@ void WiFiScan::RunDeauthScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
@@ -1151,6 +1173,8 @@ void WiFiScan::RunProbeScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
#else
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "settings.h"
|
||||
#include "Assets.h"
|
||||
#include "flipperLED.h"
|
||||
#include "LedInterface.h"
|
||||
//#include "MenuFunctions.h"
|
||||
|
||||
#define bad_list_length 3
|
||||
@@ -78,6 +79,7 @@ extern BatteryInterface battery_obj;
|
||||
extern TemperatureInterface temp_obj;
|
||||
extern Settings settings_obj;
|
||||
extern flipperLED flipper_led;
|
||||
extern LedInterface led_obj;
|
||||
|
||||
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq);
|
||||
//int ieee80211_raw_frame_sanity_check(int32_t arg, int32_t arg2, int32_t arg3);
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
//#define MARAUDER_V6
|
||||
//#define MARAUDER_KIT
|
||||
//#define GENERIC_ESP32
|
||||
#define MARAUDER_FLIPPER
|
||||
//#define MARAUDER_FLIPPER
|
||||
#define ESP32_LDDB
|
||||
|
||||
#define MARAUDER_VERSION "v0.9.18"
|
||||
#define MARAUDER_VERSION "v0.9.19"
|
||||
|
||||
//// BUTTON DEFINITIONS
|
||||
#ifdef MARAUDER_MINI
|
||||
@@ -353,6 +354,10 @@
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
#define SD_CS 10
|
||||
#endif
|
||||
|
||||
#ifdef ESP32_LDDB
|
||||
#define SD_CS 4
|
||||
#endif
|
||||
//// END SD DEFINITIONS
|
||||
|
||||
//// SCREEN STUFF
|
||||
@@ -403,4 +408,12 @@
|
||||
#endif
|
||||
//// END SCREEN STUFF
|
||||
|
||||
//// NEOPIXEL STUFF
|
||||
#ifdef ESP32_LDDB
|
||||
#define PIN 17
|
||||
#else
|
||||
#define PIN 25
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -142,10 +142,6 @@ void setup()
|
||||
// Serial.println("Does not have screen");
|
||||
//#endif
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.RunSetup();
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.RunSetup();
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
@@ -191,6 +187,10 @@ void setup()
|
||||
|
||||
settings_obj.begin();
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.RunSetup();
|
||||
#endif
|
||||
|
||||
//Serial.println("This is a test Channel: " + (String)settings_obj.loadSetting<uint8_t>("Channel"));
|
||||
//if (settings_obj.loadSetting<bool>( "Force PMKID"))
|
||||
// Serial.println("This is a test Force PMKID: true");
|
||||
@@ -314,6 +314,9 @@ void loop()
|
||||
#ifdef HAS_SCREEN
|
||||
menu_function_obj.main(currentTime);
|
||||
#endif
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
led_obj.main(currentTime);
|
||||
#endif
|
||||
//cli_obj.main(currentTime);
|
||||
}
|
||||
if (wifi_scan_obj.currentScanMode == OTA_UPDATE)
|
||||
@@ -336,6 +339,9 @@ void loop()
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
menu_function_obj.main(currentTime);
|
||||
#endif
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
led_obj.main(currentTime);
|
||||
#endif
|
||||
//cli_obj.main(currentTime);
|
||||
delay(1);
|
||||
}
|
||||
|
||||
BIN
esp32_marauder/esp32_marauder.ino.d32.bin
Normal file
BIN
esp32_marauder/esp32_marauder.ino.d32.bin
Normal file
Binary file not shown.
@@ -5,6 +5,9 @@ void flipperLED::RunSetup() {
|
||||
pinMode(G_PIN, OUTPUT);
|
||||
pinMode(R_PIN, OUTPUT);
|
||||
|
||||
if (!settings_obj.loadSetting<bool>("EnableLED"))
|
||||
return;
|
||||
|
||||
delay(50);
|
||||
|
||||
digitalWrite(B_PIN, LOW);
|
||||
@@ -19,6 +22,9 @@ void flipperLED::RunSetup() {
|
||||
}
|
||||
|
||||
void flipperLED::attackLED() {
|
||||
if (!settings_obj.loadSetting<bool>("EnableLED"))
|
||||
return;
|
||||
|
||||
digitalWrite(B_PIN, HIGH);
|
||||
digitalWrite(G_PIN, HIGH);
|
||||
digitalWrite(R_PIN, HIGH);
|
||||
@@ -27,6 +33,9 @@ void flipperLED::attackLED() {
|
||||
}
|
||||
|
||||
void flipperLED::sniffLED() {
|
||||
if (!settings_obj.loadSetting<bool>("EnableLED"))
|
||||
return;
|
||||
|
||||
digitalWrite(B_PIN, HIGH);
|
||||
digitalWrite(G_PIN, HIGH);
|
||||
digitalWrite(R_PIN, HIGH);
|
||||
@@ -35,6 +44,9 @@ void flipperLED::sniffLED() {
|
||||
}
|
||||
|
||||
void flipperLED::offLED() {
|
||||
if (!settings_obj.loadSetting<bool>("EnableLED"))
|
||||
return;
|
||||
|
||||
digitalWrite(B_PIN, HIGH);
|
||||
digitalWrite(G_PIN, HIGH);
|
||||
digitalWrite(R_PIN, HIGH);
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
#ifndef flipperLED_h
|
||||
#define flipperLED_h
|
||||
|
||||
#include "configs.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define B_PIN 4
|
||||
#define G_PIN 5
|
||||
#define R_PIN 6
|
||||
|
||||
extern Settings settings_obj;
|
||||
|
||||
class flipperLED {
|
||||
|
||||
public:
|
||||
|
||||
@@ -282,6 +282,12 @@ bool Settings::createDefaultSettings(fs::FS &fs) {
|
||||
jsonBuffer["Settings"][2]["range"]["min"] = false;
|
||||
jsonBuffer["Settings"][2]["range"]["max"] = true;
|
||||
|
||||
jsonBuffer["Settings"][3]["name"] = "EnableLED";
|
||||
jsonBuffer["Settings"][3]["type"] = "bool";
|
||||
jsonBuffer["Settings"][3]["value"] = true;
|
||||
jsonBuffer["Settings"][3]["range"]["min"] = false;
|
||||
jsonBuffer["Settings"][3]["range"]["max"] = true;
|
||||
|
||||
//jsonBuffer.printTo(settingsFile);
|
||||
if (serializeJson(jsonBuffer, settingsFile) == 0) {
|
||||
Serial.println(F("Failed to write to file"));
|
||||
|
||||
Reference in New Issue
Block a user