mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
add hf lto reader command with continious mode
This commit is contained in:
parent
ac0088791a
commit
1df51f3875
3 changed files with 68 additions and 6 deletions
|
@ -92,7 +92,7 @@ int CmdHFSearch(const char *Cmd) {
|
||||||
PROMPT_CLEARLINE;
|
PROMPT_CLEARLINE;
|
||||||
PrintAndLogEx(INPLACE, " Searching for LTO-CM tag...");
|
PrintAndLogEx(INPLACE, " Searching for LTO-CM tag...");
|
||||||
if (IfPm3Iso14443a()) {
|
if (IfPm3Iso14443a()) {
|
||||||
if (infoLTO(false) == PM3_SUCCESS) {
|
if (reader_lto(false, false) == PM3_SUCCESS) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LTO-CM tag") " found\n");
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LTO-CM tag") " found\n");
|
||||||
res = PM3_SUCCESS;
|
res = PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,6 +385,65 @@ static void lto_print_mmi(uint8_t *d) {
|
||||||
// - Application Specific Data (1056b)
|
// - Application Specific Data (1056b)
|
||||||
// - Suspended Append Writes (128b)
|
// - Suspended Append Writes (128b)
|
||||||
|
|
||||||
|
static int CmdHFLTOReader(const char *Cmd) {
|
||||||
|
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf lto reader",
|
||||||
|
"Act as a LTO-CM reader. Look for LTO-CM tags until Enter or the pm3 button is pressed",
|
||||||
|
"hf lto reader -@ -> continuous reader mode"
|
||||||
|
);
|
||||||
|
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_lit0("@", NULL, "optional - continuous reader mode"),
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
bool cm = arg_get_lit(ctx, 1);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
|
if (cm) {
|
||||||
|
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " to exit");
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader_lto(cm, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int reader_lto(bool loop, bool verbose) {
|
||||||
|
|
||||||
|
int ret = PM3_SUCCESS;
|
||||||
|
|
||||||
|
do {
|
||||||
|
uint8_t serial[5];
|
||||||
|
uint8_t serial_len = sizeof(serial);
|
||||||
|
uint8_t type_info[2];
|
||||||
|
|
||||||
|
lto_switch_off_field();
|
||||||
|
lto_switch_on_field();
|
||||||
|
clearCommandBuffer();
|
||||||
|
|
||||||
|
ret = lto_select(serial, serial_len, type_info, verbose);
|
||||||
|
if (loop) {
|
||||||
|
if (ret != PM3_SUCCESS) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == PM3_SUCCESS) {
|
||||||
|
|
||||||
|
if (loop == false) {
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintAndLogEx(INFO, "UID......... " _GREEN_("%s"), sprint_hex_inrow(serial, sizeof(serial)));
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (loop && kbd_enter_pressed() == false);
|
||||||
|
|
||||||
|
lto_switch_off_field();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int infoLTO(bool verbose) {
|
int infoLTO(bool verbose) {
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
@ -397,6 +456,7 @@ int infoLTO(bool verbose) {
|
||||||
int ret_val = lto_select(serial_number, serial_len, type_info, verbose);
|
int ret_val = lto_select(serial_number, serial_len, type_info, verbose);
|
||||||
if (verbose == false) {
|
if (verbose == false) {
|
||||||
if (ret_val == PM3_SUCCESS) {
|
if (ret_val == PM3_SUCCESS) {
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(INFO, "UID......... " _YELLOW_("%s"), sprint_hex_inrow(serial_number, sizeof(serial_number)));
|
PrintAndLogEx(INFO, "UID......... " _YELLOW_("%s"), sprint_hex_inrow(serial_number, sizeof(serial_number)));
|
||||||
}
|
}
|
||||||
lto_switch_off_field();
|
lto_switch_off_field();
|
||||||
|
@ -801,12 +861,13 @@ static int CmdHfLTRestore(const char *Cmd) {
|
||||||
|
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||||
{"dump", CmdHfLTODump, IfPm3Iso14443a, "Dump LTO-CM tag to file"},
|
{"dump", CmdHfLTODump, IfPm3Iso14443a, "Dump LTO-CM tag to file"},
|
||||||
{"restore", CmdHfLTRestore, IfPm3Iso14443a, "Restore dump file to LTO-CM tag"},
|
{"info", CmdHfLTOInfo, IfPm3Iso14443a, "Tag information"},
|
||||||
{"info", CmdHfLTOInfo, IfPm3Iso14443a, "Tag information"},
|
|
||||||
{"rdbl", CmdHfLTOReadBlock, IfPm3Iso14443a, "Read block"},
|
|
||||||
{"wrbl", CmdHfLTOWriteBlock, IfPm3Iso14443a, "Write block"},
|
|
||||||
{"list", CmdHfLTOList, AlwaysAvailable, "List LTO-CM history"},
|
{"list", CmdHfLTOList, AlwaysAvailable, "List LTO-CM history"},
|
||||||
|
{"rdbl", CmdHfLTOReadBlock, IfPm3Iso14443a, "Read block"},
|
||||||
|
{"reader", CmdHFLTOReader, IfPm3Iso14443a, "Act like a LTO-CM reader"},
|
||||||
|
{"restore", CmdHfLTRestore, IfPm3Iso14443a, "Restore dump file to LTO-CM tag"},
|
||||||
|
{"wrbl", CmdHfLTOWriteBlock, IfPm3Iso14443a, "Write block"},
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
int reader_lto(bool loop, bool verbose);
|
||||||
int infoLTO(bool verbose);
|
int infoLTO(bool verbose);
|
||||||
int dumpLTO(uint8_t *dump, bool verbose);
|
int dumpLTO(uint8_t *dump, bool verbose);
|
||||||
int restoreLTO(uint8_t *dump, bool verbose);
|
int restoreLTO(uint8_t *dump, bool verbose);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue