mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-18 03:00:58 +08:00
added a client preference for delay of execution. This a global delay before each command is parsed. You can unset it with by setting delay to ZERO. The purpose of this setting is for users who want to use the pm3 against a implanted implant where you have to get a good position and arrange the pm3 while pressing <enter>.
This commit is contained in:
parent
d7da384f69
commit
28eec73445
5 changed files with 68 additions and 2 deletions
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
|||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Added a new client preference, delay of execution, a delay in ms before a cmd is sent. Good for implants (@iceman1001)
|
||||
- Fix `lf t55xx brute` - now correctly prints last key if it was correct (@scott4290)
|
||||
- Added support python scripts (@salmg)
|
||||
- Add new standalone mode `hf_reblay` - relay 14a over bt (@salmg)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "ui.h"
|
||||
#include "comms.h"
|
||||
#include "util_posix.h" // msleep
|
||||
|
||||
bool AlwaysAvailable(void) {
|
||||
return true;
|
||||
|
@ -193,6 +194,11 @@ void CmdsHelp(const command_t Commands[]) {
|
|||
}
|
||||
|
||||
int CmdsParse(const command_t Commands[], const char *Cmd) {
|
||||
|
||||
if (session.client_exe_delay != 0) {
|
||||
msleep(session.client_exe_delay);
|
||||
}
|
||||
|
||||
// Help dump children
|
||||
if (strcmp(Cmd, "XX_internal_command_dump_XX") == 0) {
|
||||
dumpCommandsRecursive(Commands, 0, false);
|
||||
|
|
|
@ -243,6 +243,8 @@ void preferences_save_callback(json_t *root) {
|
|||
JsonSaveStr(root, "logging.level", "NORMAL");
|
||||
}
|
||||
*/
|
||||
JsonSaveInt(root, "client.exe.delay", session.client_exe_delay);
|
||||
|
||||
}
|
||||
void preferences_load_callback(json_t *root) {
|
||||
json_error_t up_error = {0};
|
||||
|
@ -331,6 +333,9 @@ void preferences_load_callback(json_t *root) {
|
|||
if (strncmp(tempStr, "extended", 8) == 0) session.device_debug_level = ddbEXTENDED;
|
||||
}
|
||||
*/
|
||||
// client command execution delay
|
||||
if (json_unpack_ex(root, &up_error, 0, "{s:i}", "client.exe.delay", &i1) == 0)
|
||||
session.client_exe_delay = i1;
|
||||
}
|
||||
|
||||
// Help Functions
|
||||
|
@ -502,6 +507,11 @@ static void showBarModeState(prefShowOpt_t opt) {
|
|||
}
|
||||
}
|
||||
|
||||
static void showClientExeDelayState(void) {
|
||||
PrintAndLogEx(INFO, " Cmd execution delay.... "_GREEN_("%u"), session.client_exe_delay);
|
||||
}
|
||||
|
||||
|
||||
static int setCmdEmoji(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "prefs set emoji ",
|
||||
|
@ -718,6 +728,35 @@ static int setCmdDeviceDebug (const char *Cmd)
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
static int setCmdExeDelay(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "prefs set clientdelay",
|
||||
"Set presistent preference of delay before executing a command in the client",
|
||||
"prefs set clientdelay --ms 0 --> unsets any delay\n"
|
||||
"prefs set clientdelay --ms 1000 --> sets 1000ms delay"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_int0(NULL, "ms", "<ms>", "delay in micro seconds"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
uint16_t new_value = (uint16_t)arg_get_int_def(ctx, 1, 0);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (session.client_exe_delay != new_value) {
|
||||
showClientExeDelayState();
|
||||
session.client_exe_delay = new_value;
|
||||
showClientExeDelayState();
|
||||
preferences_save();
|
||||
} else {
|
||||
showClientExeDelayState();
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int setCmdHint(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "prefs set hints ",
|
||||
|
@ -1045,9 +1084,26 @@ static int getCmdSavePaths(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int getCmdExeDelay(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "prefs get clientdelay",
|
||||
"Get preference of delay time before execution of a command in the client",
|
||||
"prefs get clientdelay"
|
||||
);
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
CLIParserFree(ctx);
|
||||
showClientExeDelayState();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static command_t CommandTableGet[] = {
|
||||
{"barmode", getCmdBarMode, AlwaysAvailable, "Get bar mode preference"},
|
||||
{"clientdebug", getCmdDebug, AlwaysAvailable, "Get client debug level preference"},
|
||||
{"clientdelay", getCmdExeDelay, AlwaysAvailable, "Get client execution delay preference"},
|
||||
{"color", getCmdColor, AlwaysAvailable, "Get color support preference"},
|
||||
{"savepaths", getCmdSavePaths, AlwaysAvailable, "Get file folder "},
|
||||
// {"devicedebug", getCmdDeviceDebug, AlwaysAvailable, "Get device debug level"},
|
||||
|
@ -1061,6 +1117,7 @@ static command_t CommandTableSet[] = {
|
|||
{"help", setCmdHelp, AlwaysAvailable, "This help"},
|
||||
{"barmode", setCmdBarMode, AlwaysAvailable, "Set bar mode"},
|
||||
{"clientdebug", setCmdDebug, AlwaysAvailable, "Set client debug level"},
|
||||
{"clientdelay", setCmdExeDelay, AlwaysAvailable, "Set client execution delay"},
|
||||
{"color", setCmdColor, AlwaysAvailable, "Set color support"},
|
||||
{"emoji", setCmdEmoji, AlwaysAvailable, "Set emoji display"},
|
||||
{"hints", setCmdHint, AlwaysAvailable, "Set hint display"},
|
||||
|
@ -1120,8 +1177,9 @@ static int CmdPrefShow(const char *Cmd) {
|
|||
showClientDebugState(prefShowNone);
|
||||
showPlotSliderState(prefShowNone);
|
||||
// showDeviceDebugState(prefShowNone);
|
||||
|
||||
showBarModeState(prefShowNone);
|
||||
showClientExeDelayState();
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ typedef struct {
|
|||
clientdebugLevel_t client_debug_level;
|
||||
barMode_t bar_mode;
|
||||
// uint8_t device_debug_level;
|
||||
uint16_t client_exe_delay;
|
||||
char *history_path;
|
||||
pm3_device *current_device;
|
||||
} session_arg_t;
|
||||
|
|
Loading…
Reference in a new issue