+int usage_lf_em410x_brute(void) {
+ PrintAndLog("Bruteforcing by emulating EM410x tag");
+ PrintAndLog("");
+ PrintAndLog("Usage: lf em 410xbrute [h] ids.txt [d 2000] [c clock]");
+ PrintAndLog("Options:");
+ PrintAndLog(" h - this help");
+ PrintAndLog(" ids.txt - file with UIDs in HEX format, one per line");
+ PrintAndLog(" d (2000) - pause delay in milliseconds between UIDs simulation, default 1000 ms (optional)");
+ PrintAndLog(" c (32) - clock (32|64), default 64 (optional)");
+ PrintAndLog("samples:");
+ PrintAndLog(" lf em 410xbrute ids.txt");
+ PrintAndLog(" lf em 410xbrute ids.txt c 32");
+ PrintAndLog(" lf em 410xbrute ids.txt d 3000");
+ PrintAndLog(" lf em 410xbrute ids.txt d 3000 c 32");
+ return 0;
+}
+
+int CmdEM410xBrute(const char *Cmd)
+{
+ char filename[FILE_PATH_SIZE]={0};
+ FILE *f = NULL;
+ char buf[11];
+ uint32_t uidcnt = 0;
+ uint8_t stUidBlock = 20;
+ uint8_t *uidBlock = NULL, *p = NULL;
+ int ch;
+ uint8_t uid[5] = {0x00};
+ /* clock is 64 in EM410x tags */
+ uint8_t clock = 64;
+ /* default pause time: 1 second */
+ uint32_t delay = 1000;
+
+ char cmdp = param_getchar(Cmd, 0);
+
+ if (cmdp == 'h' || cmdp == 'H') return usage_lf_em410x_brute();
+
+
+ cmdp = param_getchar(Cmd, 1);
+
+ if (cmdp == 'd' || cmdp == 'D') {
+ delay = param_get32ex(Cmd, 2, 1000, 10);
+ param_getdec(Cmd, 4, &clock);
+ } else if (cmdp == 'c' || cmdp == 'C') {
+ param_getdec(Cmd, 2, &clock);
+ delay = param_get32ex(Cmd, 4, 1000, 10);
+ }