This commit is contained in:
iceman1001 committed 2025-07-08 21:15:09 +02:00
1 parent c7cf62fcf1
commit a3c2d2b815
15 files changed
+58 -47

No files matched your search

+21 -22
View File
@@ -440,33 +440,32 @@ int json_dumpfd(const json_t *json, int output, size_t flags) {
}
int json_dump_file(const json_t *json, const char *path, size_t flags) {
int result;
FILE *output = fopen(path, "w");
if (!output)
FILE *f = fopen(path, "w");
if (f == NULL) {
return -1;
result = json_dumpf(json, output, flags);
if (fclose(output) != 0)
return -1;
return result;
}
int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags) {
int res;
hashtable_t parents_set;
if (!(flags & JSON_ENCODE_ANY)) {
if (!json_is_array(json) && !json_is_object(json))
return -1;
}
if (hashtable_init(&parents_set))
int res = json_dumpf(json, f, flags);
if (fclose(f) != 0)
return -1;
res = do_dump(json, flags, 0, &parents_set, callback, data);
hashtable_close(&parents_set);
return res;
}
int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags) {
if (!(flags & JSON_ENCODE_ANY)) {
if (!json_is_array(json) && !json_is_object(json)) {
return -1;
}
}
hashtable_t parents_set;
if (hashtable_init(&parents_set)) {
return -1;
}
int res = do_dump(json, flags, 0, &parents_set, callback, data);
hashtable_close(&parents_set);
return res;
}
+1 -1
View File
@@ -44,7 +44,7 @@ add_library(pm3rrg_rdv4_mbedtls STATIC
../../common/mbedtls/x509.c
../../common/mbedtls/x509_crl.c
../../common/mbedtls/x509_crt.c
../../common/mbedtls/net_sockets.c
../../common/mbedtls/net_sockets.c
)
target_include_directories(pm3rrg_rdv4_mbedtls PRIVATE ../../common)
+1 -1
View File
@@ -1135,7 +1135,7 @@ int read_iclass_csn(bool loop, bool verbose, bool shallow_mod) {
res = PM3_EMALLOC;
}
}
} while (loop && kbd_enter_pressed() == false);
} while (loop && (kbd_enter_pressed() == false));
DropField();
return res;
+7 -4
View File
@@ -781,17 +781,20 @@ int legic_print_type(uint32_t tagtype, uint8_t spaces) {
}
int legic_get_type(legic_card_select_t *card) {
if (card == NULL)
if (card == NULL) {
return PM3_EINVARG;
}
clearCommandBuffer();
SendCommandNG(CMD_HF_LEGIC_INFO, NULL, 0);
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_HF_LEGIC_INFO, &resp, 1500) == false)
if (WaitForResponseTimeout(CMD_HF_LEGIC_INFO, &resp, 1500) == false) {
return PM3_ETIMEOUT;
}
if (resp.status != PM3_SUCCESS)
if (resp.status != PM3_SUCCESS) {
return PM3_ESOFT;
}
memcpy(card, resp.data.asBytes, sizeof(legic_card_select_t));
return PM3_SUCCESS;
@@ -1527,7 +1530,7 @@ int readLegicUid(bool loop, bool verbose) {
PrintAndLogEx(SUCCESS, " MSN: " _GREEN_("%s"), sprint_hex(card.uid + 1, sizeof(card.uid) - 1));
legic_print_type(card.cardsize, 0);
} while (loop && kbd_enter_pressed() == false);
} while (loop && (kbd_enter_pressed() == false));
return PM3_SUCCESS;
}
+3 -3
View File
@@ -462,7 +462,7 @@ int CmdLFCommandRead(const char *Cmd) {
return PM3_ETIMEOUT;
}
} while (cm && kbd_enter_pressed() == false);
} while (cm && (kbd_enter_pressed() == false));
return ret;
}
@@ -859,7 +859,7 @@ int CmdLFRead(const char *Cmd) {
int ret = PM3_SUCCESS;
do {
ret = lf_read_internal(realtime, verbose, samples);
} while (cm && kbd_enter_pressed() == false);
} while (cm && (kbd_enter_pressed() == false));
if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "Got " _YELLOW_("%zu") " samples", g_GraphTraceLen);
@@ -985,7 +985,7 @@ int CmdLFSniff(const char *Cmd) {
int ret = PM3_SUCCESS;
do {
ret = lf_sniff(realtime, verbose, samples);
} while (cm && kbd_enter_pressed() == false);
} while (cm && (kbd_enter_pressed() == false));
return ret;
}
+1 -1
View File
@@ -349,7 +349,7 @@ static int CmdAWIDReader(const char *Cmd) {
do {
lf_read(false, 12000);
demodAWID(!cm);
} while (cm && !kbd_enter_pressed());
} while (cm && (kbd_enter_pressed() == false));
return PM3_SUCCESS;
}
+1 -1
View File
@@ -445,7 +445,7 @@ static int CmdEM410xReader(const char *Cmd) {
if (break_first && gs_em410xid != 0) {
break;
}
} while (cm && !kbd_enter_pressed());
} while (cm && (kbd_enter_pressed() == false));
return PM3_SUCCESS;
}
+1 -1
View File
@@ -243,7 +243,7 @@ static int CmdGuardReader(const char *Cmd) {
do {
lf_read(false, 10000);
demodGuard(!cm);
} while (cm && !kbd_enter_pressed());
} while (cm && (kbd_enter_pressed() == false));
return PM3_SUCCESS;
}
+1 -1
View File
@@ -215,7 +215,7 @@ static int CmdHIDReader(const char *Cmd) {
do {
lf_read(false, 16000);
demodHID(!cm);
} while (cm && !kbd_enter_pressed());
} while (cm && (kbd_enter_pressed() == false));
return PM3_SUCCESS;
}
+1 -1
View File
@@ -912,7 +912,7 @@ static int CmdLFHitagReader(const char *Cmd) {
if (ht2_get_uid(&uid)) {
PrintAndLogEx(SUCCESS, "UID.... " _GREEN_("%08X"), uid);
}
} while (cm && kbd_enter_pressed() == false);
} while (cm && (kbd_enter_pressed() == false));
return PM3_SUCCESS;
}
+9 -5
View File
@@ -575,10 +575,11 @@ static int DesfireExchangeNative(bool activate_field, DesfireContext_t *ctx, uin
size_t sentdatalen = 0;
while (cdatalen >= sentdatalen) {
if ((cdatalen - sentdatalen) > DESFIRE_TX_FRAME_MAX_LEN)
if ((cdatalen - sentdatalen) > DESFIRE_TX_FRAME_MAX_LEN) {
len = DESFIRE_TX_FRAME_MAX_LEN;
else
} else {
len = cdatalen - sentdatalen;
}
size_t sendindx = sentdatalen;
size_t sendlen = len;
@@ -657,8 +658,9 @@ static int DesfireExchangeNative(bool activate_field, DesfireContext_t *ctx, uin
}
pos += buflen;
if (rcode != MFDES_ADDITIONAL_FRAME)
if (rcode != MFDES_ADDITIONAL_FRAME) {
break;
}
}
if (resplen) {
@@ -969,12 +971,14 @@ int DesfireSelectAIDHexNoFieldOn(DesfireContext_t *ctx, uint32_t aid) {
ctx->secureChannel = DACNone;
int res = DesfireExchangeEx(false, ctx, MFDES_SELECT_APPLICATION, data, 3, &respcode, resp, &resplen, true, 0);
if (res == PM3_SUCCESS) {
if (resplen != 0)
if (resplen != 0) {
return PM3_ECARDEXCHANGE;
}
// select operation fail
if (respcode != MFDES_S_OPERATION_OK)
if (respcode != MFDES_S_OPERATION_OK) {
return PM3_EAPDU_FAIL;
}
DesfireClearSession(ctx);
ctx->appSelected = (aid != 0x000000);
-4
View File
@@ -17,14 +17,12 @@
//-----------------------------------------------------------------------------
#include "proxmark3.h"
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
#include <ctype.h>
#include <libgen.h> // basename
#include <time.h>
#include "pm3line.h"
#include "usart_defs.h"
#include "util_posix.h"
@@ -43,7 +41,6 @@
#include <locale.h>
#endif
static int mainret = PM3_SUCCESS;
#ifndef LIBPM3
@@ -209,7 +206,6 @@ static void showBanner(void) {
PrintAndLogEx(NORMAL, " [ " _YELLOW_("%s!")" :coffee: ]", get_quote());
// PrintAndLogEx(NORMAL, " [ https://patreon.com/iceman1001/ ]");
// PrintAndLogEx(NORMAL, "");
// PrintAndLogEx(NORMAL, " Monero");
// PrintAndLogEx(NORMAL, " 43mNJLpgBVaTvyZmX9ajcohpvVkaRy1kbZPm8tqAb7itZgfuYecgkRF36rXrKFUkwEGeZedPsASRxgv4HPBHvJwyJdyvQuP");
PrintAndLogEx(NORMAL, "");