added function 4x50_watch

This commit is contained in:
tharexde
2020-10-05 22:59:08 +02:00
parent b0cfb28d40
commit 68db54028c
7 changed files with 100 additions and 0 deletions

View File

@@ -1425,6 +1425,7 @@ static command_t CommandTable[] = {
{"4x50_brute", CmdEM4x50Brute, IfPm3EM4x50, "guess password of EM4x50"},
{"4x50_login", CmdEM4x50Login, IfPm3EM4x50, "login into EM4x50"},
{"4x50_reset", CmdEM4x50Reset, IfPm3EM4x50, "reset EM4x50"},
{"4x50_watch", CmdEM4x50Watch, IfPm3EM4x50, "read EM4x50 continously"},
{NULL, NULL, NULL, NULL}
};

View File

@@ -133,6 +133,17 @@ static int usage_lf_em4x50_reset(void) {
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS;
}
static int usage_lf_em4x50_watch(void) {
PrintAndLogEx(NORMAL, "Watch for EM4x50 tag. Tag must be on antenna. ");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Usage: lf em 4x50_watch [h]");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h - this help");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf em 4x50_watch"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS;
}
static void prepare_result(const uint8_t *byte, int fwr, int lwr, em4x50_word_t *words) {
@@ -917,3 +928,39 @@ int CmdEM4x50Reset(const char *Cmd) {
return PM3_SUCCESS;
}
int CmdEM4x50Watch(const char *Cmd) {
// continously envoke reading of a EM4x50 tag
bool errors = false;
uint8_t cmdp = 0;
PacketResponseNG resp;
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
return usage_lf_em4x50_watch();
default:
PrintAndLogEx(WARNING, " Unknown parameter '%c'", param_getchar(Cmd, cmdp));
errors = true;
break;
}
}
// validation
if (errors)
return usage_lf_em4x50_watch();
PrintAndLogEx(SUCCESS, "Watching for EM4x50 cards - place tag on antenna");
clearCommandBuffer();
SendCommandNG(CMD_LF_EM4X50_WATCH, 0, 0);
WaitForResponse(CMD_ACK, &resp);
PrintAndLogEx(INFO, "Done");
return PM3_SUCCESS;
}

View File

@@ -27,5 +27,6 @@ int CmdEM4x50Wipe(const char *Cmd);
int CmdEM4x50Brute(const char *Cmd);
int CmdEM4x50Login(const char *Cmd);
int CmdEM4x50Reset(const char *Cmd);
int CmdEM4x50Watch(const char *Cmd);
#endif