return (bool) ASKDemod("64 0 1", FALSE, FALSE, 1);\r
}\r
\r
+// sanity check. Don't use proxmark if it is offline and you didn't specify useGraphbuf\r
+static int SanityOfflineCheck( bool useGraphBuffer ){\r
+ if ( !useGraphBuffer && offline) {\r
+ PrintAndLog("Your proxmark3 device is offline. Specify [1] to use graphbuffer data instead");\r
+ return 0;\r
+ }\r
+ return 1;\r
+}\r
\r
int CmdT55xxDetect(const char *Cmd){\r
bool errors = FALSE;\r
}\r
if (errors) return usage_t55xx_detect();\r
\r
+ // sanity check.\r
+ if (!SanityOfflineCheck(useGB)) return 1;\r
+ \r
if ( !useGB) {\r
if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password) )\r
- return 0;\r
+ return 1;\r
}\r
\r
if ( !tryDetectModulation() )\r
PrintAndLog("Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");\r
\r
- return 1;\r
+ return 0;\r
}\r
\r
// detect configuration?\r
uint32_t password = 0; \r
if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') return usage_t55xx_trace();\r
\r
- if (strlen(Cmd)==0)\r
+ if (strlen(Cmd)==0) {\r
+ // sanity check.\r
+ if (!SanityOfflineCheck(FALSE)) return 1;\r
+\r
if ( !AquireData( T55x7_PAGE1, REGULAR_READ_MODE_BLOCK, pwdmode, password ) )\r
- return 0;\r
+ return 1;\r
+ }\r
\r
if ( config.Q5 ){\r
- if (!DecodeT5555TraceBlock()) return 0;\r
+ if (!DecodeT5555TraceBlock()) return 1;\r
} else {\r
- if (!DecodeT55xxBlock()) return 0;\r
+ if (!DecodeT55xxBlock()) return 1;\r
}\r
\r
- if ( !DemodBufferLen ) return 0;\r
+ if ( !DemodBufferLen ) return 1;\r
\r
RepaintGraphWindow();\r
uint8_t repeat = (config.offset > 5) ? 32 : 0;\r
\r
if (hdr != 0x1FF) {\r
PrintAndLog("Invalid Q5 Trace data header (expected 0x1FF, found %X)", hdr);\r
- return 0;\r
+ return 1;\r
}\r
\r
t5555_tracedata_t data = {.bl1 = bl1, .bl2 = bl2, .icr = 0, .lotidc = '?', .lotid = 0, .wafer = 0, .dw =0};\r
data.acl = PackBits(si, 8, DemodBuffer); si += 8;\r
if ( data.acl != 0xE0 ) {\r
PrintAndLog("The modulation is most likely wrong since the ACL is not 0xE0. ");\r
- return 0;\r
+ return 1;\r
}\r
\r
data.mfc = PackBits(si, 8, DemodBuffer); si += 8;\r
\r
if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') return usage_t55xx_info();\r
\r
- if (strlen(Cmd)==0)\r
+ if (strlen(Cmd)==0){\r
+ // sanity check.\r
+ if (!SanityOfflineCheck(FALSE)) return 1;\r
+ \r
if ( !AquireData( T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, pwdmode, password ) )\r
return 1;\r
+ }\r
\r
if (!DecodeT55xxBlock()) return 1;\r
\r
\r
static command_t CommandTable[] = {\r
{"help", CmdHelp, 1, "This help"},\r
- {"bruteforce",CmdT55xxBruteForce,0, "<start password> <end password> [i <*.dic>] Simple bruteforce attack to find password"},\r
+ {"bruteforce", CmdT55xxBruteForce,0, "<start password> <end password> [i <*.dic>] Simple bruteforce attack to find password"},\r
{"config", CmdT55xxSetConfig, 1, "Set/Get T55XX configuration (modulation, inverted, offset, rate)"},\r
{"detect", CmdT55xxDetect, 1, "[1] Try detecting the tag modulation from reading the configuration block."},\r
{"dump", CmdT55xxDump, 0, "[password] [o] Dump T55xx card block 0-7. Optional [password], [override]"},\r