mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
lf em 4x70 writepin
--> lf em 4x70 setpin
This commit is contained in:
parent
2cac75d8bd
commit
ba83ac065e
8 changed files with 26 additions and 26 deletions
|
@ -1249,7 +1249,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
em4x70_auth((em4x70_data_t *)packet->data.asBytes, true);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_EM4X70_WRITEPIN: {
|
||||
case CMD_LF_EM4X70_SETPIN: {
|
||||
em4x70_write_pin((em4x70_data_t *)packet->data.asBytes, true);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -879,7 +879,7 @@ void em4x70_write_pin(const em4x70_data_t *etd, bool ledcontrol) {
|
|||
|
||||
StopTicks();
|
||||
lf_finalize(ledcontrol);
|
||||
reply_ng(CMD_LF_EM4X70_WRITEPIN, status, tag.data, sizeof(tag.data));
|
||||
reply_ng(CMD_LF_EM4X70_SETPIN, status, tag.data, sizeof(tag.data));
|
||||
}
|
||||
|
||||
void em4x70_write_key(const em4x70_data_t *etd, bool ledcontrol) {
|
||||
|
|
|
@ -126,10 +126,10 @@ typedef struct _em4x70_cmd_output_auth_t {
|
|||
ID48LIB_GRN grn;
|
||||
} em4x70_cmd_output_auth_t;
|
||||
|
||||
typedef struct _em4x70_cmd_input_writepin_t {
|
||||
typedef struct _em4x70_cmd_input_setpin_t {
|
||||
uint8_t use_parity;
|
||||
uint8_t pin[4];
|
||||
} em4x70_cmd_input_writepin_t;
|
||||
} em4x70_cmd_input_setpin_t;
|
||||
|
||||
typedef struct _em4x70_cmd_input_writekey_t {
|
||||
uint8_t use_parity;
|
||||
|
@ -369,7 +369,7 @@ static int unlock_em4x70(const em4x70_cmd_input_unlock_t *opts, em4x70_tag_info_
|
|||
return PM3_ESOFT;
|
||||
|
||||
}
|
||||
static int writepin_em4x70(const em4x70_cmd_input_writepin_t *opts, em4x70_tag_info_t *data_out) {
|
||||
static int setpin_em4x70(const em4x70_cmd_input_setpin_t *opts, em4x70_tag_info_t *data_out) {
|
||||
memset(data_out, 0, sizeof(em4x70_tag_info_t));
|
||||
|
||||
// TODO: change firmware to use per-cmd structures
|
||||
|
@ -378,10 +378,10 @@ static int writepin_em4x70(const em4x70_cmd_input_writepin_t *opts, em4x70_tag_i
|
|||
etd.pin = BYTES2UINT32(opts->pin);
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_LF_EM4X70_WRITEPIN, (uint8_t *)&etd, sizeof(etd));
|
||||
SendCommandNG(CMD_LF_EM4X70_SETPIN, (uint8_t *)&etd, sizeof(etd));
|
||||
|
||||
PacketResponseNG resp;
|
||||
if (!WaitForResponseTimeout(CMD_LF_EM4X70_WRITEPIN, &resp, TIMEOUT)) {
|
||||
if (!WaitForResponseTimeout(CMD_LF_EM4X70_SETPIN, &resp, TIMEOUT)) {
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
if (resp.status) {
|
||||
|
@ -724,12 +724,12 @@ int CmdEM4x70Auth(const char *Cmd) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int CmdEM4x70WritePIN(const char *Cmd) {
|
||||
int CmdEM4x70SetPIN(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf em 4x70 writepin",
|
||||
"Write PIN\n",
|
||||
"lf em 4x70 writepin -p 11223344 -> Write PIN\n"
|
||||
"lf em 4x70 writepin -p 11223344 --par -> Write PIN using parity commands\n"
|
||||
CLIParserInit(&ctx, "lf em 4x70 setpin",
|
||||
"Write new PIN\n",
|
||||
"lf em 4x70 setpin -p 11223344 -> Write new PIN\n"
|
||||
"lf em 4x70 setpin -p 11223344 --par -> Write new PIN using parity commands\n"
|
||||
);
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
@ -739,7 +739,7 @@ int CmdEM4x70WritePIN(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
em4x70_cmd_input_writepin_t opts = {
|
||||
em4x70_cmd_input_setpin_t opts = {
|
||||
.use_parity = arg_get_lit(ctx, 1),
|
||||
.pin = {0}, // hex value macro exits function, so cannot be initialized here
|
||||
};
|
||||
|
@ -755,7 +755,7 @@ int CmdEM4x70WritePIN(const char *Cmd) {
|
|||
|
||||
// Client command line parsing and validation complete ... now use the helper function
|
||||
em4x70_tag_info_t info;
|
||||
int result = writepin_em4x70(&opts, &info);
|
||||
int result = setpin_em4x70(&opts, &info);
|
||||
if (result == PM3_ETIMEOUT) {
|
||||
PrintAndLogEx(WARNING, "Timeout while waiting for reply.");
|
||||
} else if (result == PM3_SUCCESS) {
|
||||
|
@ -1392,9 +1392,9 @@ static command_t CommandTable[] = {
|
|||
{"write", CmdEM4x70Write, IfPm3EM4x70, "Write EM4x70"},
|
||||
{"unlock", CmdEM4x70Unlock, IfPm3EM4x70, "Unlock EM4x70 for writing"},
|
||||
{"auth", CmdEM4x70Auth, IfPm3EM4x70, "Authenticate EM4x70"},
|
||||
{"writepin", CmdEM4x70WritePIN, IfPm3EM4x70, "Write PIN"},
|
||||
{"setpin", CmdEM4x70SetPIN, IfPm3EM4x70, "Write PIN"},
|
||||
{"writekey", CmdEM4x70WriteKey, IfPm3EM4x70, "Write key"},
|
||||
{"recover", CmdEM4x70Recover, IfPm3EM4x70, "Recover remaining key from partial key"},
|
||||
{"recover", CmdEM4x70Recover, AlwaysAvailable, "Recover remaining key from partial key"},
|
||||
{"autorecover", CmdEM4x70AutoRecover, IfPm3EM4x70, "Recover entire key from writable tag"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ int CmdEM4x70Write(const char *Cmd);
|
|||
int CmdEM4x70Brute(const char *Cmd);
|
||||
int CmdEM4x70Unlock(const char *Cmd);
|
||||
int CmdEM4x70Auth(const char *Cmd);
|
||||
int CmdEM4x70WritePIN(const char *Cmd);
|
||||
int CmdEM4x70SetPIN(const char *Cmd);
|
||||
int CmdEM4x70WriteKey(const char *Cmd);
|
||||
int CmdEM4x70Recover(const char *Cmd);
|
||||
|
||||
|
|
|
@ -613,7 +613,7 @@ const static vocabulary_t vocabulary[] = {
|
|||
{ 0, "lf em 4x70 write" },
|
||||
{ 0, "lf em 4x70 unlock" },
|
||||
{ 0, "lf em 4x70 auth" },
|
||||
{ 0, "lf em 4x70 writepin" },
|
||||
{ 0, "lf em 4x70 setpin" },
|
||||
{ 0, "lf em 4x70 writekey" },
|
||||
{ 0, "lf em 4x70 recover" },
|
||||
{ 0, "lf em 4x70 autorecover" },
|
||||
|
|
|
@ -8982,12 +8982,12 @@
|
|||
],
|
||||
"usage": "lf em 4x70 writekey [-h] [--par] -k <hex>"
|
||||
},
|
||||
"lf em 4x70 writepin": {
|
||||
"command": "lf em 4x70 writepin",
|
||||
"lf em 4x70 setpin": {
|
||||
"command": "lf em 4x70 setpin",
|
||||
"description": "Write PIN",
|
||||
"notes": [
|
||||
"lf em 4x70 writepin -p 11223344 -> Write PIN",
|
||||
"lf em 4x70 writepin -p 11223344 --par -> Write PIN using parity commands"
|
||||
"lf em 4x70 setpin -p 11223344 -> Write new PIN",
|
||||
"lf em 4x70 setpin -p 11223344 --par -> Write new PIN using parity commands"
|
||||
],
|
||||
"offline": false,
|
||||
"options": [
|
||||
|
@ -8995,7 +8995,7 @@
|
|||
"--par Add parity bit when sending commands",
|
||||
"-p, --pin <hex> pin, 4 bytes"
|
||||
],
|
||||
"usage": "lf em 4x70 writepin [-h] [--par] -p <hex>"
|
||||
"usage": "lf em 4x70 setpin [-h] [--par] -p <hex>"
|
||||
},
|
||||
"lf em help": {
|
||||
"command": "lf em help",
|
||||
|
|
|
@ -960,8 +960,8 @@ Check column "offline" for their availability.
|
|||
|`lf em 4x70 write `|N |`Write EM4x70`
|
||||
|`lf em 4x70 unlock `|N |`Unlock EM4x70 for writing`
|
||||
|`lf em 4x70 auth `|N |`Authenticate EM4x70`
|
||||
|`lf em 4x70 writepin `|N |`Write PIN`
|
||||
|`lf em 4x70 writekey `|N |`Write key`
|
||||
|`lf em 4x70 setpin `|N |`Write new PIN`
|
||||
|`lf em 4x70 writekey `|N |`Write new key`
|
||||
|`lf em 4x70 recover `|N |`Recover remaining key from partial key`
|
||||
|`lf em 4x70 autorecover `|N |`Recover entire key from writable tag`
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ typedef struct {
|
|||
#define CMD_LF_EM4X70_WRITE 0x0261
|
||||
#define CMD_LF_EM4X70_UNLOCK 0x0262
|
||||
#define CMD_LF_EM4X70_AUTH 0x0263
|
||||
#define CMD_LF_EM4X70_WRITEPIN 0x0264
|
||||
#define CMD_LF_EM4X70_SETPIN 0x0264
|
||||
#define CMD_LF_EM4X70_WRITEKEY 0x0265
|
||||
#define CMD_LF_EM4X70_BRUTE 0x0266
|
||||
// Sampling configuration for LF reader/sniffer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue