]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlfhid.c
FIX: Added @marshmellow42 's fix for ASK/Biphase simulation on deviceside.
[proxmark3-svn] / client / cmdlfhid.c
index 02c2fdb789af32ea7ef948b4ea13c81987987add..5bdeea6d9efe01e3772a128ccd793f110aecf71d 100644 (file)
@@ -40,8 +40,8 @@ int usage_lf_hid_brute(void){
        PrintAndLog("");
        PrintAndLog("Usage:  lf hid brute <formatlength> <Facility-Code>");
        PrintAndLog("Options :");
-       PrintAndLog("  <formatlength>   : 26|33|34|35|37|40|44|84 ");
-       PrintAndLog("  <Facility-Code>  : 8-bit value HID facility code");
+       PrintAndLog("  <formatlength>   - 26|33|34|35|37|40|44|84");
+       PrintAndLog("  <Facility-Code>  - 8-bit value HID facility code");
        PrintAndLog("");
        PrintAndLog("Sample  : lf hid brute 26 224");
        return 0;
@@ -166,12 +166,11 @@ static void getParity34(uint32_t *hi, uint32_t *lo){
 
        *lo |= !result;
 }
-static void getParity35(uint32_t *hi, uint32_t *lo){
-       *hi = *hi;
+static void getParity35(uint32_t *hi, uint32_t *lo){   
 }
 static void getParity37S(uint32_t *hi,uint32_t *lo){
        uint32_t result = 0;
-       uint8_t i;
+       int i;
 
        // even parity
        for (i = 4; i >= 0; i--)
@@ -295,7 +294,7 @@ int CmdHIDWiegand(const char *Cmd) {
        uint64_t cardnum = 0;
        
        uint8_t ctmp = param_getchar(Cmd, 0);
-       if ( strlen(Cmd) < 0 || strlen(Cmd) < 3 || ctmp == 'H' || ctmp == 'h' ) return usage_lf_hid_wiegand();
+       if ( strlen(Cmd) == 0 || strlen(Cmd) < 3 || ctmp == 'H' || ctmp == 'h' ) return usage_lf_hid_wiegand();
 
        oem = param_get8(Cmd, 0);
        fc = param_get32ex(Cmd, 1, 0, 10);
@@ -311,7 +310,7 @@ int CmdHIDWiegand(const char *Cmd) {
 
 int CmdHIDBrute(const char *Cmd){
        
-       bool error = FALSE;
+       bool error = TRUE;
        uint8_t fc = 0, fmtlen = 0;
        uint32_t hi = 0, lo = 0;
 
@@ -321,20 +320,13 @@ int CmdHIDBrute(const char *Cmd){
        if (strlen(Cmd) > 2 || strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_lf_hid_brute();
 
        fmtlen = param_get8(Cmd, 0);
-       switch(fmtlen){
-               case 26:
-               case 33:
-               case 34:
-               case 35:
-               case 37: {
+       uint8_t ftms[] = {26,33,34,35,37};
+       for ( uint8_t i = 0; i < sizeof(ftms); i++){
+               if ( ftms[i] == fmtlen ) {
                        error = FALSE;
-                       break;
-               }
-               default: {
-                       error = TRUE;
-                       break;
                }
        }
+
        if ( error ) return usage_lf_hid_brute();
        
        fc =  param_get8(Cmd, 1);
@@ -370,16 +362,18 @@ int CmdHIDBrute(const char *Cmd){
 }
 
 static command_t CommandTable[] = {
-       {"help",      CmdHelp,        1, "This help"},
-       //{"demod",     CmdHIDDemod,    1, "Demodulate HID Prox Card II (not optimal)"},
-       {"fskdemod",  CmdHIDDemodFSK, 0, "['1'] Realtime HID FSK demodulator (option '1' for one tag only)"},
-       {"sim",       CmdHIDSim,      0, "<ID> -- HID tag simulator"},
-       {"clone",     CmdHIDClone,    0, "<ID> ['l'] -- Clone HID to T55x7 (tag must be in antenna)(option 'l' for 84bit ID)"},
-       {"wiegand",  CmdHIDWiegand,  1, "<oem> <fmtlen> <fc> <cardnum> -- convert facilitycode, cardnumber to Wiegand code"},
+       {"help",        CmdHelp,                1, "This help"},
+       //{"demod",     CmdHIDDemod,    1, "Demodulate HID Prox Card II (not optimal)"},
+       {"fskdemod",CmdHIDDemodFSK,     0, "['1'] Realtime HID FSK demodulator (option '1' for one tag only)"},
+       {"sim",         CmdHIDSim,              0, "<ID> -- HID tag simulator"},
+       {"clone",       CmdHIDClone,    0, "<ID> ['l'] -- Clone HID to T55x7 (tag must be in antenna)(option 'l' for 84bit ID)"},
+       {"wiegand",     CmdHIDWiegand,  0, "<oem> <fc> <cardnum> -- convert facilitycode, cardnumber to Wiegand code"},
+       {"brute",       CmdHIDBrute,    0, "<formatlength> <Facility-Code> -- bruteforce card number"},
        {NULL, NULL, 0, NULL}
 };
 
 int CmdLFHID(const char *Cmd) {
+       clearCommandBuffer();
        CmdsParse(CommandTable, Cmd);
        return 0;
 }
Impressum, Datenschutz