This commit is contained in:
Just Call Me Koko
2020-03-21 20:20:25 -04:00
parent a2fa6759a8
commit ca4048983f
8 changed files with 24 additions and 124 deletions

View File

@@ -1,27 +0,0 @@
#include "BatteryInterface.h"
BatteryInterface::BatteryInterface() {
}
void BatteryInterface::RunSetup() {
Wire.begin(I2C_SDA, I2C_SCL);
}
int8_t BatteryInterface::getBatteryLevel() {
Wire.beginTransmission(IP5306_ADDR);
Wire.write(0x78);
if (Wire.endTransmission(false) == 0 &&
Wire.requestFrom(0x75, 1)) {
this->i2c_supported = true;
switch (Wire.read() & 0xF0) {
case 0xE0: return 25;
case 0xC0: return 50;
case 0x80: return 75;
case 0x00: return 100;
default: return 0;
}
}
this->i2c_supported = false;
return -1;
}

View File

@@ -1,23 +0,0 @@
#ifndef BatteryInterface_h
#define BatteryInterface_h
#include <Wire.h>
#define I2C_SDA 33
#define I2C_SCL 22
#define IP5306_ADDR 0x75
class BatteryInterface {
private:
public:
int8_t battery_level = 0;
bool i2c_supported = false;
BatteryInterface();
void RunSetup();
int8_t getBatteryLevel();
};
#endif

View File

