X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/be2d41b73a10f52c319dcf2c0664ff071fb753f1..daa4fbaeec9c1880b837f12a5057f55636d38d99:/client/cmdlft55xx.c diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index 5194357e..55b4ab65 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -33,6 +33,13 @@ // Default configuration t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00}; +t55xx_conf_block_t Get_t55xx_Config(){ + return config; +} +void Set_t55xx_Config(t55xx_conf_block_t conf){ + config = conf; +} + int usage_t55xx_config(){ PrintAndLog("Usage: lf t55xx config [d ] [i 1] [o ]"); PrintAndLog("Options:"); @@ -50,30 +57,30 @@ int usage_t55xx_config(){ return 0; } int usage_t55xx_read(){ - PrintAndLog("Usage: lf t55xx read b p "); + PrintAndLog("Usage: lf t55xx read [b ] [p ] "); PrintAndLog("Options:"); - PrintAndLog(" b , block number to read. Between 0-7"); - PrintAndLog(" p , OPTIONAL password (8 hex characters)"); - PrintAndLog(" o, OPTIONAL override safety check"); - PrintAndLog(" 1, OPTIONAL read Page 1 instead of Page 0"); + PrintAndLog(" b - block number to read. Between 0-7"); + PrintAndLog(" p - OPTIONAL password (8 hex characters)"); + PrintAndLog(" o - OPTIONAL override safety check"); + PrintAndLog(" 1 - OPTIONAL read Page 1 instead of Page 0"); PrintAndLog(" ****WARNING****"); PrintAndLog(" Use of read with password on a tag not configured for a pwd"); PrintAndLog(" can damage the tag"); PrintAndLog(""); PrintAndLog("Examples:"); - PrintAndLog(" lf t55xx read b 0 - read data from block 0"); + PrintAndLog(" lf t55xx read b 0 - read data from block 0"); PrintAndLog(" lf t55xx read b 0 p feedbeef - read data from block 0 password feedbeef"); PrintAndLog(" lf t55xx read b 0 p feedbeef o - read data from block 0 password feedbeef safety check"); PrintAndLog(""); return 0; } int usage_t55xx_write(){ - PrintAndLog("Usage: lf t55xx wr b d p [password] [1]"); + PrintAndLog("Usage: lf t55xx wr [b ] [d ] [p ] [1]"); PrintAndLog("Options:"); - PrintAndLog(" b , block number to write. Between 0-7"); - PrintAndLog(" d , 4 bytes of data to write (8 hex characters)"); - PrintAndLog(" p [password], OPTIONAL password 4bytes (8 hex characters)"); - PrintAndLog(" 1, OPTIONAL write Page 1 instead of Page 0"); + PrintAndLog(" b - block number to write. Between 0-7"); + PrintAndLog(" d - 4 bytes of data to write (8 hex characters)"); + PrintAndLog(" p - OPTIONAL password 4bytes (8 hex characters)"); + PrintAndLog(" 1 - OPTIONAL write Page 1 instead of Page 0"); PrintAndLog(""); PrintAndLog("Examples:"); PrintAndLog(" lf t55xx wr b 3 d 11223344 - write 11223344 to block 3"); @@ -84,7 +91,7 @@ int usage_t55xx_write(){ int usage_t55xx_trace() { PrintAndLog("Usage: lf t55xx trace [1]"); PrintAndLog("Options:"); - PrintAndLog(" [graph buffer data], if set, use Graphbuffer otherwise read data from tag."); + PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag."); PrintAndLog(""); PrintAndLog("Examples:"); PrintAndLog(" lf t55xx trace"); @@ -95,7 +102,7 @@ int usage_t55xx_trace() { int usage_t55xx_info() { PrintAndLog("Usage: lf t55xx info [1]"); PrintAndLog("Options:"); - PrintAndLog(" [graph buffer data], if set, use Graphbuffer otherwise read data from tag."); + PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag."); PrintAndLog(""); PrintAndLog("Examples:"); PrintAndLog(" lf t55xx info"); @@ -106,8 +113,8 @@ int usage_t55xx_info() { int usage_t55xx_dump(){ PrintAndLog("Usage: lf t55xx dump [o]"); PrintAndLog("Options:"); - PrintAndLog(" , OPTIONAL password 4bytes (8 hex symbols)"); - PrintAndLog(" , OPTIONAL Force pwd read despite danger to card"); + PrintAndLog(" - OPTIONAL password 4bytes (8 hex symbols)"); + PrintAndLog(" o - OPTIONAL override, force pwd read despite danger to card"); PrintAndLog(""); PrintAndLog("Examples:"); PrintAndLog(" lf t55xx dump"); @@ -118,7 +125,7 @@ int usage_t55xx_dump(){ int usage_t55xx_detect(){ PrintAndLog("Usage: lf t55xx detect [1]"); PrintAndLog("Options:"); - PrintAndLog(" [graph buffer data], if set, use Graphbuffer otherwise read data from tag."); + PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag."); PrintAndLog(""); PrintAndLog("Examples:"); PrintAndLog(" lf t55xx detect"); @@ -533,7 +540,7 @@ bool tryDetectModulation(){ bool testModulation(uint8_t mode, uint8_t modread){ switch( mode ){ case DEMOD_FSK: - if (modread > 3 && modread < 8) return TRUE; + if (modread >= DEMOD_FSK1 && modread <= DEMOD_FSK2a) return TRUE; break; case DEMOD_ASK: if (modread == DEMOD_ASK) return TRUE; @@ -1165,18 +1172,36 @@ uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits){ return tmp; } +int CmdResetRead(const char *Cmd) { + UsbCommand c = {CMD_T55XX_RESET_READ, {0,0,0}}; + + clearCommandBuffer(); + SendCommand(&c); + if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) { + PrintAndLog("command execution time out"); + return 0; + } + + uint8_t got[BIGBUF_SIZE-1]; + GetFromBigBuf(got,sizeof(got),0); + WaitForResponse(CMD_ACK,NULL); + setGraphBuf(got, sizeof(got)); + return 1; +} + static command_t CommandTable[] = { - {"help", CmdHelp, 1, "This help"}, - {"config", CmdT55xxSetConfig, 1, "Set/Get T55XX configuration (modulation, inverted, offset, rate)"}, - {"detect", CmdT55xxDetect, 0, "[1] Try detecting the tag modulation from reading the configuration block."}, - {"read", CmdT55xxReadBlock, 0, "b p [password] [o] [1] -- Read T55xx block data (page 0) [optional password]"}, - {"write", CmdT55xxWriteBlock,0, "b d p [password] [1] -- Write T55xx block data (page 0) [optional password]"}, - {"trace", CmdT55xxReadTrace, 0, "[1] Show T55xx traceability data (page 1/ blk 0-1)"}, - {"info", CmdT55xxInfo, 0, "[1] Show T55xx configuration data (page 0/ blk 0)"}, - {"dump", CmdT55xxDump, 0, "[password] [o] Dump T55xx card block 0-7. [optional password]"}, - {"special", special, 0, "Show block changes with 64 different offsets"}, - {"wakeup", CmdT55xxWakeUp, 0, "Send AOR wakeup command"}, + {"help", CmdHelp, 1, "This help"}, + {"config", CmdT55xxSetConfig, 1, "Set/Get T55XX configuration (modulation, inverted, offset, rate)"}, + {"detect", CmdT55xxDetect, 0, "[1] Try detecting the tag modulation from reading the configuration block."}, + {"read", CmdT55xxReadBlock, 0, "b p [password] [o] [1] -- Read T55xx block data. Optional [p password], [override], [page1]"}, + {"resetread",CmdResetRead, 0, "Send Reset Cmd then lf read the stream to attempt to identify the start of it (needs a demod and/or plot after)"}, + {"write", CmdT55xxWriteBlock,0, "b d p [password] [1] -- Write T55xx block data. Optional [p password], [page1]"}, + {"trace", CmdT55xxReadTrace, 0, "[1] Show T55xx traceability data (page 1/ blk 0-1)"}, + {"info", CmdT55xxInfo, 0, "[1] Show T55xx configuration data (page 0/ blk 0)"}, + {"dump", CmdT55xxDump, 0, "[password] [o] Dump T55xx card block 0-7. Optional [password], [override]"}, + {"special", special, 0, "Show block changes with 64 different offsets"}, + {"wakeup", CmdT55xxWakeUp, 0, "Send AOR wakeup command"}, {NULL, NULL, 0, NULL} };