From 9cdc26207fdf3ca936f67730bc80dd249e60c004 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 22 Sep 2019 13:04:28 +0200 Subject: [PATCH] add 'lf hid watch' , 'lf awid watch', 'lf io watch' --- client/cmdlfawid.c | 29 ++++++++++++----------------- client/cmdlfhid.c | 9 +++------ client/cmdlfio.c | 28 ++++++++++++---------------- 3 files changed, 27 insertions(+), 39 deletions(-) diff --git a/client/cmdlfawid.c b/client/cmdlfawid.c index 056d95af4..dcbcc0f7e 100644 --- a/client/cmdlfawid.c +++ b/client/cmdlfawid.c @@ -29,23 +29,18 @@ #include "cmdlft55xx.h" // verifywrite static int CmdHelp(const char *Cmd); -/* -static int usage_lf_awid_read(void) { + +static int usage_lf_awid_watch(void) { PrintAndLogEx(NORMAL, "Enables AWID compatible reader mode printing details of scanned AWID26 or AWID50 tags."); PrintAndLogEx(NORMAL, "By default, values are printed and logged until the button is pressed or another USB command is issued."); - PrintAndLogEx(NORMAL, "If the [1] option is provided, reader mode is exited after reading a single AWID card."); PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(NORMAL, "Usage: lf awid read [h] [1]"); - PrintAndLogEx(NORMAL, "Options:"); - PrintAndLogEx(NORMAL, " h : This help"); - PrintAndLogEx(NORMAL, " 1 : (optional) stop after reading a single card"); + PrintAndLogEx(NORMAL, "Usage: lf awid watch"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf awid read"); - PrintAndLogEx(NORMAL, " lf awid read 1"); + PrintAndLogEx(NORMAL, " lf awid watch"); return PM3_SUCCESS; } -*/ + static int usage_lf_awid_sim(void) { PrintAndLogEx(NORMAL, "Enables simulation of AWID card with specified facility-code and card number."); PrintAndLogEx(NORMAL, "Simulation runs until the button is pressed or another USB command is issued."); @@ -180,18 +175,17 @@ static void verify_values(uint8_t *fmtlen, uint32_t *fc, uint32_t *cn) { break; } } -/* + // this read loops on device side. // uses the demod in lfops.c -static int CmdAWIDRead_device(const char *Cmd) { - - if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_lf_awid_read(); - uint8_t findone = (Cmd[0] == '1') ? 1 : 0; +static int CmdAWIDWatch(const char *Cmd) { + uint8_t ctmp = tolower(param_getchar(Cmd, 0)); + if (ctmp == 'h') return usage_lf_awid_watch(); clearCommandBuffer(); - SendCommandMIX(CMD_LF_AWID_DEMOD, findone, 0, 0, NULL, 0); + SendCommandNG(CMD_LF_AWID_DEMOD, NULL, 0); return PM3_SUCCESS; } -*/ + //by marshmellow //AWID Prox demod - FSK2a RF/50 with preamble of 00000001 (always a 96 bit data stream) //print full AWID Prox ID and some bit format details if found @@ -557,6 +551,7 @@ static command_t CommandTable[] = { {"clone", CmdAWIDClone, IfPm3Lf, "clone AWID to T55x7"}, {"sim", CmdAWIDSim, IfPm3Lf, "simulate AWID tag"}, {"brute", CmdAWIDBrute, IfPm3Lf, "Bruteforce card number against reader"}, + {"watch", CmdAWIDWatch, IfPm3Lf, "continuously watch for cards. Reader mode"}, {NULL, NULL, NULL, NULL} }; diff --git a/client/cmdlfhid.c b/client/cmdlfhid.c index 20baa6449..a5cb64325 100644 --- a/client/cmdlfhid.c +++ b/client/cmdlfhid.c @@ -47,9 +47,7 @@ static int usage_lf_hid_watch(void) { PrintAndLogEx(NORMAL, "Enables HID compatible reader mode printing details."); PrintAndLogEx(NORMAL, "By default, values are printed and logged until the button is pressed or another USB command is issued."); PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(NORMAL, "Usage: lf hid watch [h]"); - PrintAndLogEx(NORMAL, "Options:"); - PrintAndLogEx(NORMAL, " h : This help"); + PrintAndLogEx(NORMAL, "Usage: lf hid watch"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, " lf hid watch"); @@ -264,11 +262,10 @@ static int CmdHIDRead(const char *Cmd) { // this read loops on device side. // uses the demod in lfops.c static int CmdHIDWatch(const char *Cmd) { - uint8_t ctmp = tolower(param_getchar(Cmd, 0)); - if ( strlen(Cmd) == 0 || ctmp == 'h') return usage_lf_hid_watch(); + if (ctmp == 'h') return usage_lf_hid_watch(); clearCommandBuffer(); - SendCommandMIX(CMD_LF_HID_DEMOD, 0, 0, 0, NULL, 0); + SendCommandNG(CMD_LF_HID_DEMOD, NULL, 0); return PM3_SUCCESS; } diff --git a/client/cmdlfio.c b/client/cmdlfio.c index 7b3e777c6..203b1c06d 100644 --- a/client/cmdlfio.c +++ b/client/cmdlfio.c @@ -27,23 +27,18 @@ #include "cmdlft55xx.h" // verifywrite static int CmdHelp(const char *Cmd); -/* -static int usage_lf_io_read(void) { + +static int usage_lf_io_watch(void) { PrintAndLogEx(NORMAL, "Enables IOProx compatible reader mode printing details of scanned tags."); PrintAndLogEx(NORMAL, "By default, values are printed and logged until the button is pressed or another USB command is issued."); - PrintAndLogEx(NORMAL, "If the [1] option is provided, reader mode is exited after reading a single card."); PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(NORMAL, "Usage: lf io read [h] [1]"); - PrintAndLogEx(NORMAL, "Options:"); - PrintAndLogEx(NORMAL, " h : This help"); - PrintAndLogEx(NORMAL, " 1 : (optional) stop after reading a single card"); + PrintAndLogEx(NORMAL, "Usage: lf io watch"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf io read"); - PrintAndLogEx(NORMAL, " lf io read 1"); + PrintAndLogEx(NORMAL, " lf io watch"); return PM3_SUCCESS; } -*/ + static int usage_lf_io_sim(void) { PrintAndLogEx(NORMAL, "Enables simulation of IOProx card with specified facility-code and card number."); PrintAndLogEx(NORMAL, "Simulation runs until the button is pressed or another USB command is issued."); @@ -76,17 +71,17 @@ static int usage_lf_io_clone(void) { PrintAndLogEx(NORMAL, " lf io clone 26 101 1337"); return PM3_SUCCESS; } -/* + // this read loops on device side. // uses the demod in lfops.c -static int CmdIOProxRead_device(const char *Cmd) { - if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_lf_io_read(); - int findone = (Cmd[0] == '1') ? 1 : 0; +static int CmdIOProxWatch(const char *Cmd) { + uint8_t ctmp = tolower(param_getchar(Cmd, 0)); + if (ctmp == 'h') return usage_lf_io_watch(); clearCommandBuffer(); - SendCommandMIX(CMD_LF_IO_DEMOD, findone, 0, 0, NULL, 0); + SendCommandNG(CMD_LF_IO_DEMOD, NULL, 0); return PM3_SUCCESS; } -*/ + //by marshmellow //IO-Prox demod - FSK RF/64 with preamble of 000000001 //print ioprox ID and some format details @@ -324,6 +319,7 @@ static command_t CommandTable[] = { {"read", CmdIOProxRead, IfPm3Lf, "attempt to read and extract tag data"}, {"clone", CmdIOProxClone, IfPm3Lf, "clone IOProx to T55x7"}, {"sim", CmdIOProxSim, IfPm3Lf, "simulate IOProx tag"}, + {"watch", CmdIOProxWatch, IfPm3Lf, "continuously watch for cards. Reader mode"}, {NULL, NULL, NULL, NULL} };