mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-27 10:29:18 +08:00
chg:simpler debug printing
This commit is contained in:
parent
e69ca55246
commit
0248352ea6
6 changed files with 30 additions and 33 deletions
|
@ -362,10 +362,10 @@ int CmdAWIDDemod(const char *Cmd) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_debugMode){
|
PrintAndLogEx(DEBUG, "DEBUG: AWID idx: %d, Len: %d Printing Demod Buffer:", idx, size);
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: AWID idx: %d, Len: %d Printing Demod Buffer:", idx, size);
|
if (g_debugMode)
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -939,7 +939,7 @@ int EM4x50Read(const char *Cmd, bool verbose) {
|
||||||
AllPTest &= pTest;
|
AllPTest &= pTest;
|
||||||
//get output
|
//get output
|
||||||
Code[block] = OutputEM4x50_Block(DemodBuffer,DemodBufferLen,verbose, pTest);
|
Code[block] = OutputEM4x50_Block(DemodBuffer,DemodBufferLen,verbose, pTest);
|
||||||
if (g_debugMode) PrintAndLogEx(NORMAL, "\nskipping %d samples, bits:%d", skip, skip/clk);
|
PrintAndLogEx(DEBUG, "\nskipping %d samples, bits:%d", skip, skip/clk);
|
||||||
//skip to start of next block
|
//skip to start of next block
|
||||||
snprintf(tmp,sizeof(tmp),"%i",skip);
|
snprintf(tmp,sizeof(tmp),"%i",skip);
|
||||||
CmdLtrim(tmp);
|
CmdLtrim(tmp);
|
||||||
|
@ -1076,11 +1076,11 @@ bool detectASK_MAN(){
|
||||||
bool detectASK_BI(){
|
bool detectASK_BI(){
|
||||||
int ans = ASKbiphaseDemod("0 0 1", false);
|
int ans = ASKbiphaseDemod("0 0 1", false);
|
||||||
if (!ans) {
|
if (!ans) {
|
||||||
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/biphase normal demod failed");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/biphase normal demod failed");
|
||||||
|
|
||||||
ans = ASKbiphaseDemod("0 1 1", false);
|
ans = ASKbiphaseDemod("0 1 1", false);
|
||||||
if (!ans) {
|
if (!ans) {
|
||||||
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/biphase inverted demod failed");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/biphase inverted demod failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,21 +138,20 @@ int CmdHIDDemod(const char *Cmd) {
|
||||||
int waveIdx = 0;
|
int waveIdx = 0;
|
||||||
int idx = HIDdemodFSK(bits, &size, &hi2, &hi, &lo, &waveIdx);
|
int idx = HIDdemodFSK(bits, &size, &hi2, &hi, &lo, &waveIdx);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
if (g_debugMode){
|
|
||||||
if (idx==-1){
|
if (idx == -1)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID not enough samples");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - HID not enough samples");
|
||||||
} else if (idx == -2) {
|
else if (idx == -2)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID just noise detected");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - HID just noise detected");
|
||||||
} else if (idx == -3) {
|
else if (idx == -3)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID problem during FSK demod");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - HID problem during FSK demod");
|
||||||
} else if (idx == -4) {
|
else if (idx == -4)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID preamble not found");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - HID preamble not found");
|
||||||
} else if (idx == -5) {
|
else if (idx == -5)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error in Manchester data, size %d", size);
|
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error in Manchester data, size %d", size);
|
||||||
} else {
|
else
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error demoding fsk %d", idx);
|
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error demoding fsk %d", idx);
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +159,7 @@ int CmdHIDDemod(const char *Cmd) {
|
||||||
setClockGrid(50, waveIdx + (idx*50));
|
setClockGrid(50, waveIdx + (idx*50));
|
||||||
|
|
||||||
if (hi2==0 && hi==0 && lo==0) {
|
if (hi2==0 && hi==0 && lo==0) {
|
||||||
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - HID no values found");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - HID no values found");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,10 +205,10 @@ int CmdHIDDemod(const char *Cmd) {
|
||||||
PrintAndLogEx(NORMAL, "HID Prox TAG ID: %x%08x (%u) - Format Len: %ubit - FC: %u - Card: %u", hi, lo, (lo>>1) & 0xFFFF, fmtLen, fc, cardnum);
|
PrintAndLogEx(NORMAL, "HID Prox TAG ID: %x%08x (%u) - Format Len: %ubit - FC: %u - Card: %u", hi, lo, (lo>>1) & 0xFFFF, fmtLen, fc, cardnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_debugMode){
|
PrintAndLogEx(DEBUG, "DEBUG: HID idx: %d, Len: %d, Printing Demod Buffer:", idx, size);
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: HID idx: %d, Len: %d, Printing Demod Buffer:", idx, size);
|
if (g_debugMode)
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ int CmdLFHitagReader(const char *Cmd) {
|
||||||
|
|
||||||
// Check the return status, stored in the first argument
|
// Check the return status, stored in the first argument
|
||||||
if (resp.arg[0] == false) {
|
if (resp.arg[0] == false) {
|
||||||
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - hitag failed");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - hitag failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ int CmdIndalaDemod(const char *Cmd) {
|
||||||
ans = PSKDemod("32", 0);
|
ans = PSKDemod("32", 0);
|
||||||
|
|
||||||
if (!ans){
|
if (!ans){
|
||||||
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - Indala can't demod signal: %d",ans);
|
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala can't demod signal: %d",ans);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,8 +134,7 @@ int CmdIndalaDemod(const char *Cmd) {
|
||||||
size = DemodBufferLen;
|
size = DemodBufferLen;
|
||||||
idx = indala224decode(DemodBuffer, &size, &invert);
|
idx = indala224decode(DemodBuffer, &size, &invert);
|
||||||
if (idx < 0 || size != 224) {
|
if (idx < 0 || size != 224) {
|
||||||
if (g_debugMode)
|
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala wrong size, expected [64|224] got: %d (startindex %i)", size, idx);
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala wrong size, expected [64|224] got: %d (startindex %i)", size, idx);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +142,7 @@ int CmdIndalaDemod(const char *Cmd) {
|
||||||
setDemodBuf(DemodBuffer, size, (size_t)idx);
|
setDemodBuf(DemodBuffer, size, (size_t)idx);
|
||||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
|
||||||
if (invert) {
|
if (invert) {
|
||||||
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - Indala had to invert bits");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala had to invert bits");
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
DemodBuffer[i] ^= 1;
|
DemodBuffer[i] ^= 1;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +151,7 @@ int CmdIndalaDemod(const char *Cmd) {
|
||||||
uint32_t uid1, uid2, uid3, uid4, uid5, uid6, uid7;
|
uint32_t uid1, uid2, uid3, uid4, uid5, uid6, uid7;
|
||||||
uid1 = bytebits_to_byte(DemodBuffer,32);
|
uid1 = bytebits_to_byte(DemodBuffer,32);
|
||||||
uid2 = bytebits_to_byte(DemodBuffer+32,32);
|
uid2 = bytebits_to_byte(DemodBuffer+32,32);
|
||||||
if (DemodBufferLen==64){
|
if (DemodBufferLen == 64){
|
||||||
PrintAndLogEx(SUCCESS, "Indala Found - Bitlength %d, UID = (%x%08x)\n%s",
|
PrintAndLogEx(SUCCESS, "Indala Found - Bitlength %d, UID = (%x%08x)\n%s",
|
||||||
DemodBufferLen, uid1, uid2, sprint_bin_break(DemodBuffer,DemodBufferLen,32)
|
DemodBufferLen, uid1, uid2, sprint_bin_break(DemodBuffer,DemodBufferLen,32)
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,14 +16,13 @@
|
||||||
#include "proxmark3.h" // Definitions, USB controls, etc
|
#include "proxmark3.h" // Definitions, USB controls, etc
|
||||||
#include "ui.h" // PrintAndLog
|
#include "ui.h" // PrintAndLog
|
||||||
#include "cmdparser.h" // CmdsParse, CmdsHelp
|
#include "cmdparser.h" // CmdsParse, CmdsHelp
|
||||||
#include "lfdemod.h" // parityTest
|
#include "lfdemod.h" // parityTest, bitbytes_to_byte
|
||||||
#include "util.h" // weigandparity
|
#include "util.h" // weigandparity
|
||||||
#include "protocols.h" // for T55xx config register definitions
|
#include "protocols.h" // for T55xx config register definitions
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "cmdmain.h"
|
#include "cmdmain.h"
|
||||||
#include "cmddata.h"
|
#include "cmddata.h"
|
||||||
#include "cmdlf.h" // lf_read
|
#include "cmdlf.h" // lf_read
|
||||||
#include "lfdemod.h" // bitbytes_to_byte
|
|
||||||
|
|
||||||
extern int CmdLFINDALA(const char *Cmd);
|
extern int CmdLFINDALA(const char *Cmd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue