+ ul_switch_off_field();
+ if ( hasAuthKey )
+ ul_auth_select( &card, tagtype, hasAuthKey, authKeyPtr, dummy_pack, sizeof(dummy_pack));
+ else
+ ul_select(&card);
+ ulev1_readSignature( get_signature, sizeof(get_signature));
+ ul_switch_off_field();
+ }
+
+ // format and add keys to block dump output
+ if (hasAuthKey) {
+ // if we didn't swapendian before - do it now for the sprint_hex call
+ // NOTE: default entry is bigendian (unless swapped), sprint_hex outputs little endian
+ // need to swap to keep it the same
+ if (!swapEndian){
+ authKeyPtr = SwapEndian64(authenticationkey, dataLen, (dataLen == 16) ? 8 : 4);
+ } else {
+ authKeyPtr = authenticationkey;
+ }
+
+ if (tagtype & UL_C){ //add 4 pages
+ memcpy(data + Pages*4, authKeyPtr, dataLen);
+ Pages += dataLen/4;
+ } else { // 2nd page from end
+ memcpy(data + (Pages*4) - 8, authenticationkey, dataLen);
+ }
+ }
+
+ //add *special* blocks to dump
+ //get version
+ memcpy(dump_file_data, get_version, sizeof(get_version));
+ //tearing
+ memcpy(dump_file_data+10, get_tearing, sizeof(get_tearing));
+ //pack
+ memcpy(dump_file_data+13, get_pack, sizeof(get_pack));
+ //signature
+ memcpy(dump_file_data+16, get_signature, sizeof(get_signature));
+ //add regular block read data to dump
+ memcpy(dump_file_data+DUMP_PREFIX_LENGTH, data, Pages*4);
+
+ PrintAndLog("\n*Special* block data:");
+ PrintAndLog("\nDataType| Data | | Ascii");
+ PrintAndLog("---------------------------------");
+ PrintAndLog("GetVer-1| %s| | %s", sprint_hex(dump_file_data, 4), sprint_ascii(dump_file_data, 4));
+ PrintAndLog("GetVer-2| %s| | %s", sprint_hex(dump_file_data+4, 4), sprint_ascii(dump_file_data+4,4));
+ PrintAndLog("TBD | 00 00 | | ");
+ PrintAndLog("Tearing | %s| | %s", sprint_hex(dump_file_data+10, 3), sprint_ascii(dump_file_data+10,3) );
+ PrintAndLog("Pack | %s | | %s", sprint_hex(dump_file_data+13, 2), sprint_ascii(dump_file_data+13,2) );
+ PrintAndLog("TBD | 00 | | ");
+ PrintAndLog("Sig-1 | %s| | %s", sprint_hex(dump_file_data+16, 4), sprint_ascii(dump_file_data+16,4));
+ PrintAndLog("Sig-2 | %s| | %s", sprint_hex(dump_file_data+20, 4), sprint_ascii(dump_file_data+20,4));
+ PrintAndLog("Sig-3 | %s| | %s", sprint_hex(dump_file_data+24, 4), sprint_ascii(dump_file_data+24,4));
+ PrintAndLog("Sig-4 | %s| | %s", sprint_hex(dump_file_data+28, 4), sprint_ascii(dump_file_data+28,4));
+ PrintAndLog("Sig-5 | %s| | %s", sprint_hex(dump_file_data+32, 4), sprint_ascii(dump_file_data+32,4));
+ PrintAndLog("Sig-6 | %s| | %s", sprint_hex(dump_file_data+36, 4), sprint_ascii(dump_file_data+36,4));
+ PrintAndLog("Sig-7 | %s| | %s", sprint_hex(dump_file_data+40, 4), sprint_ascii(dump_file_data+40,4));
+ PrintAndLog("Sig-8 | %s| | %s", sprint_hex(dump_file_data+44, 4), sprint_ascii(dump_file_data+44,4));
+ PrintAndLog("\nBlock# | Data |lck| Ascii");
+ PrintAndLog("---------------------------------");