mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
modified lf fdx demod, different text style and raw now shows all bytes not just crc bytes
This commit is contained in:
parent
8419b9c690
commit
9075984c7f
2 changed files with 29 additions and 23 deletions
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
||||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||||
|
|
||||||
## [unreleased][unreleased]
|
## [unreleased][unreleased]
|
||||||
|
- Changed `lf fdx demod` - now raw bytes shows all data (@iceman1001)
|
||||||
- Changed `data num` - now can print reversed and inverse (@iceman1001)
|
- Changed `data num` - now can print reversed and inverse (@iceman1001)
|
||||||
- Fixed `hf mf sim -ix` never returning console (@datatags)
|
- Fixed `hf mf sim -ix` never returning console (@datatags)
|
||||||
- Added standalone mode `hf_unisniff` combining 14a/14b/15 sniffing with extra flash save options (@hazardousvoltage)
|
- Added standalone mode `hf_unisniff` combining 14a/14b/15 sniffing with extra flash save options (@hazardousvoltage)
|
||||||
|
|
|
@ -488,12 +488,13 @@ static const char *mapFDBX(uint16_t countryCode) {
|
||||||
//see ASKDemod for what args are accepted
|
//see ASKDemod for what args are accepted
|
||||||
//almost the same demod as cmddata.c/CmdFDXBdemodBI
|
//almost the same demod as cmddata.c/CmdFDXBdemodBI
|
||||||
int demodFDXB(bool verbose) {
|
int demodFDXB(bool verbose) {
|
||||||
//Differential Biphase / di-phase (inverted biphase)
|
// Differential Biphase / di-phase (inverted biphase)
|
||||||
//get binary from ask wave
|
// get binary from ask wave
|
||||||
if (ASKbiphaseDemod(0, 32, 1, 100, false) != PM3_SUCCESS) {
|
if (ASKbiphaseDemod(0, 32, 1, 100, false) != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - FDX-B ASKbiphaseDemod failed");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - FDX-B ASKbiphaseDemod failed");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = g_DemodBufferLen;
|
size_t size = g_DemodBufferLen;
|
||||||
int preambleIndex = detectFDXB(g_DemodBuffer, &size);
|
int preambleIndex = detectFDXB(g_DemodBuffer, &size);
|
||||||
if (preambleIndex < 0) {
|
if (preambleIndex < 0) {
|
||||||
|
@ -513,7 +514,6 @@ int demodFDXB(bool verbose) {
|
||||||
setDemodBuff(g_DemodBuffer, 128, preambleIndex);
|
setDemodBuff(g_DemodBuffer, 128, preambleIndex);
|
||||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex * g_DemodClock));
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex * g_DemodClock));
|
||||||
|
|
||||||
|
|
||||||
// remove marker bits (1's every 9th digit after preamble) (pType = 2)
|
// remove marker bits (1's every 9th digit after preamble) (pType = 2)
|
||||||
size = removeParity(g_DemodBuffer, 11, 9, 2, 117);
|
size = removeParity(g_DemodBuffer, 11, 9, 2, 117);
|
||||||
if (size != 104) {
|
if (size != 104) {
|
||||||
|
@ -521,7 +521,7 @@ int demodFDXB(bool verbose) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//got a good demod
|
// got a good demod
|
||||||
uint8_t offset;
|
uint8_t offset;
|
||||||
// ISO: bits 27..64
|
// ISO: bits 27..64
|
||||||
uint64_t NationalCode = ((uint64_t)(bytebits_to_byteLSBF(g_DemodBuffer + 32, 6)) << 32) | bytebits_to_byteLSBF(g_DemodBuffer, 32);
|
uint64_t NationalCode = ((uint64_t)(bytebits_to_byteLSBF(g_DemodBuffer + 32, 6)) << 32) | bytebits_to_byteLSBF(g_DemodBuffer, 32);
|
||||||
|
@ -559,31 +559,35 @@ int demodFDXB(bool verbose) {
|
||||||
offset += 16;
|
offset += 16;
|
||||||
uint32_t extended = bytebits_to_byteLSBF(g_DemodBuffer + offset, 24);
|
uint32_t extended = bytebits_to_byteLSBF(g_DemodBuffer + offset, 24);
|
||||||
|
|
||||||
uint64_t rawid = (uint64_t)(bytebits_to_byte(g_DemodBuffer, 32)) << 32 | bytebits_to_byte(g_DemodBuffer + 32, 32);
|
uint8_t raw[13] = {0};
|
||||||
uint8_t raw[8];
|
for (int i = 0; i < sizeof(raw); i++) {
|
||||||
num_to_bytes(rawid, 8, raw);
|
raw[i] = bytebits_to_byte(g_DemodBuffer + (i * 8), 8);
|
||||||
|
}
|
||||||
|
|
||||||
if (!verbose) {
|
if (verbose == false) {
|
||||||
PROMPT_CLEARLINE;
|
PROMPT_CLEARLINE;
|
||||||
PrintAndLogEx(SUCCESS, "Animal ID " _GREEN_("%04u-%012"PRIu64), countryCode, NationalCode);
|
PrintAndLogEx(SUCCESS, "Animal ID........... " _GREEN_("%04u-%012"PRIu64), countryCode, NationalCode);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(SUCCESS, "FDX-B / ISO 11784/5 Animal");
|
|
||||||
PrintAndLogEx(SUCCESS, "Animal ID " _GREEN_("%03u-%012"PRIu64), countryCode, NationalCode);
|
|
||||||
PrintAndLogEx(SUCCESS, "National Code " _GREEN_("%012" PRIu64) " (0x%" PRIX64 ")", NationalCode, NationalCode);
|
|
||||||
PrintAndLogEx(SUCCESS, "Country Code " _GREEN_("%03u") " - %s", countryCode, mapFDBX(countryCode));
|
|
||||||
PrintAndLogEx(SUCCESS, "Reserved/RFU %u (0x%04X)", reservedCode, reservedCode);
|
|
||||||
PrintAndLogEx(SUCCESS, " Animal bit set? %s", animalBit ? _YELLOW_("True") : "False");
|
|
||||||
PrintAndLogEx(SUCCESS, " Data block? %s [value 0x%X]", dataBlockBit ? _YELLOW_("True") : "False", extended);
|
|
||||||
PrintAndLogEx(SUCCESS, " RUDI bit? %s", rudiBit ? _YELLOW_("True") " (advanced transponder)" : "False");
|
|
||||||
PrintAndLogEx(SUCCESS, " User Info? %u %s", userInfo, userInfo == 0 ? "(RFU)" : "");
|
|
||||||
PrintAndLogEx(SUCCESS, " Replacement No? %u %s", replacementNr, replacementNr == 0 ? "(RFU)" : "");
|
|
||||||
|
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
PrintAndLogEx(SUCCESS, _CYAN_("FDX-B / ISO 11784/5 Animal"));
|
||||||
|
PrintAndLogEx(SUCCESS, "Animal ID......... " _GREEN_("%03u-%012"PRIu64), countryCode, NationalCode);
|
||||||
|
PrintAndLogEx(SUCCESS, "National Code..... " _GREEN_("%012" PRIu64) " ( 0x%" PRIX64 " )", NationalCode, NationalCode);
|
||||||
|
PrintAndLogEx(SUCCESS, "Country Code...... " _GREEN_("%03u") " - %s", countryCode, mapFDBX(countryCode));
|
||||||
|
PrintAndLogEx(SUCCESS, "Reserved/RFU...... %u (0x%04X)", reservedCode, reservedCode);
|
||||||
|
PrintAndLogEx(SUCCESS, "Animal bit set?... %s", animalBit ? _YELLOW_("True") : "False");
|
||||||
|
PrintAndLogEx(SUCCESS, "Data block?....... %s ( 0x%X )", dataBlockBit ? _YELLOW_("True") : "False", extended);
|
||||||
|
PrintAndLogEx(SUCCESS, "RUDI bit?......... %s", rudiBit ? _YELLOW_("True") " ( advanced transponder )" : "False");
|
||||||
|
PrintAndLogEx(SUCCESS, "User Info?........ %u %s", userInfo, (userInfo == 0) ? "( RFU )" : "");
|
||||||
|
PrintAndLogEx(SUCCESS, "Replacement No?... %u %s", replacementNr, replacementNr == 0 ? "( RFU )" : "");
|
||||||
|
|
||||||
|
// crc only calculated over NORMAL data (8 bytes)
|
||||||
uint8_t c[] = {0, 0};
|
uint8_t c[] = {0, 0};
|
||||||
compute_crc(CRC_11784, raw, sizeof(raw), &c[0], &c[1]);
|
compute_crc(CRC_11784, raw, 8, &c[0], &c[1]);
|
||||||
PrintAndLogEx(SUCCESS, "CRC-16 0x%04X ( %s )", crc, (crc == (c[1] << 8 | c[0])) ? _GREEN_("ok") : _RED_("fail"));
|
PrintAndLogEx(SUCCESS, "CRC-16............ 0x%04X ( %s )", crc, (crc == (c[1] << 8 | c[0])) ? _GREEN_("ok") : _RED_("fail"));
|
||||||
// iceman: crc doesn't protect the extended data?
|
// iceman: crc doesn't protect the extended data?
|
||||||
PrintAndLogEx(SUCCESS, "Raw " _GREEN_("%s"), sprint_hex(raw, 8));
|
PrintAndLogEx(SUCCESS, "Raw............... " _GREEN_("%s"), sprint_hex(raw, sizeof(raw)));
|
||||||
|
|
||||||
if (g_debugMode) {
|
if (g_debugMode) {
|
||||||
PrintAndLogEx(DEBUG, "Start marker %d; Size %zu", preambleIndex, size);
|
PrintAndLogEx(DEBUG, "Start marker %d; Size %zu", preambleIndex, size);
|
||||||
|
@ -601,12 +605,13 @@ int demodFDXB(bool verbose) {
|
||||||
float bt_C = (bt_F - 32) / 1.8;
|
float bt_C = (bt_F - 32) / 1.8;
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(SUCCESS, "Bio-Thermo detected");
|
PrintAndLogEx(SUCCESS, "Bio-Thermo detected");
|
||||||
PrintAndLogEx(INFO, " temperature " _GREEN_("%.1f")" F / " _GREEN_("%.1f") " C", bt_F, bt_C);
|
PrintAndLogEx(INFO, " temperature... " _GREEN_("%.1f")" F / " _GREEN_("%.1f") " C", bt_F, bt_C);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set block 0 for later
|
// set block 0 for later
|
||||||
//g_DemodConfig = T55x7_MODULATION_DIPHASE | T55x7_BITRATE_RF_32 | 4 << T55x7_MAXBLOCK_SHIFT;
|
//g_DemodConfig = T55x7_MODULATION_DIPHASE | T55x7_BITRATE_RF_32 | 4 << T55x7_MAXBLOCK_SHIFT;
|
||||||
|
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue