Add incognito option to avoid manglign history & logs during tests
This commit is contained in:
@@ -245,22 +245,26 @@ main_loop(char *script_cmds_file, char *script_cmd, bool stayInCommandLoop) {
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
session.history_path = NULL;
|
||||
if (searchHomeFilePath(&session.history_path, NULL, PROXHISTORY, true) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(ERR, "No history will be recorded");
|
||||
session.history_path = NULL;
|
||||
if (session.incognito) {
|
||||
PrintAndLogEx(INFO, "No history will be recorded");
|
||||
} else {
|
||||
if (searchHomeFilePath(&session.history_path, NULL, PROXHISTORY, true) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(ERR, "No history will be recorded");
|
||||
session.history_path = NULL;
|
||||
} else {
|
||||
|
||||
# if defined(_WIN32)
|
||||
// SetConsoleCtrlHandler((PHANDLER_ROUTINE)terminate_handler, true);
|
||||
# else
|
||||
struct sigaction action;
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = &terminate_handler;
|
||||
sigaction(SIGINT, &action, &old_action);
|
||||
# endif
|
||||
rl_catch_signals = 1;
|
||||
rl_set_signals();
|
||||
read_history(session.history_path);
|
||||
# if defined(_WIN32)
|
||||
// SetConsoleCtrlHandler((PHANDLER_ROUTINE)terminate_handler, true);
|
||||
# else
|
||||
struct sigaction action;
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = &terminate_handler;
|
||||
sigaction(SIGINT, &action, &old_action);
|
||||
# endif
|
||||
rl_catch_signals = 1;
|
||||
rl_set_signals();
|
||||
read_history(session.history_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -565,6 +569,7 @@ static void show_help(bool showFullHelp, char *exec_name) {
|
||||
PrintAndLogEx(NORMAL, " -l/--lua <lua script file> execute lua script.");
|
||||
PrintAndLogEx(NORMAL, " -s/--script-file <cmd_script_file> script file with one Proxmark3 command per line");
|
||||
PrintAndLogEx(NORMAL, " -i/--interactive enter interactive mode after executing the script or the command");
|
||||
PrintAndLogEx(NORMAL, " --incognito do not use history nor log files");
|
||||
PrintAndLogEx(NORMAL, "\nOptions in flasher mode:");
|
||||
PrintAndLogEx(NORMAL, " --flash flash Proxmark3, requires at least one --image");
|
||||
PrintAndLogEx(NORMAL, " --unlock-bootloader Enable flashing of bootloader area *DANGEROUS* (need --flash or --flash-info)");
|
||||
@@ -698,6 +703,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
session.pm3_present = false;
|
||||
session.help_dump_mode = false;
|
||||
session.incognito = false;
|
||||
bool waitCOMPort = false;
|
||||
bool addLuaExec = false;
|
||||
bool stayInCommandLoop = false;
|
||||
@@ -903,6 +909,12 @@ int main(int argc, char *argv[]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// do not use history nor log files
|
||||
if (strcmp(argv[i], "--incognito") == 0) {
|
||||
session.incognito = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// go to flash mode
|
||||
if (strcmp(argv[i], "--flash") == 0) {
|
||||
flash_mode = true;
|
||||
|
||||
Reference in New Issue
Block a user