mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-07 16:48:15 +08:00
Add incognito option to avoid manglign history & logs during tests
This commit is contained in:
parent
6fc6517ccb
commit
008c920db0
4 changed files with 32 additions and 14 deletions
|
@ -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;
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue