Skip to content

Commit

Permalink
Reintroduced led command
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacehuhn committed Jan 12, 2021
1 parent 3e4e699 commit 247f9ce
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
16 changes: 15 additions & 1 deletion esp8266_deauther/CLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down
5 changes: 2 additions & 3 deletions esp8266_deauther/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>";
Expand Down
3 changes: 3 additions & 0 deletions esp8266_deauther/led.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#pragma once

#include <cstdint>

enum LED_MODE {
OFF,
SCAN,
Expand All @@ -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);
}
2 changes: 1 addition & 1 deletion esp8266_deauther/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 3 additions & 9 deletions serialcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 247f9ce

Please sign in to comment.