mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
new command: hints h - will set hint messages on / off. default mode is OFF. Hint texts makes its easier for beginners but adds text to anyone who knows the pm3 client
This commit is contained in:
parent
6172eccefd
commit
945e508e23
6 changed files with 116 additions and 6 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]
|
||||
- Add 'HINTS' command. Will turn off / on hint messages. Default mode is OFF. (@iceman1001)
|
||||
- Add colour to `hf 14a` and `hf mfu` commands (@dunderhay)
|
||||
- Add colour to `lf hid` commands (@dunderhay)
|
||||
- Change `script run hf_bruteforce -s start_id -e end_id -t timeout -x mifare_card_type` - The hf_bruteforce card script now requires Mifare type (mfc or mfu) (@dunderhay)
|
||||
|
|
|
@ -1628,13 +1628,13 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
|||
}
|
||||
|
||||
if (isMifareUltralight) {
|
||||
PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`hf mfu info`"));
|
||||
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mfu info`"));
|
||||
}
|
||||
if (isMifarePlus) {
|
||||
PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`hf mfp info`"));
|
||||
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mfp info`"));
|
||||
}
|
||||
if (isMifareDesfire) {
|
||||
PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`hf mfdes info`"));
|
||||
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mfdes info`"));
|
||||
}
|
||||
|
||||
|
||||
|
|
106
client/cmdmain.c
106
client/cmdmain.c
|
@ -36,9 +36,23 @@
|
|||
#include "cmdwiegand.h" // wiegand commands
|
||||
#include "ui.h"
|
||||
#include "util_posix.h"
|
||||
#include "commonutil.h" // ARRAYLEN
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
static int usage_hints(void) {
|
||||
PrintAndLogEx(NORMAL, "Turn on/off hints");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Usage: hints [h] <0|1>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h This help");
|
||||
PrintAndLogEx(NORMAL, " <0|1> off or on");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, " hints 1");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_msleep(void) {
|
||||
PrintAndLogEx(NORMAL, "Sleep for given amount of milliseconds");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
@ -78,6 +92,70 @@ static void AppendDate(char *s, size_t slen, char *fmt) {
|
|||
strftime(s, slen, fmt, ct);
|
||||
}
|
||||
|
||||
static int lf_search_plus(const char *Cmd) {
|
||||
|
||||
sample_config oldconfig;
|
||||
memset(&oldconfig, 0, sizeof(sample_config));
|
||||
|
||||
int retval = lf_getconfig(&oldconfig);
|
||||
|
||||
if (retval != PM3_SUCCESS) {
|
||||
PrintAndLogEx(ERR, "failed to get current device config");
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Divisor : frequency(khz)
|
||||
// 95 88 47 31 23
|
||||
// 125.00 134.83 250.00 375.00 500.00
|
||||
|
||||
int16_t default_divisor[] = {95, 88, 47, 31, 23};
|
||||
|
||||
/*
|
||||
default LF config is set to:
|
||||
decimation = 1
|
||||
bits_per_sample = 8
|
||||
averaging = YES
|
||||
divisor = 95 (125kHz)
|
||||
trigger_threshold = 0
|
||||
samples_to_skip = 0
|
||||
verbose = YES
|
||||
*/
|
||||
sample_config config = {
|
||||
.decimation = 1,
|
||||
.bits_per_sample = 8,
|
||||
.averaging = 1,
|
||||
.trigger_threshold = 0,
|
||||
.samples_to_skip = 0,
|
||||
.verbose = false
|
||||
};
|
||||
|
||||
// Iteration defaults
|
||||
for (int i = 0; i < ARRAYLEN(default_divisor); ++i) {
|
||||
|
||||
if (kbd_enter_pressed()) {
|
||||
PrintAndLogEx(INFO, "Keyboard pressed. Done.");
|
||||
break;
|
||||
}
|
||||
// Try to change config!
|
||||
uint32_t d;
|
||||
d = config.divisor = default_divisor[i];
|
||||
PrintAndLogEx(INFO, "--> trying ( " _GREEN_("%d.%02d kHz")")", 12000 / (d + 1), ((1200000 + (d + 1) / 2) / (d + 1)) - ((12000 / (d + 1)) * 100));
|
||||
|
||||
retval = lf_config(&config);
|
||||
if (retval != PM3_SUCCESS)
|
||||
break;
|
||||
|
||||
// The config for pm3 is changed, we can trying search!
|
||||
retval = CmdLFfind(Cmd);
|
||||
if (retval == PM3_SUCCESS)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
lf_config(&oldconfig);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int CmdAuto(const char *Cmd) {
|
||||
char ctmp = tolower(param_getchar(Cmd, 0));
|
||||
if (ctmp == 'h') return usage_auto();
|
||||
|
@ -90,8 +168,12 @@ static int CmdAuto(const char *Cmd) {
|
|||
if (ret == PM3_SUCCESS)
|
||||
return ret;
|
||||
|
||||
ret = lf_search_plus("");
|
||||
if (ret == PM3_SUCCESS)
|
||||
return ret;
|
||||
|
||||
PrintAndLogEx(INFO, "Failed both LF / HF SEARCH,");
|
||||
PrintAndLogEx(INFO, "Trying 'lf read' and save a trace for you...");
|
||||
PrintAndLogEx(INFO, "Trying " _YELLOW_("`lf read`") "and save a trace for you");
|
||||
|
||||
CmdPlot("");
|
||||
lf_read(false, 40000);
|
||||
|
@ -109,6 +191,27 @@ int CmdRem(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int CmdHints(const char *Cmd) {
|
||||
uint32_t ms = 0;
|
||||
char ctmp = tolower(param_getchar(Cmd, 0));
|
||||
if (ctmp == 'h') return usage_hints();
|
||||
|
||||
if (strlen(Cmd) < 1) {
|
||||
PrintAndLogEx(INFO, "Hints are %s", (g_showhints) ? "ON" : "OFF");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
if (param_getchar(Cmd, 0) != 0x00) {
|
||||
ms = param_get32ex(Cmd, 0, 0, 10);
|
||||
if (ms == 0)
|
||||
g_showhints = false;
|
||||
else
|
||||
g_showhints = true;
|
||||
}
|
||||
PrintAndLogEx(INFO, "Hints are %s", (g_showhints) ? "ON" : "OFF");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int CmdMsleep(const char *Cmd) {
|
||||
uint32_t ms = 0;
|
||||
char ctmp = tolower(param_getchar(Cmd, 0));
|
||||
|
@ -149,6 +252,7 @@ static command_t CommandTable[] = {
|
|||
{"usart", CmdUsart, IfPm3FpcUsartFromUsb, "{ USART commands... }"},
|
||||
{"wiegand", CmdWiegand, AlwaysAvailable, "{ Wiegand format manipulation... }"},
|
||||
{"", CmdHelp, AlwaysAvailable, ""},
|
||||
{"hints", CmdHints, AlwaysAvailable, "Turn hints on / off"},
|
||||
{"msleep", CmdMsleep, AlwaysAvailable, "Add a pause in milliseconds"},
|
||||
{"rem", CmdRem, AlwaysAvailable, "Add a text line in log file"},
|
||||
{"quit", CmdQuit, AlwaysAvailable, ""},
|
||||
|
|
|
@ -55,7 +55,7 @@ extern size_t DemodBufferLen;
|
|||
extern size_t g_DemodStartIdx;
|
||||
extern bool showDemod;
|
||||
extern uint8_t g_debugMode;
|
||||
|
||||
extern uint8_t g_showhints;
|
||||
|
||||
#ifndef FILE_PATH_SIZE
|
||||
#define FILE_PATH_SIZE 1000
|
||||
|
|
|
@ -127,6 +127,10 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) {
|
|||
// skip debug messages if client debugging is turned off i.e. 'DATA SETDEBUG 0'
|
||||
if (g_debugMode == 0 && level == DEBUG)
|
||||
return;
|
||||
|
||||
// skip HINT messages if client has hints turned off i.e. 'HINT 0'
|
||||
if (g_showhints == 0 && level == HINT)
|
||||
return;
|
||||
|
||||
char prefix[20] = {0};
|
||||
char buffer[MAX_PRINT_BUFFER] = {0};
|
||||
|
@ -146,6 +150,7 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) {
|
|||
case DEBUG:
|
||||
strncpy(prefix, _BLUE_("[#]"), sizeof(prefix) - 1);
|
||||
break;
|
||||
case HINT:
|
||||
case SUCCESS:
|
||||
strncpy(prefix, _GREEN_("[+]"), sizeof(prefix) - 1);
|
||||
break;
|
||||
|
|
|
@ -31,7 +31,7 @@ extern session_arg_t session;
|
|||
#define M_PI 3.14159265358979323846264338327
|
||||
#endif
|
||||
#define MAX_PRINT_BUFFER 2048
|
||||
typedef enum logLevel {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG, INPLACE} logLevel_t;
|
||||
typedef enum logLevel {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG, INPLACE, HINT} logLevel_t;
|
||||
|
||||
void ShowGui(void);
|
||||
void HideGraphWindow(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue