mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
hf 14b sriread - uses cliparser
This commit is contained in:
parent
40413c9b0c
commit
d612f17b13
1 changed files with 29 additions and 14 deletions
|
@ -34,16 +34,6 @@ bool apdu_in_framing_enable = true;
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
static int usage_hf_14b_read_srx(void) {
|
|
||||||
PrintAndLogEx(NORMAL, "Usage: hf 14b sriread [h] <1|2>");
|
|
||||||
PrintAndLogEx(NORMAL, "Options:");
|
|
||||||
PrintAndLogEx(NORMAL, " h this help");
|
|
||||||
PrintAndLogEx(NORMAL, " <1|2> 1 = SRIX4K , 2 = SRI512");
|
|
||||||
PrintAndLogEx(NORMAL, "Example:");
|
|
||||||
PrintAndLogEx(NORMAL, _YELLOW_(" hf 14b sriread 1"));
|
|
||||||
PrintAndLogEx(NORMAL, _YELLOW_(" hf 14b sriread 2"));
|
|
||||||
return PM3_SUCCESS;
|
|
||||||
}
|
|
||||||
static int usage_hf_14b_write_srx(void) {
|
static int usage_hf_14b_write_srx(void) {
|
||||||
PrintAndLogEx(NORMAL, "Usage: hf 14b [h] sriwrite <1|2> <block> <data>");
|
PrintAndLogEx(NORMAL, "Usage: hf 14b [h] sriwrite <1|2> <block> <data>");
|
||||||
PrintAndLogEx(NORMAL, "Options:");
|
PrintAndLogEx(NORMAL, "Options:");
|
||||||
|
@ -932,11 +922,36 @@ static int CmdHF14BReader(const char *Cmd) {
|
||||||
* this command just dumps the contents of the memory/
|
* this command just dumps the contents of the memory/
|
||||||
*/
|
*/
|
||||||
static int CmdHF14BReadSri(const char *Cmd) {
|
static int CmdHF14BReadSri(const char *Cmd) {
|
||||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
|
||||||
if (strlen(Cmd) < 1 || cmdp == 'h') return usage_hf_14b_read_srx();
|
|
||||||
|
|
||||||
uint8_t tagtype = param_get8(Cmd, 0);
|
CLIParserContext *ctx;
|
||||||
uint8_t blocks = (tagtype == 1) ? 0x7F : 0x0F;
|
CLIParserInit(&ctx, "hf 14b sriread",
|
||||||
|
"Read contents of a SRI512 | SRIX4K tag",
|
||||||
|
"hf 14b sriread\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
|
iso14b_card_select_t card;
|
||||||
|
if (get_14b_UID(&card) == false) {
|
||||||
|
PrintAndLogEx(WARNING, "no tag found");
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (card.uidlen != 8) {
|
||||||
|
PrintAndLogEx(FAILED, "current dump command only work with SRI4K / SRI512 tags");
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// detect cardsize
|
||||||
|
// 1 = 4096
|
||||||
|
// 2 = 512
|
||||||
|
uint8_t cardtype = get_st_cardsize(card.uid);
|
||||||
|
uint8_t blocks = (cardtype == 1) ? 0x7F : 0x0F;
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandMIX(CMD_HF_SRI_READ, blocks, 0, 0, NULL, 0);
|
SendCommandMIX(CMD_HF_SRI_READ, blocks, 0, 0, NULL, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue