X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/934dfd728dacd497ac299b41f039b3dad41d9c64..3d4207f3b673c479e572b960d5a307b1f73a912d:/client/cmdlfawid.c diff --git a/client/cmdlfawid.c b/client/cmdlfawid.c index 7a8aff9b..43f54a6f 100644 --- a/client/cmdlfawid.c +++ b/client/cmdlfawid.c @@ -78,7 +78,7 @@ 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 [h] "); + PrintAndLog("Usage: lf awid brute [h] "); PrintAndLog("Options :"); PrintAndLog(" h : This help"); PrintAndLog(" : format length 26|50"); @@ -269,9 +269,8 @@ int CmdAWIDClone(const char *Cmd) { int CmdAWIDBrute(const char *Cmd){ - uint32_t fc = 0; + uint32_t fc = 0, delay = 1000; uint8_t fmtlen = 0; - uint16_t delay = 1000; uint8_t bits[96]; uint8_t *bs = bits; size_t size = sizeof(bits); @@ -285,9 +284,7 @@ int CmdAWIDBrute(const char *Cmd){ if ( !fc ) return usage_lf_awid_brute(); // delay between attemps, defaults to 1000ms. - delay = param_get8(Cmd, 2); - if (delay < 400) - delay = 1000; + delay = param_get32ex(Cmd, 2, 1000, 10); switch(fmtlen) { case 50: @@ -314,15 +311,23 @@ int CmdAWIDBrute(const char *Cmd){ for ( uint16_t cn = 1; cn < 0xFFFF; ++cn){ if (ukbhit()) { - PrintAndLog("aborted via keyboard!"); + UsbCommand resp; UsbCommand ping = {CMD_PING}; clearCommandBuffer(); SendCommand(&ping); + if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) { + PrintAndLog("aborted via keyboard!"); + return 0; + } + PrintAndLog("Device didnt respond to ABORT"); return 1; } PrintAndLog("Trying FC: %u; CN: %u", fc, cn); - (void)getAWIDBits(fmtlen, fc, cn, bs); + if ( !getAWIDBits(fmtlen, fc, cn, bs)) { + PrintAndLog("Error with tag bitstream generation."); + return 1; + } memcpy(c.d.asBytes, bs, size); clearCommandBuffer(); SendCommand(&c); @@ -335,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} };