mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 21:33:19 -07:00
add: Topaz mode for "hf 14a raw" (new option -T)
chg: allow tracing without parity chg: make "hf list topaz" aware of additional commands for Dynamic Memory Model
This commit is contained in:
parent
05ddb52c43
commit
48ece4a750
7 changed files with 182 additions and 51 deletions
|
@ -17,6 +17,71 @@
|
|||
#include "cmdhftopaz.h"
|
||||
#include "cmdhf14a.h"
|
||||
#include "ui.h"
|
||||
#include "mifare.h"
|
||||
#include "proxmark3.h"
|
||||
#include "iso14443crc.h"
|
||||
#include "protocols.h"
|
||||
|
||||
|
||||
|
||||
static void topaz_switch_on_field(void)
|
||||
{
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_SELECT | ISO14A_NO_DISCONNECT | ISO14A_TOPAZMODE, 0, 0}};
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
WaitForResponse(CMD_ACK, &resp);
|
||||
}
|
||||
|
||||
|
||||
static void topaz_switch_off_field(void)
|
||||
{
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {0, 0, 0}};
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
WaitForResponse(CMD_ACK, &resp);
|
||||
}
|
||||
|
||||
|
||||
static void topaz_send_cmd_raw(uint8_t *cmd, uint8_t len, uint8_t *response)
|
||||
{
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_TOPAZMODE, len, 0}};
|
||||
memcpy(c.d.asBytes, cmd, len);
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
WaitForResponse(CMD_ACK, &resp);
|
||||
|
||||
memcpy(response, resp.d.asBytes, resp.arg[0]);
|
||||
}
|
||||
|
||||
|
||||
static void topaz_send_cmd(uint8_t *cmd, uint8_t len, uint8_t *response)
|
||||
{
|
||||
if (len > 1) {
|
||||
uint8_t first, second;
|
||||
ComputeCrc14443(CRC_14443_B, cmd, len, &first, &second);
|
||||
cmd[len] = first;
|
||||
cmd[len+1] = second;
|
||||
}
|
||||
|
||||
topaz_send_cmd_raw(cmd, len+2, response);
|
||||
}
|
||||
|
||||
|
||||
static void topaz_select(uint8_t *atqa, uint8_t *uid)
|
||||
{
|
||||
// ToDo: implement anticollision
|
||||
uint8_t rid_cmd[] = {TOPAZ_RID, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t wupa_cmd[] = {TOPAZ_WUPA};
|
||||
|
||||
topaz_switch_on_field();
|
||||
topaz_send_cmd(wupa_cmd, sizeof(wupa_cmd), atqa);
|
||||
topaz_send_cmd(rid_cmd, sizeof(rid_cmd) - 2, uid);
|
||||
topaz_switch_off_field();
|
||||
}
|
||||
|
||||
|
||||
int CmdHFTopazReader(const char *Cmd)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue