mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-12 15:50:47 -08:00
Command demo on/off to hide MAC addresses
This commit is contained in:
@@ -1570,6 +1570,24 @@ namespace cli {
|
||||
" -h: Hidden network\r\n"
|
||||
" -ch: Channel (default=1)\r\n"
|
||||
" -b: BSSID MAC address (default=random)");
|
||||
|
||||
Command cmd_demo = cli.addCommand("demo", [](cmd* c) {
|
||||
Command cmd(c);
|
||||
|
||||
String mode { cmd.getArg("m").getValue() };
|
||||
|
||||
if (mode == "on") {
|
||||
strh::hide_mac(true);
|
||||
debugln("Demo Mode: ACTIVATED");
|
||||
} else {
|
||||
strh::hide_mac(false);
|
||||
debugln("Demo Mode: DEACTIVATED");
|
||||
}
|
||||
});
|
||||
cmd_demo.addPosArg("m/ode", "on");
|
||||
cmd_demo.setDescription(" Demo mode\r\n"
|
||||
" on: turn on demo mode\r\n"
|
||||
" off: turn off demo mode");
|
||||
}
|
||||
|
||||
void parse(const char* input) {
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
#include "strh.h"
|
||||
|
||||
namespace strh {
|
||||
bool hidden { false };
|
||||
|
||||
void hide_mac(bool mode) {
|
||||
hidden = mode;
|
||||
}
|
||||
|
||||
String whitespace(int len) {
|
||||
String res;
|
||||
|
||||
@@ -64,8 +70,13 @@ namespace strh {
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (i>0) str += ':';
|
||||
if (b[i] < 0x10) str += '0';
|
||||
str += String(b[i], HEX);
|
||||
if (hidden && (i>=2) && (i<=4)) {
|
||||
str += '*';
|
||||
str += '*';
|
||||
} else {
|
||||
if (b[i] < 0x10) str += '0';
|
||||
str += String(b[i], HEX);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
@@ -129,7 +140,7 @@ namespace strh {
|
||||
}
|
||||
|
||||
String boolean(bool value) {
|
||||
if(value) {
|
||||
if (value) {
|
||||
return String(F("True"));
|
||||
} else {
|
||||
return String(F("False"));
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <Arduino.h> // String
|
||||
|
||||
namespace strh {
|
||||
void hide_mac(bool mode);
|
||||
String whitespace(int len);
|
||||
String left(int len, String str);
|
||||
String right(int len, String str);
|
||||
|
||||
Reference in New Issue
Block a user