Command to stop endless script

This commit is contained in:
Stefan Kremser 2018-10-11 13:19:20 +02:00
parent 4a8c7c7877
commit 3230750a26
3 changed files with 16 additions and 8 deletions

View File

@ -46,13 +46,18 @@ void CLI::update() {
}
}
void CLI::stop() {
queue->clear();
prntln(CLI_STOPPED_SCRIPT);
}
void CLI::enableDelay(uint32_t delayTime) {
delayed = true;
this->delayTime = delayTime;
delayStartTime = millis();
}
void CLI::exec(String& input) {
void CLI::exec(String input) {
// quick exit when input is empty
if (input.length() == 0) return;
@ -140,7 +145,7 @@ bool CLI::eqlsCMD(int i, const char* keyword) {
return eqls(list->get(i).c_str(), keyword);
}
void CLI::runLine(String &input) {
void CLI::runLine(String input) {
String tmp;
for (int i = 0; i < input.length(); i++) {
@ -160,7 +165,7 @@ void CLI::runLine(String &input) {
if (tmp.length() > 0) runCommand(tmp);
}
void CLI::runCommand(String& input) {
void CLI::runCommand(String input) {
input.replace(String(NEWLINE), String());
input.replace(String(CARRIAGERETURN), String());
@ -689,11 +694,13 @@ void CLI::runCommand(String& input) {
for (int i = 1; i < list->size(); i++) {
if (eqlsCMD(i, CLI_SCAN)) scan.stop();
else if (eqlsCMD(i, CLI_ATTACK)) attack.stop();
else if (eqlsCMD(i, CLI_SCRIPT)) this->stop();
else parameterError(list->get(i));
}
} else {
scan.stop();
attack.stop();
this->stop();
}
}

View File

@ -57,13 +57,14 @@ class CLI {
void disable();
void update();
void stop();
void enableDelay(uint32_t delayTime);
void exec(String& input);
void exec(String input);
void execFile(String path);
void runLine(String& input);
void runCommand(String& input);
void runLine(String input);
void runCommand(String input);
private:
bool enabled = false;

View File

@ -172,7 +172,7 @@ const char CLI_HELP_REMOVE_A[] PROGMEM = "remove <ap/station/name/ssid> <id>";
const char CLI_HELP_REMOVE_B[] PROGMEM = "remove <ap/station/names/ssids> [all]";
const char CLI_HELP_ATTACK[] PROGMEM = "attack [beacon] [deauth] [deauthall] [probe] [nooutput] [-t <timeout>]";
const char CLI_HELP_ATTACK_STATUS[] PROGMEM = "attack status [<on/off>]";
const char CLI_HELP_STOP[] PROGMEM = "stop <all/scan/attack>";
const char CLI_HELP_STOP[] PROGMEM = "stop <all/scan/attack/script>";
const char CLI_HELP_SYSINFO[] PROGMEM = "sysinfo";
const char CLI_HELP_CLEAR[] PROGMEM = "clear";
const char CLI_HELP_FORMAT[] PROGMEM = "format";
@ -205,7 +205,7 @@ const char CLI_SERIAL_ENABLED[] PROGMEM = "Serial interface enabled";
const char CLI_SERIAL_DISABLED[] PROGMEM = "Serial interface disabled";
const char CLI_ERROR[] PROGMEM = "ERROR: ";
const char CLI_ERROR_PARAMETER[] PROGMEM = "Error Invalid parameter \"";
const char CLI_STOPPED_SCRIPT[] PROGMEM = "Stopped executing script \"";
const char CLI_STOPPED_SCRIPT[] PROGMEM = "Cleared CLI command queue";
const char CLI_CONTINUOUSLY[] PROGMEM = "continuously";
const char CLI_EXECUTING[] PROGMEM = "Executing ";
const char CLI_SCRIPT_DONE_CONTINUE[] PROGMEM = "Done executing script - type 'stop script' to end the continuous mode";