@@ -233,21 +233,21 @@ void MenuFunctions::RunSetup()
// Build WiFi sniffer Menu
wifiSnifferMenu.parentMenu = &wifiMenu; // Main Menu is second menu parent
addNodes(&wifiSnifferMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(wifiSnifferMenu.parentMenu);});
addNodes(&wifiSnifferMenu, "Probe Request Sniff", TFT_CYAN, NULL, PROBE_SNIFF, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(WIFI_SCAN_PROBE, TFT_CYAN);});
addNodes(&wifiSnifferMenu, "Beacon Sniff", TFT_MAGENTA, NULL, BEACON_SNIFF, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA);});
addNodes(&wifiSnifferMenu, "Deauth Sniff", TFT_RED, NULL, DEAUTH_SNIFF, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(WIFI_SCAN_DEAUTH, TFT_RED);});
addNodes(&wifiSnifferMenu, "Probe Request Sniff", TFT_CYAN, NULL, PROBE_SNIFF, [this](){wifi_scan_obj.StartScan(WIFI_SCAN_PROBE, TFT_CYAN);});
addNodes(&wifiSnifferMenu, "Beacon Sniff", TFT_MAGENTA, NULL, BEACON_SNIFF, [this](){wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA);});
addNodes(&wifiSnifferMenu, "Deauth Sniff", TFT_RED, NULL, DEAUTH_SNIFF, [this](){wifi_scan_obj.StartScan(WIFI_SCAN_DEAUTH, TFT_RED);});
// Build WiFi scanner Menu
wifiScannerMenu.parentMenu = &wifiMenu; // Main Menu is second menu parent
addNodes(&wifiScannerMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(wifiScannerMenu.parentMenu);});
addNodes(&wifiScannerMenu, "Packet Monitor", TFT_BLUE, NULL, PACKET_MONITOR, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(WIFI_PACKET_MONITOR, TFT_BLUE);});
addNodes(&wifiScannerMenu, "EAPOL Scan", TFT_VIOLET, NULL, EAPOL, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(WIFI_SCAN_EAPOL, TFT_VIOLET);});
addNodes(&wifiScannerMenu, "Packet Monitor", TFT_BLUE, NULL, PACKET_MONITOR, [this](){wifi_scan_obj.StartScan(WIFI_PACKET_MONITOR, TFT_BLUE);});
addNodes(&wifiScannerMenu, "EAPOL Scan", TFT_VIOLET, NULL, EAPOL, [this](){wifi_scan_obj.StartScan(WIFI_SCAN_EAPOL, TFT_VIOLET);});
// Build WiFi attack menu
wifiAttackMenu.parentMenu = &wifiMenu; // Main Menu is second menu parent
addNodes(&wifiAttackMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(wifiAttackMenu.parentMenu);});
addNodes(&wifiAttackMenu, "Beacon Spam Random", TFT_ORANGE, NULL, BEACON_SPAM, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(WIFI_ATTACK_BEACON_SPAM, TFT_ORANGE);});
addNodes(&wifiAttackMenu, "Rick Roll Beacon", TFT_YELLOW, NULL, RICK_ROLL, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(WIFI_ATTACK_RICK_ROLL, TFT_YELLOW);});
addNodes(&wifiAttackMenu, "Beacon Spam Random", TFT_ORANGE, NULL, BEACON_SPAM, [this](){wifi_scan_obj.StartScan(WIFI_ATTACK_BEACON_SPAM, TFT_ORANGE);});
addNodes(&wifiAttackMenu, "Rick Roll Beacon", TFT_YELLOW, NULL, RICK_ROLL, [this](){wifi_scan_obj.StartScan(WIFI_ATTACK_RICK_ROLL, TFT_YELLOW);});
// Build Bluetooth Menu
bluetoothMenu.parentMenu = &mainMenu; // Second Menu is third menu parent
@@ -258,17 +258,17 @@ void MenuFunctions::RunSetup()
// Build bluetooth sniffer Menu
bluetoothSnifferMenu.parentMenu = &bluetoothMenu; // Second Menu is third menu parent
addNodes(&bluetoothSnifferMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(bluetoothSnifferMenu.parentMenu);});
addNodes(&bluetoothSnifferMenu, "Bluetooth Sniffer", TFT_GREEN, NULL, BLUETOOTH_SNIFF, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(BT_SCAN_ALL, TFT_GREEN);});
addNodes(&bluetoothSnifferMenu, "Bluetooth Sniffer", TFT_GREEN, NULL, BLUETOOTH_SNIFF, [this](){wifi_scan_obj.StartScan(BT_SCAN_ALL, TFT_GREEN);});
// Build bluetooth scanner Menu
bluetoothScannerMenu.parentMenu = &bluetoothMenu; // Second Menu is third menu parent
addNodes(&bluetoothScannerMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(bluetoothScannerMenu.parentMenu);});
addNodes(&bluetoothScannerMenu, "Detect Card Skimmers", TFT_MAGENTA, NULL, CC_SKIMMERS, [this](){sd_obj.initSD(); wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);});
addNodes(&bluetoothScannerMenu, "Detect Card Skimmers", TFT_MAGENTA, NULL, CC_SKIMMERS, [this](){wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);});
// General apps menu
generalMenu.parentMenu = &mainMenu;
addNodes(&generalMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){display_obj.draw_tft = false; changeMenu(generalMenu.parentMenu);});
addNodes(&generalMenu, "Draw", TFT_WHITE, NULL, DRAW, [this](){sd_obj.initSD(); display_obj.clearScreen(); display_obj.draw_tft = true;});
addNodes(&generalMenu, "Draw", TFT_WHITE, NULL, DRAW, [this](){display_obj.clearScreen(); display_obj.draw_tft = true;});
// Device menu
deviceMenu.parentMenu = &mainMenu;
@@ -309,7 +309,6 @@ void MenuFunctions::RunSetup()
// Function to change menu
void MenuFunctions::changeMenu(Menu* menu)
{
sd_obj.initSD();
display_obj.initScrollValues();
display_obj.setupScrollArea(TOP_FIXED_AREA, BOT_FIXED_AREA);
display_obj.tft.init();

View File

@@ -159,16 +159,7 @@ void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
}
}
void SDInterface::main(uint32_t currentTime) {
/*
if (currentTime != 0) {
if (currentTime - initTime >= 3000) {
//Serial.println("Checking for SD");
this->initTime = millis();
this->initSD();
}
}*/
void SDInterface::main() {
if ((this->supported) && (this->do_save)) {
//Serial.println("Saving packet...");
buffer_obj.forceSave(&SD);

View File

@@ -33,7 +33,7 @@ class SDInterface {
void openCapture(String file_name = "");
void runUpdate();
void performUpdate(Stream &updateSource, size_t updateSize);
void main(uint32_t currentTime = 0);
void main();
//void savePacket(uint8_t* buf, uint32_t len);
};

View File

@@ -284,7 +284,7 @@ void WiFiScan::RunInfo()
display_obj.tft.println(" SD Card: Not Connected");
display_obj.tft.println("SD Card Size: 0");
}
/*
battery_obj.battery_level = battery_obj.getBatteryLevel();
if (battery_obj.i2c_supported) {
display_obj.tft.println(" IP5306 I2C: supported");
@@ -292,6 +292,7 @@ void WiFiScan::RunInfo()
}
else
display_obj.tft.println(" IP5306 I2C: not supported");
*/
}

View File

@@ -14,7 +14,7 @@
#include "Display.h"
#include "SDInterface.h"
#include "Buffer.h"
#include "BatteryInterface.h"
//#include "BatteryInterface.h"
//#include "MenuFunctions.h"
#define bad_list_length 3
@@ -40,7 +40,7 @@
extern Display display_obj;
extern SDInterface sd_obj;
extern Buffer buffer_obj;
extern BatteryInterface battery_obj;
//extern BatteryInterface battery_obj;
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq);

