From 8cdf15c2b3b83ef3f6bbb11f5921b69efce69fe9 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 19 Dec 2016 14:55:58 +0100 Subject: [PATCH] CHG: 'lf awid brute' - extra check if device gotten offline CHG: 'lf t55x7 brute' - extra check if device gotten offline CHG: 'lf nedap' - Nedap is supposed to be Diphase. --- client/cmdlfhid.c | 4 ++-- client/cmdlfnedap.c | 13 +++++++------ client/cmdlft55xx.c | 18 +++++++++++------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/client/cmdlfhid.c b/client/cmdlfhid.c index 11d996b7..d4fd1522 100644 --- a/client/cmdlfhid.c +++ b/client/cmdlfhid.c @@ -127,7 +127,7 @@ int CmdHIDSim(const char *Cmd) { int CmdHIDClone(const char *Cmd) { - unsigned int hi2 = 0, hi = 0, lo = 0; + uint32_t hi2 = 0, hi = 0, lo = 0; int n = 0, i = 0; UsbCommand c; @@ -482,7 +482,7 @@ static command_t CommandTable[] = { {"fskdemod",CmdHIDDemodFSK, 0, "Realtime HID FSK demodulator"}, {"sim", CmdHIDSim, 0, "HID tag simulator"}, {"clone", CmdHIDClone, 0, "Clone HID to T55x7"}, - {"wiegand", CmdHIDWiegand, 0, "Convert facility code/card number to Wiegand code"}, + {"wiegand", CmdHIDWiegand, 1, "Convert facility code/card number to Wiegand code"}, {"brute", CmdHIDBrute, 0, "Bruteforce card number against reader"}, {NULL, NULL, 0, NULL} }; diff --git a/client/cmdlfnedap.c b/client/cmdlfnedap.c index 1b745a11..61dab8a4 100644 --- a/client/cmdlfnedap.c +++ b/client/cmdlfnedap.c @@ -226,13 +226,14 @@ int CmdLFNedapClone(const char *Cmd) { return 1; } - ((ASK/biphase data rawdemod ab 0 64 1 0 - //NEDAP - compat mode, ASK/Biphase, data rate 64, 4 data blocks - blocks[0] = T55x7_MODULATION_BIPHASE | T55x7_BITRATE_RF_64 | 4<=0; --i){ al = data[i]; for (int j = 8; j > 0; --j) { diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index f28f84ce..25b9ba27 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -1463,8 +1463,7 @@ int CmdT55xxBruteForce(const char *Cmd) { if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE; memcpy(filename, Cmd+2, len); - FILE * f = fopen( filename , "r"); - + FILE * f = fopen( filename , "r"); if ( !f ) { PrintAndLog("File: %s: not found or locked.", filename); free(keyBlock); @@ -1519,7 +1518,13 @@ int CmdT55xxBruteForce(const char *Cmd) { // loop uint64_t testpwd = 0x00; for (uint16_t c = 0; c < keycnt; ++c ) { - + + if ( offline ) { + printf("Device offline\n"); + free(keyBlock); + return 2; + } + if (ukbhit()) { ch = getchar(); (void)ch; @@ -1531,8 +1536,7 @@ int CmdT55xxBruteForce(const char *Cmd) { testpwd = bytes_to_num(keyBlock + 4*c, 4); PrintAndLog("Testing %08X", testpwd); - - + if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, TRUE, testpwd)) { PrintAndLog("Aquireing data from device failed. Quitting"); free(keyBlock); @@ -1540,7 +1544,6 @@ int CmdT55xxBruteForce(const char *Cmd) { } found = tryDetectModulation(); - if ( found ) { PrintAndLog("Found valid password: [%08X]", testpwd); free(keyBlock); @@ -1610,7 +1613,8 @@ int tryOnePassword(uint32_t password) { if (tryDetectModulation()) return 1; - else return 0; + else + return 0; } int CmdT55xxRecoverPW(const char *Cmd) { -- 2.39.5