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
@@ -18,6 +18,39 @@
|
||||
#include "cmdhfst25ta.h"
|
||||
#include "cmdhfthinfilm.h"
|
||||
#include "cmdhftopaz.h"
|
||||
#include "cmdnfc.h"
|
||||
|
||||
void print_type4_cc_info(uint8_t *d, uint8_t n) {
|
||||
if (n < 0x0F) {
|
||||
PrintAndLogEx(WARNING, "Not enough bytes read from CC 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 int CmdNfcDecode(const char *Cmd) {
|
||||
|
||||
|
||||
Reference in new issue
Block a user