mutualize print_type4_cc_info
This commit is contained in:
1 parent
4b00db8e48
commit
caf9809c0c
4 files changed
+40
-67
No files matched your search
@@ -20,43 +20,13 @@
|
||||
#include "cmdhf14a.h"
|
||||
#include "protocols.h" // definitions of ISO14A/7816 protocol
|
||||
#include "emv/apduinfo.h" // GetAPDUCodeDescription
|
||||
#include "nfc/ndef.h" // NDEFRecordsDecodeAndPrint
|
||||
#include "nfc/ndef.h" // NDEFRecordsDecodeAndPrint
|
||||
#include "cmdnfc.h" // print_type4_cc_info
|
||||
|
||||
#define TIMEOUT 2000
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
static void print_st25ta_cc_info(uint8_t *d, uint8_t n) {
|
||||
if (n < 0x0F) {
|
||||
PrintAndLogEx(WARNING, "Not enough bytes read from system file");
|
||||
return;
|
||||
}
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(SUCCESS, "------------ " _CYAN_("Capability Container file") " ------------");
|
||||
PrintAndLogEx(SUCCESS, " len %u bytes (" _GREEN_("0x%02X") ")", d[1], d[1]);
|
||||
PrintAndLogEx(SUCCESS, " version %s (" _GREEN_("0x%02X") ")", (d[2] == 0x20) ? "v2.0" : "v1.0", d[2]);
|
||||
|
||||
uint16_t maxr = (d[3] << 8 | d[4]);
|
||||
PrintAndLogEx(SUCCESS, " max bytes read %u bytes ( 0x%04X )", maxr, maxr);
|
||||
uint16_t maxw = (d[5] << 8 | d[6]);
|
||||
PrintAndLogEx(SUCCESS, " max bytes write %u bytes ( 0x%04X )", maxw, maxw);
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(SUCCESS, " NDEF file control TLV {");
|
||||
PrintAndLogEx(SUCCESS, " (t) type of file ( %02X )", d[7]);
|
||||
PrintAndLogEx(SUCCESS, " (v) ( %02X )", d[8]);
|
||||
PrintAndLogEx(SUCCESS, " file id ( %02X%02X )", d[9], d[10]);
|
||||
|
||||
uint16_t maxndef = (d[11] << 8 | d[12]);
|
||||
PrintAndLogEx(SUCCESS, " max NDEF filesize %u bytes ( 0x%04X )", maxndef, maxndef);
|
||||
PrintAndLogEx(SUCCESS, " ----- " _CYAN_("access rights") " -------");
|
||||
PrintAndLogEx(SUCCESS, " read ( %02X ) protection: %s", d[13], ((d[13] & 0x80) == 0x80) ? _RED_("enabled") : _GREEN_("disabled"));
|
||||
PrintAndLogEx(SUCCESS, " write ( %02X ) protection: %s", d[14], ((d[14] & 0x80) == 0x80) ? _RED_("enabled") : _GREEN_("disabled"));
|
||||
PrintAndLogEx(SUCCESS, " }");
|
||||
PrintAndLogEx(SUCCESS, "----------------- " _CYAN_("raw") " -----------------");
|
||||
PrintAndLogEx(SUCCESS, "%s", sprint_hex_inrow(d, n));
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
}
|
||||
static void print_st25ta_system_info(uint8_t *d, uint8_t n) {
|
||||
if (n < 0x12) {
|
||||
PrintAndLogEx(WARNING, "Not enough bytes read from system file");
|
||||
@@ -250,7 +220,7 @@ static int infoHFST25TA(void) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
print_st25ta_cc_info(st_cc_data, sizeof(st_cc_data));
|
||||
print_type4_cc_info(st_cc_data, sizeof(st_cc_data));
|
||||
print_st25ta_system_info(response, resplen - 2);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user