- PrintAndLog("Remaining Header Area");
- PrintAndLog("%s", sprint_hex(data_buf+9, 13));
- PrintAndLog("\nADF: User Area");
-
- i = 22;
- uint8_t segCrcBytes[8] = {0x00};
+ PrintAndLog("DCF: %d (%02x %02x), Token Type=%s (OLE=%01u), OL=%02u, FL=%02u",
+ dcf,
+ data_buf[5],
+ data_buf[6],
+ token_type,
+ (data_buf[5] & 0x80 )>> 7,
+ stamp_len,
+ fl
+ );
+
+ } else { // Is IM(-S) type of card...
+
+ if(data_buf[7] == 0x9F && data_buf[8] == 0xFF) {
+ bIsSegmented = 1;
+ strncpy(token_type, "IM-S", sizeof(token_type));
+ } else {
+ strncpy(token_type, "IM", sizeof(token_type));
+ }
+
+ PrintAndLog("DCF: %d (%02x %02x), Token Type=%s (OLE=%01u)",
+ dcf,
+ data_buf[5],
+ data_buf[6],
+ token_type,
+ (data_buf[5]&0x80) >> 7
+ );
+ }
+
+ // Makes no sence to show this on blank media...
+ if(dcf != 0xFFFF) {
+
+ if(bIsSegmented) {
+ PrintAndLog("WRP=%02u, WRC=%01u, RD=%01u, SSC=%02x",
+ data_buf[7] & 0x0f,
+ (data_buf[7] & 0x70) >> 4,
+ (data_buf[7] & 0x80) >> 7,
+ data_buf[8]
+ );
+ }
+
+ // Header area is only available on IM-S cards, on master tokens this data is the master token data itself
+ if(bIsSegmented || dcf > 60000) {
+ if(dcf > 60000) {
+ PrintAndLog("Master token data");
+ PrintAndLog("%s", sprint_hex(data_buf+8, 14));
+ } else {
+ PrintAndLog("Remaining Header Area");
+ PrintAndLog("%s", sprint_hex(data_buf+9, 13));
+ }
+ }
+ }
+
+ uint8_t segCrcBytes[8] = {0,0,0,0,0,0,0,0};