This commit is contained in:
iceman1001 committed 2026-07-01 22:44:45 +02:00
1 parent fd6dd10806
commit b05bb68e24
1 file changed
+18 -9
+18 -9
View File
@@ -199,7 +199,6 @@ static int process_hitags_common_args(CLIParserContext *ctx, lf_hitag_data_t *co
int res = CLIParamHexToBuf(arg_get_str(ctx, 2), nrar, HITAG_NRAR_SIZE, &nrar_len);
if (res != 0) {
CLIParserFree(ctx);
return PM3_EINVARG;
}
@@ -212,7 +211,6 @@ static int process_hitags_common_args(CLIParserContext *ctx, lf_hitag_data_t *co
res = CLIParamHexToBuf(arg_get_str(ctx, 4), key, HITAG_CRYPTOKEY_SIZE, &key_len);
if (res != 0) {
CLIParserFree(ctx);
return PM3_EINVARG;
}
@@ -235,13 +233,15 @@ static int process_hitags_common_args(CLIParserContext *ctx, lf_hitag_data_t *co
// complete options
switch (key_len) {
case HITAG_PASSWORD_SIZE:
case HITAG_PASSWORD_SIZE: {
use_82xx = true;
break;
case HITAG_CRYPTOKEY_SIZE:
}
case HITAG_CRYPTOKEY_SIZE: {
use_crypto = true;
break;
default: // key_len == 0
}
default: { // key_len == 0
if (use_82xx) {
memcpy(key, "\xBB\xDD\x33\x99", 4);
key_len = 4;
@@ -249,6 +249,8 @@ static int process_hitags_common_args(CLIParserContext *ctx, lf_hitag_data_t *co
memcpy(key, "ONMIKR", 6);
key_len = 6;
}
break;
}
}
// check coherence
@@ -400,7 +402,10 @@ static int CmdLFHitagSRead(const char *Cmd) {
lf_hitag_data_t packet;
if (process_hitags_common_args(ctx, &packet) < 0) return PM3_EINVARG;
if (process_hitags_common_args(ctx, &packet) != PM3_SUCCESS) {
CLIParserFree(ctx);
return PM3_EINVARG;
}
uint32_t page = arg_get_int_def(ctx, 6, 0);
@@ -592,7 +597,7 @@ static int CmdLFHitagSDump(const char *Cmd) {
lf_hitag_data_t packet;
memset(&packet, 0, sizeof(packet));
if (process_hitags_common_args(ctx, &packet) < 0) {
if (process_hitags_common_args(ctx, &packet) != PM3_SUCCESS) {
CLIParserFree(ctx);
return PM3_EINVARG;
}
@@ -683,7 +688,7 @@ static int CmdLFHitagSRestore(const char *Cmd) {
lf_hitag_data_t packet;
memset(&packet, 0, sizeof(packet));
if (process_hitags_common_args(ctx, &packet) < 0) {
if (process_hitags_common_args(ctx, &packet) != PM3_SUCCESS) {
CLIParserFree(ctx);
return PM3_EINVARG;
}
@@ -901,7 +906,11 @@ static int CmdLFHitagSWrite(const char *Cmd) {
lf_hitag_data_t packet;
if (process_hitags_common_args(ctx, &packet) < 0) return PM3_EINVARG;
if (process_hitags_common_args(ctx, &packet) != PM3_SUCCESS) {
CLIParserFree(ctx);
return PM3_EINVARG;
}
int page = arg_get_int_def(ctx, 6, 0);