mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Merge branch 'master' of github.com:RfidResearchGroup/proxmark3
This commit is contained in:
commit
b36eaac3bf
6 changed files with 26 additions and 21 deletions
|
@ -670,7 +670,7 @@ int CmdHF14ASim(const char *Cmd) {
|
|||
"hf 14a sim -t 4 -> ISO/IEC 14443-4\n"
|
||||
"hf 14a sim -t 5 -> MIFARE Tnp3xxx\n"
|
||||
"hf 14a sim -t 6 -> MIFARE Mini\n"
|
||||
"hf 14a sim -t 7 -> MFUEV1 / NTAG 215 Amiibo\n"
|
||||
"hf 14a sim -t 7 -> MFU EV1 / NTAG 215 Amiibo\n"
|
||||
"hf 14a sim -t 8 -> MIFARE Classic 4k\n"
|
||||
"hf 14a sim -t 9 -> FM11RF005SH Shanghai Metro\n"
|
||||
"hf 14a sim -t 10 -> ST25TA IKEA Rothult\n");
|
||||
|
@ -687,7 +687,7 @@ int CmdHF14ASim(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
int tagtype = arg_get_int(ctx, 1);
|
||||
int tagtype = arg_get_int_def(ctx, 1, 1);
|
||||
|
||||
int uid_len = 0;
|
||||
uint8_t uid[10] = {0};
|
||||
|
@ -727,6 +727,11 @@ int CmdHF14ASim(const char *Cmd) {
|
|||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (tagtype > 10) {
|
||||
PrintAndLogEx(ERR, "Undefined tag %d", tagtype);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
sector_t *k_sector = NULL;
|
||||
uint8_t k_sectorsCount = 40;
|
||||
|
||||
|
@ -752,7 +757,7 @@ int CmdHF14ASim(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(INFO, "Press pm3-button to abort simulation");
|
||||
bool keypress = kbd_enter_pressed();
|
||||
while (!keypress) {
|
||||
while (keypress == false) {
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == 0) continue;
|
||||
if (resp.status != PM3_SUCCESS) break;
|
||||
|
|
|
@ -706,7 +706,7 @@ static int CmdHFiClassSim(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
int sim_type = arg_get_int(ctx, 1);
|
||||
int sim_type = arg_get_int_def(ctx, 1, 3);
|
||||
|
||||
int csn_len = 0;
|
||||
uint8_t csn[8] = {0};
|
||||
|
|
|
@ -713,18 +713,18 @@ static int CmdHFMFPRdbl(const char *Cmd) {
|
|||
}
|
||||
|
||||
if (blockn > 255) {
|
||||
PrintAndLogEx(ERR, "<block number> must be in range [0..255] instead of: %d", blockn);
|
||||
PrintAndLogEx(ERR, "<block number> must be in range [0..255] got: %d", blockn);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (keylen != 16) {
|
||||
PrintAndLogEx(ERR, "<key> must be 16 bytes long instead of: %d", keylen);
|
||||
PrintAndLogEx(ERR, "<key> must be 16 bytes long. got: %d", keylen);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
// 3 blocks - wo iso14443-4 chaining
|
||||
if (blocksCount > 3) {
|
||||
PrintAndLogEx(ERR, "blocks count must be less than 3 instead of: %d", blocksCount);
|
||||
PrintAndLogEx(ERR, "blocks count must be less than 3. got: %d", blocksCount);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
|
@ -823,12 +823,12 @@ static int CmdHFMFPRdsc(const char *Cmd) {
|
|||
}
|
||||
|
||||
if (sectorNum > 39) {
|
||||
PrintAndLogEx(ERR, "<sector number> must be in range [0..39] instead of: %d", sectorNum);
|
||||
PrintAndLogEx(ERR, "<sector number> must be in range [0..39] got: %d", sectorNum);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (keylen != 16) {
|
||||
PrintAndLogEx(ERR, "<key> must be 16 bytes long instead of: %d", keylen);
|
||||
PrintAndLogEx(ERR, "<key> must be 16 bytes long. got: %d", keylen);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
|
@ -925,17 +925,17 @@ static int CmdHFMFPWrbl(const char *Cmd) {
|
|||
}
|
||||
|
||||
if (blockNum > 255) {
|
||||
PrintAndLogEx(ERR, "<block number> must be in range [0..255] instead of: %d", blockNum);
|
||||
PrintAndLogEx(ERR, "<block number> must be in range [0..255] got: %d", blockNum);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (keylen != 16) {
|
||||
PrintAndLogEx(ERR, "<key> must be 16 bytes long instead of: %d", keylen);
|
||||
PrintAndLogEx(ERR, "<key> must be 16 bytes long. got: %d", keylen);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (datainlen != 16) {
|
||||
PrintAndLogEx(ERR, "<data> must be 16 bytes long instead of: %d", datainlen);
|
||||
PrintAndLogEx(ERR, "<data> must be 16 bytes long. got: %d", datainlen);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
|
|
|
@ -2730,8 +2730,8 @@ static int CmdHF14AMfUSim(const char *Cmd) {
|
|||
"The UID from emulator memory will be used if not specified.\n"
|
||||
"See `hf 14a sim -h` to see available types. You want 2 or 7 usually.",
|
||||
"hf mfu sim -t 2 --uid 11223344556677 -> MIFARE Ultralight\n"
|
||||
"hf mfu sim -t 7 --uid 11223344556677 -n 5 -> MFUEV1 / NTAG 215 Amiibo\n"
|
||||
"hf mfu sim -t 7 -> MFUEV1 / NTAG 215 Amiibo"
|
||||
"hf mfu sim -t 7 --uid 11223344556677 -n 5 -> MFU EV1 / NTAG 215 Amiibo\n"
|
||||
"hf mfu sim -t 7 -> MFU EV1 / NTAG 215 Amiibo"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
|
|
|
@ -597,7 +597,7 @@ static int CmdLCD(const char *Cmd) {
|
|||
int r_len = 0;
|
||||
uint8_t raw[1] = {0};
|
||||
CLIGetHexWithReturn(ctx, 1, raw, &r_len);
|
||||
int j = arg_get_int(ctx, 2);
|
||||
int j = arg_get_int_def(ctx, 2, 1);
|
||||
if (j < 1) {
|
||||
PrintAndLogEx(WARNING, "Count must be larger than zero");
|
||||
return PM3_EINVARG;
|
||||
|
@ -763,7 +763,7 @@ static int CmdStandalone(const char *Cmd) {
|
|||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
uint8_t arg = arg_get_u32(ctx, 1);
|
||||
uint8_t arg = arg_get_u32_def(ctx, 1, 1);
|
||||
CLIParserFree(ctx);
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_STANDALONE, (uint8_t *)&arg, sizeof(arg));
|
||||
|
@ -938,7 +938,7 @@ static int CmdPing(const char *Cmd) {
|
|||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
uint32_t len = arg_get_u32(ctx, 1);
|
||||
uint32_t len = arg_get_u32_def(ctx, 1, 32);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (len > PM3_CMD_DATA_SIZE)
|
||||
|
|
|
@ -165,7 +165,7 @@ int CmdEM4x70Write(const char *Cmd) {
|
|||
|
||||
CLIParserInit(&ctx, "lf em 4x70 write",
|
||||
"Write EM4x70\n",
|
||||
"lf em 4x70 write -b 15 -d c0de -> write 'c0de' to block 15\n"
|
||||
"lf em 4x70 write -b 15 -d c0de -> write 'c0de' to block 15\n"
|
||||
"lf em 4x70 write -b 15 -d c0de --par -> adds parity bit to commands\n"
|
||||
);
|
||||
|
||||
|
@ -181,7 +181,7 @@ int CmdEM4x70Write(const char *Cmd) {
|
|||
|
||||
etd.parity = arg_get_lit(ctx, 1);
|
||||
|
||||
int addr = arg_get_int(ctx, 2);
|
||||
int addr = arg_get_int_def(ctx, 2, 1);
|
||||
|
||||
int word_len = 0;
|
||||
uint8_t word[2] = {0x0};
|
||||
|
@ -190,12 +190,12 @@ int CmdEM4x70Write(const char *Cmd) {
|
|||
CLIParserFree(ctx);
|
||||
|
||||
if (addr < 0 || addr >= EM4X70_NUM_BLOCKS) {
|
||||
PrintAndLogEx(FAILED, "block has to be within range [0, 15]");
|
||||
PrintAndLogEx(FAILED, "block has to be within range [0, 15] got: %d", addr);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (word_len != 2) {
|
||||
PrintAndLogEx(FAILED, "word/data length must be 2 bytes instead of %d", word_len);
|
||||
PrintAndLogEx(FAILED, "word/data length must be 2 bytes. got: %d", word_len);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue