Reintroduced led command

This commit is contained in:
Spacehuhn 2021-01-12 14:11:26 +01:00
parent 3e4e699e78
commit 247f9ce336
5 changed files with 24 additions and 14 deletions

View File

@ -285,7 +285,6 @@ void CLI::runCommand(String input) {
prntln(CLI_HELP_SEND_PROBE);
prntln(CLI_HELP_LED_A);
prntln(CLI_HELP_LED_B);
prntln(CLI_HELP_LED_ENABLE);
prntln(CLI_HELP_DRAW);
prntln(CLI_HELP_SCREEN_ON);
prntln(CLI_HELP_SCREEN_MODE);
@ -1088,6 +1087,21 @@ void CLI::runCommand(String input) {
}
}
// ===== LED ===== //
// led <r> <g> <b> [<brightness>]
else if ((list->size() == 4) && eqlsCMD(0, CLI_LED)) {
led::setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt());
}
// led <#rrggbb> [<brightness>]
else if ((list->size() == 2) &&
eqlsCMD(0, CLI_LED) && (list->get(1).charAt(0) == HASHSIGN)) {
uint8_t c[3];
strToColor(list->get(1), c);
led::setColor(c[0], c[1], c[2]);
}
// ===== DELAY ===== //
else if ((list->size() == 2) && eqlsCMD(0, CLI_DELAY)) {
uint32_t endTime = currentTime + getTime(list->get(1));

View File

@ -201,9 +201,8 @@ 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_LED_A[] PROGMEM = "led <r> <g> <b>";
const char CLI_HELP_LED_B[] PROGMEM = "led <#rrggbb>";
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>";

View File

@ -2,6 +2,8 @@
#pragma once
#include <cstdint>
enum LED_MODE {
OFF,
SCAN,
@ -13,4 +15,5 @@ namespace led {
void setup();
void update();
void setMode(LED_MODE new_mode, bool force = false);
void setColor(uint8_t r, uint8_t g, uint8_t b);
}

View File

@ -148,7 +148,7 @@ namespace wifi {
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);
return str(W_TXT);
}
bool handleFileRead(String path) {

View File

@ -44,7 +44,6 @@
- [`send probe <mac> <ssid> <ch>`](#send)
- [`led <r> <g> <b> [<brightness>]`](#led)
- [`led <#rrggbb> [<brightness>]`](#led)
- [`led <enable/disable>`](#led)
- [`draw`](#draw)
- [`startap`](#startap)
- [`stopap`](#startap)
@ -290,19 +289,14 @@ Copy pasting packets out of Wireshark is very unlikely to work.
Also note that you're still limited to 512 characters per command!
## LED
`led <r> <g> <b> [<brightness>]`
`led <r> <g> <b>`
Changes LED color based on input.
Be sure to disable the LED updates (see command below), if you don't want the color the be rewritten by a scan or attack.
The brightness is optional and must be given in percent (between 0 and 100).
Be sure to disable the LED updates (see command below), if you don't want the color the be rewritten by a scan or attack.
`led <#rrggbb> [<brightness>]`
`led <#rrggbb>`
Changes LED color based on input in form of a hex value.
The value **must** start with a `#` and have 6 following characters.
`led <enable/disable>`
Dis/Enables the LED updates. If disabled, the color will not change automatically anymore if you start a scan or attack.
To disable the LED in general use `set ledenabled false`.
## DELAY
`delay <time>`
Will pause the serial command interface for a given time.