diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index 1b074d9fe..0c5a3226b 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -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 execute lua script."); PrintAndLogEx(NORMAL, " -s/--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; diff --git a/client/src/ui.c b/client/src/ui.c index 26759cc4d..9bf097583 100644 --- a/client/src/ui.c +++ b/client/src/ui.c @@ -305,6 +305,9 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) { pthread_mutex_lock(&print_lock); bool linefeed = true; + if (logging && session.incognito) { + logging = 0; + } if ((g_printAndLog & PRINTANDLOG_LOG) && logging && !logfile) { char *my_logfile_path = NULL; char filename[40]; diff --git a/client/src/ui.h b/client/src/ui.h index 66f6df279..b30f6c868 100644 --- a/client/src/ui.h +++ b/client/src/ui.h @@ -41,6 +41,7 @@ typedef struct { qtWindow_t plot; qtWindow_t overlay; bool overlay_sliders; + bool incognito; // char *defaultPaths[spItemCount]; // Array should allow loop searching for files clientdebugLevel_t client_debug_level; // uint8_t device_debug_level; diff --git a/tools/pm3_tests.sh b/tools/pm3_tests.sh index 3568667b3..da335bb9b 100755 --- a/tools/pm3_tests.sh +++ b/tools/pm3_tests.sh @@ -322,6 +322,8 @@ while true; do if $TESTALL || $TESTCLIENT; then echo -e "\n${C_BLUE}Testing client:${C_NC} ${CLIENTBIN:=./client/proxmark3}" if ! CheckFileExist "proxmark3 exists" "$CLIENTBIN"; then break; fi + # Avoid mangling history and logs + CLIENTBIN="$CLIENTBIN --incognito" echo -e "\n${C_BLUE}Testing basic help:${C_NC}" if ! CheckExecute "proxmark help" "$CLIENTBIN -h" "wait"; then break; fi if ! CheckExecute "proxmark help text ISO7816" "$CLIENTBIN -t 2>&1" "ISO7816"; then break; fi