]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlfawid.c
CHG: textual fixes in help text
[proxmark3-svn] / client / cmdlfawid.c
index 7a8aff9b168a2be920828f8211f26f9cf8b16968..43f54a6ffd5169d331b0f59754237528388d1375 100644 (file)
@@ -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] <format> <facility-code>");
+       PrintAndLog("Usage:  lf awid brute [h] <format> <facility-code> <delay>");
        PrintAndLog("Options :");
        PrintAndLog("                h :  This help");
        PrintAndLog("         <format> :  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, "<Facility-Code> <Card Number> -- AWID tag simulator"},
-       {"clone",     CmdAWIDClone,    0, "<Facility-Code> <Card Number> <Q5> -- Clone AWID to T55x7"},
-       {"brute",         CmdAWIDBrute,    0, "<Facility-Code> -- bruteforce card number"},
+       {"sim",       CmdAWIDSim,      0, "<facility-code> <card number> -- AWID tag simulator"},
+       {"clone",     CmdAWIDClone,    0, "<facility-code> <card number> <Q5> -- Clone AWID to T55x7"},
+       {"brute",         CmdAWIDBrute,    0, "<format> <facility-code> <delay> -- bruteforce card number given a FC"},
        {NULL, NULL, 0, NULL}
 };
 
Impressum, Datenschutz