Change main script path from preferences
This commit is contained in:
parent
100b9f4540
commit
3ed846ed0a
|
@ -53,9 +53,12 @@ void setup() {
|
|||
mode = selector::read() ? SETUP : ATTACK;
|
||||
|
||||
if (mode == ATTACK) {
|
||||
preferences::load(); // Reload the settings (in case the main script path changed)
|
||||
|
||||
led::setColor(128, 0, 0); // Turn LED red
|
||||
attack::start(); // Start keystroke injection attack
|
||||
led::setColor(0, 0, 20); // Set LED to blue
|
||||
|
||||
mode = SETUP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "../msc/msc.h"
|
||||
#include "../duckparser/duckparser.h"
|
||||
#include "../preferences/preferences.h"
|
||||
|
||||
namespace attack {
|
||||
// ====== PRIVATE ====== //
|
||||
|
@ -14,7 +15,7 @@ namespace attack {
|
|||
// ====== PUBLIC ====== //
|
||||
void start() {
|
||||
// Open main BadUSB script
|
||||
msc::open("/main.script");
|
||||
msc::open(preferences::getMainScript().c_str());
|
||||
|
||||
// Read and parse file
|
||||
char buffer[READ_BUFFER];
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace preferences {
|
|||
std::string default_layout { "US" };
|
||||
int default_delay { 5 };
|
||||
|
||||
std::string main_script { "main.script" };
|
||||
|
||||
// ======== PUBLIC ======== //
|
||||
void load() {
|
||||
// Read config file
|
||||
|
@ -54,6 +56,7 @@ namespace preferences {
|
|||
msc_rev = config_doc["msc_rev"].as<std::string>();
|
||||
default_layout = config_doc["default_layout"].as<std::string>();
|
||||
default_delay = config_doc["default_delay"].as<int>();
|
||||
main_script = config_doc["main_script"].as<std::string>();
|
||||
}
|
||||
|
||||
bool mscEnabled() {
|
||||
|
@ -95,4 +98,8 @@ namespace preferences {
|
|||
int getDefaultDelay() {
|
||||
return default_delay;
|
||||
}
|
||||
|
||||
std::string getMainScript() {
|
||||
return main_script;
|
||||
}
|
||||
}
|
|
@ -20,4 +20,6 @@ namespace preferences {
|
|||
|
||||
std::string getDefaultLayout();
|
||||
int getDefaultDelay();
|
||||
|
||||
std::string getMainScript();
|
||||
}
|
Loading…
Reference in New Issue