-
- UsbCommand c = {CMD_HID_SIM_TAG, {0, 0, 0}};
-
- char cmdp = param_getchar(Cmd, 0);
- if (strlen(Cmd) > 2 || strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_lf_hid_brute();
-
- fmtlen = param_get8(Cmd, 0);
- uint8_t ftms[] = {26,33,34,35,37};
- for ( uint8_t i = 0; i < sizeof(ftms); i++){
- if ( ftms[i] == fmtlen ) {
- error = FALSE;
+ uint8_t cmdp = 0;
+
+ while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
+ switch(param_getchar(Cmd, cmdp)) {
+ case 'h':
+ case 'H':
+ return usage_lf_hid_brute();
+ case 'f':
+ case 'F':
+ fc = param_get32ex(Cmd ,cmdp+1, 0, 10);
+ if ( !fc )
+ errors = true;
+ cmdp += 2;
+ break;
+ case 'd':
+ case 'D':
+ // delay between attemps, defaults to 1000ms.
+ delay = param_get32ex(Cmd, cmdp+1, 1000, 10);
+ cmdp += 2;
+ break;
+ case 'c':
+ case 'C':
+ cn = param_get32ex(Cmd, cmdp+1, 0, 10);
+ // truncate cardnumber.
+ cn &= 0xFFFF;
+ cmdp += 2;
+ break;
+ case 'a':
+ case 'A':
+ fmtlen = param_get8(Cmd, cmdp+1);
+ cmdp += 2;
+ bool is_ftm_ok = FALSE;
+ uint8_t ftms[] = {26,33,34,35,37};
+ for ( uint8_t i = 0; i < sizeof(ftms); i++){
+ if ( ftms[i] == fmtlen ) {
+ is_ftm_ok = TRUE;
+ }
+ }
+ // negated
+ errors = !is_ftm_ok;
+ break;
+ default:
+ PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));
+ errors = true;
+ break;