X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/8fd9bfb0e334dd59583d1d597d2549577a22972e..3d4207f3b673c479e572b960d5a307b1f73a912d:/client/cmdlfawid.c diff --git a/client/cmdlfawid.c b/client/cmdlfawid.c index c453a312..43f54a6f 100644 --- a/client/cmdlfawid.c +++ b/client/cmdlfawid.c @@ -28,8 +28,9 @@ int usage_lf_awid_fskdemod(void) { PrintAndLog("By default, values are printed and logged until the button is pressed or another USB command is issued."); PrintAndLog("If the [1] option is provided, reader mode is exited after reading a single AWID card."); PrintAndLog(""); - PrintAndLog("Usage: lf awid fskdemod [1]"); + PrintAndLog("Usage: lf awid fskdemod [h] [1]"); PrintAndLog("Options :"); + PrintAndLog(" h : This help"); PrintAndLog(" 1 : (optional) stop after reading a single card"); PrintAndLog(""); PrintAndLog("Samples"); @@ -42,11 +43,12 @@ int usage_lf_awid_sim(void) { PrintAndLog("Enables simulation of AWID card with specified facility-code and card number."); PrintAndLog("Simulation runs until the button is pressed or another USB command is issued."); PrintAndLog(""); - PrintAndLog("Usage: lf awid sim "); + PrintAndLog("Usage: lf awid sim [h] "); PrintAndLog("Options :"); - PrintAndLog(" : format length 26|50"); + PrintAndLog(" h : This help"); + PrintAndLog(" : format length 26|50"); PrintAndLog(" : 8|16bit value facility code"); - PrintAndLog(" : 16|32-bit value card number"); + PrintAndLog(" : 16|32-bit value card number"); PrintAndLog(""); PrintAndLog("Samples"); PrintAndLog(" lf awid sim 26 224 1337"); @@ -58,12 +60,13 @@ int usage_lf_awid_clone(void) { PrintAndLog("Enables cloning of AWID card with specified facility-code and card number onto T55x7."); PrintAndLog("The T55x7 must be on the antenna when issuing this command. T55x7 blocks are calculated and printed in the process."); PrintAndLog(""); - PrintAndLog("Usage: lf awid clone "); + PrintAndLog("Usage: lf awid clone [h] [Q5]"); PrintAndLog("Options :"); - PrintAndLog(" : format length 26|50"); + PrintAndLog(" h : This help"); + PrintAndLog(" : format length 26|50"); PrintAndLog(" : 8|16bit value facility code"); - PrintAndLog(" : 16|32-bit value card number"); - PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); + PrintAndLog(" : 16|32-bit value card number"); + PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLog(""); PrintAndLog("Samples"); PrintAndLog(" lf awid clone 26 224 1337"); @@ -75,14 +78,16 @@ int usage_lf_awid_brute(void){ PrintAndLog("Enables bruteforce of AWID reader with specified facility-code."); PrintAndLog("This is a incremental attack against reader."); PrintAndLog(""); - PrintAndLog("Usage: lf awid brute "); + PrintAndLog("Usage: lf awid brute [h] "); PrintAndLog("Options :"); - PrintAndLog(" : format length 26|50"); + PrintAndLog(" h : This help"); + PrintAndLog(" : format length 26|50"); PrintAndLog(" : 8|16bit value facility code"); + PrintAndLog(" : delay betweens attempts in ms. Default 1000ms"); PrintAndLog(""); PrintAndLog("Samples"); PrintAndLog(" lf awid brute 26 224"); - PrintAndLog(" lf awid brute 50 2001"); + PrintAndLog(" lf awid brute 50 2001 2000"); return 0; } @@ -226,6 +231,7 @@ int CmdAWIDClone(const char *Cmd) { } if (param_getchar(Cmd, 4) == 'Q' || param_getchar(Cmd, 4) == 'q') + //t5555 (Q5) BITRATE = (RF-2)/2 (iceman) blocks[0] = T5555_MODULATION_FSK2 | T5555_INVERT_OUTPUT | 50< 4 || strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_lf_awid_brute(); + if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_lf_awid_brute(); fmtlen = param_get8(Cmd, 0); fc = param_get32ex(Cmd, 1, 0, 10); if ( !fc ) return usage_lf_awid_brute(); + // delay between attemps, defaults to 1000ms. + delay = param_get32ex(Cmd, 2, 1000, 10); + switch(fmtlen) { case 50: if ((fc & 0xFFFF) != fc) { @@ -293,32 +302,37 @@ int CmdAWIDBrute(const char *Cmd){ } PrintAndLog("Bruteforceing AWID %d Reader", fmtlen); - PrintAndLog("Press pm3-button to abort simulation or run another command"); + PrintAndLog("Press pm3-button to abort simulation or press key"); uint64_t arg1 = (10<<8) + 8; // fcHigh = 10, fcLow = 8 uint64_t arg2 = 50; // clk RF/50 invert=0 UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}}; for ( uint16_t cn = 1; cn < 0xFFFF; ++cn){ + if (ukbhit()) { - PrintAndLog("aborted via keyboard!"); - c.cmd = CMD_PING; - c.arg[0] = 0x00; - c.arg[1] = 0x00; - c.arg[2] = 0x00; + UsbCommand resp; + UsbCommand ping = {CMD_PING}; clearCommandBuffer(); - SendCommand(&c); + SendCommand(&ping); + if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) { + PrintAndLog("aborted via keyboard!"); + return 0; + } + PrintAndLog("Device didnt respond to ABORT"); return 1; } - - (void)getAWIDBits(fmtlen, fc, cn, bs); + + PrintAndLog("Trying FC: %u; CN: %u", fc, cn); + if ( !getAWIDBits(fmtlen, fc, cn, bs)) { + PrintAndLog("Error with tag bitstream generation."); + return 1; + } memcpy(c.d.asBytes, bs, size); clearCommandBuffer(); SendCommand(&c); - PrintAndLog("Trying FC: %u; CN: %u", fc, cn); - // pause - sleep(1); + msleep(delay); } return 0; } @@ -326,9 +340,9 @@ int CmdAWIDBrute(const char *Cmd){ static command_t CommandTable[] = { {"help", CmdHelp, 1, "This help"}, {"fskdemod", CmdAWIDDemodFSK, 0, "['1'] Realtime AWID FSK demodulator (option '1' for one tag only)"}, - {"sim", CmdAWIDSim, 0, " -- AWID tag simulator"}, - {"clone", CmdAWIDClone, 0, " -- Clone AWID to T55x7"}, - {"brute", CmdAWIDBrute, 0, " -- bruteforce card number"}, + {"sim", CmdAWIDSim, 0, " -- AWID tag simulator"}, + {"clone", CmdAWIDClone, 0, " -- Clone AWID to T55x7"}, + {"brute", CmdAWIDBrute, 0, " -- bruteforce card number given a FC"}, {NULL, NULL, 0, NULL} };