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");
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);
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:
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);
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}
};