]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlfawid.c
FIX: delay was parsed incorrect into a uint8_t...
[proxmark3-svn] / client / cmdlfawid.c
index c453a31204946c7a32462b849bbe94e690ff9117..1550af027655d27be10d26f4b509b00b2b561e38 100644 (file)
@@ -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 <format> <facility-code> <card-number>");
+       PrintAndLog("Usage:  lf awid sim [h] <format> <facility-code> <card-number>");
        PrintAndLog("Options :");
-       PrintAndLog("  <format>        :  format length 26|50");
+       PrintAndLog("                h :  This help");  
+       PrintAndLog("         <format> :  format length 26|50");
        PrintAndLog("  <facility-code> :  8|16bit value facility code");
-       PrintAndLog("  <card number>   :  16|32-bit value card number");
+       PrintAndLog("    <card number> :  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 <format> <facility-code> <card-number>");
+       PrintAndLog("Usage:  lf awid clone [h] <format> <facility-code> <card-number> [Q5]");
        PrintAndLog("Options :");
-       PrintAndLog("  <format>        :  format length 26|50");
+       PrintAndLog("                h :  This help");  
+       PrintAndLog("         <format> :  format length 26|50");
        PrintAndLog("  <facility-code> :  8|16bit value facility code");
-       PrintAndLog("  <card number>   :  16|32-bit value card number");
-       PrintAndLog("  Q5              :  optional - clone to Q5 (T5555) instead of T55x7 chip");
+       PrintAndLog("    <card number> :  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 <format> <facility-code>");
+       PrintAndLog("Usage:  lf awid brute [h] <format> <facility-code> <delay>");
        PrintAndLog("Options :");
-       PrintAndLog("  <format>        :  format length 26|50");
+       PrintAndLog("                h :  This help");
+       PrintAndLog("         <format> :  format length 26|50");
        PrintAndLog("  <facility-code> :  8|16bit value facility code");
+       PrintAndLog("          <delay> :  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<<T5555_BITRATE_SHIFT | 3<<T5555_MAXBLOCK_SHIFT;
 
        if ( !getAWIDBits(fmtlen, fc, cn, bs)) {
@@ -253,7 +259,7 @@ int CmdAWIDClone(const char *Cmd) {
                c.arg[1] = i;
                clearCommandBuffer();
                SendCommand(&c);
-               if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){
+               if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)){
                        PrintAndLog("Error occurred, device did not respond during write operation.");
                        return -1;
                }
@@ -263,7 +269,7 @@ int CmdAWIDClone(const char *Cmd) {
 
 int CmdAWIDBrute(const char *Cmd){
        
-       uint32_t fc = 0x00;
+       uint32_t fc = 0, delay = 1000;
        uint8_t fmtlen = 0;
        uint8_t bits[96];
        uint8_t *bs = bits;
@@ -271,12 +277,15 @@ int CmdAWIDBrute(const char *Cmd){
        memset(bs, 0x00, size);
 
        char cmdp = param_getchar(Cmd, 0);
-       if (strlen(Cmd) > 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,29 @@ 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 ping = {CMD_PING};
                        clearCommandBuffer();
-                       SendCommand(&c);
+                       SendCommand(&ping);
                        return 1;
                }
-                       
+
+               PrintAndLog("Trying FC: %u; CN: %u", fc, cn);           
                (void)getAWIDBits(fmtlen, fc, cn, bs);
                memcpy(c.d.asBytes, bs, size);
                clearCommandBuffer();
                SendCommand(&c);
                
-               PrintAndLog("Trying FC: %u; CN: %u", fc, cn);
-               // pause
-               sleep(1);
+               msleep(delay);
        }
        return 0;
 }
Impressum, Datenschutz