View File

@@ -14,7 +14,7 @@ https://www.online-utility.org/image/convert/to/XBM
#include "freertos/task.h"
#include "esp_system.h"
#include <Arduino.h>
#include <Preferences.h>
//#include <Preferences.h>
#include "Assets.h"
@@ -24,7 +24,7 @@ https://www.online-utility.org/image/convert/to/XBM
#include "SDInterface.h"
#include "Web.h"
#include "Buffer.h"
#include "BatteryInterface.h"
//#include "BatteryInterface.h"
//#include "icons.h"
Display display_obj;
@@ -33,57 +33,26 @@ MenuFunctions menu_function_obj;
SDInterface sd_obj;
Web web_obj;
Buffer buffer_obj;
BatteryInterface battery_obj;
//BatteryInterface battery_obj;
Preferences preferences;
//Preferences preferences;
uint32_t currentTime = 0;
void setup()
{
Serial.begin(115200);
Serial.println("\n\n-------------------------------------\n");
//Serial.println("\n\n-------------------------------------\n");
pinMode(FLASH_BUTTON, INPUT);
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, LOW);
preferences.begin("my-app", false);
unsigned int counter = preferences.getUInt("counter", 0);
if (counter == 0) {
counter++;
// Print the counter to Serial Monitor
Serial.printf("Current counter value: %u\n", counter);
// Store the counter to the Preferences
preferences.putUInt("counter", counter);
// Close the Preferences
preferences.end();
Serial.println("Initial reboot...");
ESP.restart();
}
else {
Serial.println("Initial reboot complete");
counter = 0;
// Print the counter to Serial Monitor
Serial.printf("Current counter value: %u\n", counter);
// Store the counter to the Preferences
preferences.putUInt("counter", counter);
// Close the Preferences
preferences.end();
}
// Preset SPI CS pins to avoid bus conflicts
digitalWrite(TFT_CS, HIGH);
digitalWrite(SD_CS, HIGH);
Serial.begin(115200);
Serial.println("\n\n--------------------------------\n");
Serial.println(" ESP32 Marauder \n");
@@ -102,16 +71,6 @@ void setup()
// Build menus
menu_function_obj.RunSetup();
battery_obj.RunSetup();
battery_obj.battery_level = battery_obj.getBatteryLevel();
if (battery_obj.i2c_supported) {
Serial.println("IP5306 I2C Supported: true");
}
else
Serial.println("IP5306 I2C Supported: false");
}
@@ -129,7 +88,7 @@ void loop()
{
display_obj.main();
wifi_scan_obj.main(currentTime);
sd_obj.main(currentTime);
sd_obj.main();
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
if ((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) &&
(wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL))