This commit is contained in:
iceman1001 2023-10-15 13:19:33 +02:00
commit 0442e04e05
5 changed files with 23 additions and 25 deletions

View file

@ -3279,9 +3279,9 @@ static int CmdNumCon(const char *Cmd) {
} radix_t;
radix_t radix[] = {
{"dec..... ", 10},
{"hex..... 0x", 16},
{"bin..... 0b", 2}
{"dec... ", 10},
{"hex... ", 16},
{"bin... ", 2}
};
char s[600] = {0};
@ -3289,8 +3289,8 @@ static int CmdNumCon(const char *Cmd) {
for (uint8_t i = 0; i < ARRAYLEN(radix); i++) {
MBEDTLS_MPI_CHK(mbedtls_mpi_write_string(&N, radix[i].radix, s, sizeof(s), &slen));
if (slen > 0) {
PrintAndLogEx(INFO, "%s%s", radix[i].desc, s);
if (slen > 0) {
PrintAndLogEx(SUCCESS, "%s%s", radix[i].desc, s);
}
}

View file

@ -1286,7 +1286,7 @@ static int CmdHFiClassESetBlk(const char *Cmd) {
void *argtable[] = {
arg_param_begin,
arg_int1("b", "blk", "<dec>", "block number"),
arg_int1(NULL, "blk", "<dec>", "block number"),
arg_str0("d", "data", "<hex>", "bytes to write, 8 hex bytes"),
arg_param_end
};
@ -2140,15 +2140,15 @@ static int CmdHFiClass_WriteBlock(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "hf iclass wrbl",
"Write data to an iCLASS tag",
"hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B\n"
"hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B --credit\n"
"hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA --ki 0");
"hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B\n"
"hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B --credit\n"
"hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA --ki 0");
void *argtable[] = {
arg_param_begin,
arg_str0("k", "key", "<hex>", "Access key as 8 hex bytes"),
arg_int0(NULL, "ki", "<dec>", "Key index to select key from memory 'hf iclass managekeys'"),
arg_int1("b", "block", "<dec>", "The block number to read"),
arg_int1(NULL, "blk", "<dec>", "block number"),
arg_str1("d", "data", "<hex>", "data to write as 8 hex bytes"),
arg_str0("m", "mac", "<hex>", "replay mac data (4 hex bytes)"),
arg_lit0(NULL, "credit", "key is assumed to be the credit key"),
@ -2599,15 +2599,15 @@ static int CmdHFiClass_ReadBlock(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "hf iclass rdbl",
"Read a iCLASS block from tag",
"hf iclass rdbl -b 6 -k 0011223344556677\n"
"hf iclass rdbl -b 27 -k 0011223344556677 --credit\n"
"hf iclass rdbl -b 10 --ki 0");
"hf iclass rdbl --blk 6 -k 0011223344556677\n"
"hf iclass rdbl --blk 27 -k 0011223344556677 --credit\n"
"hf iclass rdbl --blk 10 --ki 0");
void *argtable[] = {
arg_param_begin,
arg_str0("k", "key", "<hex>", "Access key as 8 hex bytes"),
arg_int0(NULL, "ki", "<dec>", "Key index to select key from memory 'hf iclass managekeys'"),
arg_int1("b", "block", "<dec>", "The block number to read"),
arg_int1(NULL, "blk", "<dec>", "Block number"),
arg_lit0(NULL, "credit", "key is assumed to be the credit key"),
arg_lit0(NULL, "elite", "elite computations applied to key"),
arg_lit0(NULL, "raw", "no computations applied to key"),
@ -4431,22 +4431,17 @@ static int CmdHFiClassConfigCard(const char *Cmd) {
static int CmdHFiClassSAM(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "hf iclass sam",
"Manage via SAM\n",
"Extract PACS via a HID SAM\n",
"hf iclass sam\n"
);
void *argtable[] = {
arg_param_begin,
arg_str0("d", "data", "<hex>", "data"),
arg_lit0("v", "verbose", "verbose output"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
int dlen = 0;
uint8_t data[128] = {0};
CLIGetHexWithReturn(ctx, 1, data, &dlen);
bool verbose = arg_get_lit(ctx, 2);
bool verbose = arg_get_lit(ctx, 1);
CLIParserFree(ctx);
Iso7816CommandChannel channel = CC_CONTACT;

View file

@ -655,12 +655,12 @@ static int CmdHfLTOWriteBlock(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "hf lto wrbl",
"Write data to block on LTO tag",
"hf lto wrbl --block 128 -d 0001020304050607080910111213141516171819202122232425262728293031");
"hf lto wrbl --blk 128 -d 0001020304050607080910111213141516171819202122232425262728293031");
void *argtable[] = {
arg_param_begin,
arg_str1("d", "data", "<hex>", "32 bytes of data to write (64 hex symbols, no spaces)"),
arg_int1(NULL, "block", "<dec>", "The block number to write to as an integer"),
arg_int1(NULL, "blk", "<dec>", "The block number to write to as an integer"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);

View file

@ -79,7 +79,7 @@ Read iCLASS Block
Options
---
-k, --key <hex> Access key as 16 hex symbols
-b, --block <dec> The block number to read as an integer
--blk <dec> The block number to read as an integer
--ki <dec> Key index to select key from memory 'hf iclass managekeys'
--credit key is assumed to be the credit key
--elite elite computations applied to key
@ -94,7 +94,7 @@ Write to iCLASS Block
Options
---
-k, --key <hex> Access key as 16 hex symbols
-b, --block <dec> The block number to read as an integer
--blk <dec> The block number to read as an integer
-d, --data <hex> data to write as 16 hex symbols
--ki <dec> Key index to select key from memory 'hf iclass managekeys'
--credit key is assumed to be the credit key

View file

@ -803,6 +803,9 @@ typedef struct {
// STATIC Nonce detect pm3: when collecting nonces for hardnested
#define PM3_ESTATIC_NONCE -25
// No PACS data pm3: when using HID SAM to retried PACS data
#define PM3_ENOPACS -26
// No data pm3: no data available, no host frame available (not really an error)
#define PM3_ENODATA -98
// Quit program client: reserved, order to quit the program