mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
@@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
|
||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Added `lf em 410x clone --htu` clone EM410x ID to Hitag µ/8265 (@douniwan5788)
|
||||
- Added `lf hitag htu` support for Hitag µ/8265 (@douniwan5788)
|
||||
- Added `hf mfu aesauth` based on existing UL AES support (@doegox)
|
||||
- Changed `hf mfu sim` deny OTP changes with all zeros (@iceman1001)
|
||||
- Added missing file in CMakeLists.txt (@iceman1001)
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ else
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring WITH_HITAG,$(APP_CFLAGS)))
|
||||
SRC_HITAG = hitag2_crypto.c hitag_common.c hitag2.c hitagS.c hitag2_crack.c
|
||||
SRC_HITAG = hitag2_crypto.c hitag_common.c hitag2.c hitagS.c hitagu.c hitag2_crack.c
|
||||
APP_CFLAGS += -I../common/hitag2
|
||||
else
|
||||
SRC_HITAG =
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "hitag2.h"
|
||||
#include "hitag2_crack.h"
|
||||
#include "hitagS.h"
|
||||
#include "hitagu.h"
|
||||
#include "em4x50.h"
|
||||
#include "em4x70.h"
|
||||
#include "iclass.h"
|
||||
@@ -1232,6 +1233,25 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
memcpy(mem, payload->data, payload->len);
|
||||
break;
|
||||
}
|
||||
|
||||
case CMD_LF_HITAGU_READ: {
|
||||
lf_hitag_data_t *payload = (lf_hitag_data_t *)packet->data.asBytes;
|
||||
htu_read(payload, true);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_HITAGU_WRITE: {
|
||||
lf_hitag_data_t *payload = (lf_hitag_data_t *)packet->data.asBytes;
|
||||
htu_write_page(payload, true);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_HITAGU_SIMULATE: {
|
||||
htu_simulate((bool)packet->oldarg[0], packet->oldarg[1], packet->data.asBytes, true);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_HITAGU_UID: {
|
||||
htu_read_uid(NULL, true, true);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_EM4x50
|
||||
|
||||
+2
-2
@@ -241,8 +241,8 @@ static uint8_t felica_select_card(felica_card_select_t *card) {
|
||||
// We try 10 times, or if answer was received.
|
||||
int len = 25;
|
||||
do {
|
||||
// end-of-reception response packet data, wait approx. 501μs
|
||||
// end-of-transmission command packet data, wait approx. 197μs
|
||||
// end-of-reception response packet data, wait approx. 501µs
|
||||
// end-of-transmission command packet data, wait approx. 197µs
|
||||
// polling card
|
||||
TransmitFor18092_AsReader(poll, sizeof(poll), NULL, 1, 0);
|
||||
|
||||
|
||||
+897
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// See LICENSE.txt for the text of the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Hitag µ functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _HITAGU_H_
|
||||
#define _HITAGU_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "hitag.h"
|
||||
|
||||
void htu_simulate(bool tag_mem_supplied, int8_t threshold, const uint8_t *data, bool ledcontrol);
|
||||
void htu_read(const lf_hitag_data_t *payload, bool ledcontrol);
|
||||
void htu_write_page(const lf_hitag_data_t *payload, bool ledcontrol);
|
||||
int htu_read_uid(uint64_t *uid, bool ledcontrol, bool send_answer);
|
||||
|
||||
#endif
|
||||
+4
-4
@@ -64,11 +64,11 @@ SAM7S has several timers, we will use the source TIMER_CLOCK1 (aka AT91C_TC_CLKS
|
||||
TIMER_CLOCK1 = MCK/2, MCK is running at 48 MHz, Timer is running at 48/2 = 24 MHz
|
||||
|
||||
New timer implementation in ticks.c, which is used in LFOPS.c
|
||||
1 μs = 1.5 ticks
|
||||
1 fc = 8 μs = 12 ticks
|
||||
1 µs = 1.5 ticks
|
||||
1 fc = 8 µs = 12 ticks
|
||||
|
||||
Terms you find in different datasheets and how they match.
|
||||
1 Cycle = 8 microseconds (μs) == 1 field clock (fc)
|
||||
1 Cycle = 8 microseconds (µs) == 1 field clock (fc)
|
||||
|
||||
Note about HITAG timing
|
||||
Hitag units (T0) have duration of 8 microseconds (us), which is 1/125000 per second (carrier)
|
||||
@@ -80,7 +80,7 @@ Hitag units (T0) have duration of 8 microseconds (us), which is 1/125000 per sec
|
||||
==========================================================================================================
|
||||
|
||||
ATA5577 Downlink Protocol Timings.
|
||||
Note: All absolute times assume TC = 1 / fC = 8 μs (fC = 125 kHz)
|
||||
Note: All absolute times assume TC = 1 / fC = 8 µs (fC = 125 kHz)
|
||||
|
||||
Note: These timings are from the datasheet and doesn't map the best to the features of the RVD4 LF antenna.
|
||||
RDV4 LF antenna has high voltage and the drop of power when turning off the rf field takes about 1-2 TC longer.
|
||||
|
||||
@@ -380,6 +380,7 @@ set (TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/cmdlfhid.c
|
||||
${PM3_ROOT}/client/src/cmdlfhitag.c
|
||||
${PM3_ROOT}/client/src/cmdlfhitaghts.c
|
||||
${PM3_ROOT}/client/src/cmdlfhitagu.c
|
||||
${PM3_ROOT}/client/src/cmdlfidteck.c
|
||||
${PM3_ROOT}/client/src/cmdlfindala.c
|
||||
${PM3_ROOT}/client/src/cmdlfio.c
|
||||
|
||||
@@ -660,6 +660,7 @@ SRCS = mifare/aiddesfire.c \
|
||||
cmdlfhid.c \
|
||||
cmdlfhitag.c \
|
||||
cmdlfhitaghts.c \
|
||||
cmdlfhitagu.c \
|
||||
cmdlfidteck.c \
|
||||
cmdlfindala.c \
|
||||
cmdlfio.c \
|
||||
|
||||
@@ -380,6 +380,7 @@ set (TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/cmdlfhid.c
|
||||
${PM3_ROOT}/client/src/cmdlfhitag.c
|
||||
${PM3_ROOT}/client/src/cmdlfhitaghts.c
|
||||
${PM3_ROOT}/client/src/cmdlfhitagu.c
|
||||
${PM3_ROOT}/client/src/cmdlfidteck.c
|
||||
${PM3_ROOT}/client/src/cmdlfindala.c
|
||||
${PM3_ROOT}/client/src/cmdlfio.c
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ int CmdHFSearch(const char *Cmd) {
|
||||
|
||||
int res = PM3_ESOFT;
|
||||
|
||||
uint8_t success[20] = {0};
|
||||
uint8_t success[COUNT_OF_PROTOCOLS] = {0};
|
||||
|
||||
PROMPT_CLEARLINE;
|
||||
PrintAndLogEx(INPLACE, " Searching for ThinFilm tag...");
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "cmdlfhid.h" // for hid menu
|
||||
#include "cmdlfhitag.h" // for hitag menu
|
||||
#include "cmdlfhitaghts.h" // for hitag S sub commands
|
||||
#include "cmdlfhitagu.h" // for hitag µ sub commands
|
||||
#include "cmdlfidteck.h" // for idteck menu
|
||||
#include "cmdlfio.h" // for ioprox menu
|
||||
#include "cmdlfcotag.h" // for COTAG menu
|
||||
@@ -1602,6 +1603,14 @@ static bool check_chiptype(bool getDeviceData) {
|
||||
retval = true;
|
||||
goto out;
|
||||
}
|
||||
|
||||
// Hitag µ
|
||||
if (read_htu_uid() == PM3_SUCCESS) {
|
||||
PrintAndLogEx(SUCCESS, "Chipset detection: " _GREEN_("Hitag µ / 8265"));
|
||||
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf hitag htu`") " commands");
|
||||
retval = true;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+113
-33
@@ -624,11 +624,12 @@ static int CmdEM410xSpoof(const char *Cmd) {
|
||||
static int CmdEM410xClone(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf em 410x clone",
|
||||
"clone a EM410x ID to a T55x7, Q5/T5555, EM4305/4469 or Hitag S/8211/8268/8310 tag.",
|
||||
"clone a EM410x ID to a T55x7, Q5/T5555, EM4305/4469, Hitag S/8211/8268/8310 or Hitag µ/8265 tag.",
|
||||
"lf em 410x clone --id 0F0368568B -> encode for T55x7 tag\n"
|
||||
"lf em 410x clone --id 0F0368568B --q5 -> encode for Q5/T5555 tag\n"
|
||||
"lf em 410x clone --id 0F0368568B --em -> encode for EM4305/4469\n"
|
||||
"lf em 410x clone --id 0F0368568B --hts -> encode for Hitag S/8211/8268/8310"
|
||||
"lf em 410x clone --id 0F0368568B --hts -> encode for Hitag S/8211/8268/8310\n"
|
||||
"lf em 410x clone --id 0F0368568B --htu -> encode for Hitag µ/8265 tag"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
@@ -638,6 +639,7 @@ static int CmdEM410xClone(const char *Cmd) {
|
||||
arg_lit0(NULL, "q5", "optional - specify writing to Q5/T5555 tag"),
|
||||
arg_lit0(NULL, "em", "optional - specify writing to EM4305/4469 tag"),
|
||||
arg_lit0(NULL, "hts", "optional - specify writing to Hitag S/8211/8268/8310 tag"),
|
||||
arg_lit0(NULL, "htu", "optional - specify writing to Hitag µ/8265 tag"),
|
||||
arg_lit0(NULL, "electra", "optional - add Electra blocks to tag"),
|
||||
arg_param_end
|
||||
};
|
||||
@@ -651,23 +653,23 @@ static int CmdEM410xClone(const char *Cmd) {
|
||||
bool q5 = arg_get_lit(ctx, 3);
|
||||
bool em = arg_get_lit(ctx, 4);
|
||||
bool hts = arg_get_lit(ctx, 5);
|
||||
bool add_electra = arg_get_lit(ctx, 6);
|
||||
bool htu = arg_get_lit(ctx, 6);
|
||||
bool add_electra = arg_get_lit(ctx, 7);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (q5 + em + hts > 1) {
|
||||
if (q5 + em + hts + htu > 1) {
|
||||
PrintAndLogEx(FAILED, "Only specify one tag Type");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (hts) {
|
||||
if (IfPm3Hitag() == false) {
|
||||
PrintAndLogEx(FAILED, "Device not compiled to support Hitag");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
if (clk == 40) {
|
||||
PrintAndLogEx(FAILED, "supported clock rates for Hitag are " _YELLOW_("16, 32, 64"));
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
if ((hts || htu) && IfPm3Hitag() == false) {
|
||||
PrintAndLogEx(FAILED, "Device not compiled to support Hitag");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if ((hts || htu) && clk == 40) {
|
||||
PrintAndLogEx(FAILED, "supported clock rates for Hitag are " _YELLOW_("16, 32, 64"));
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
// Allowed clock rates: 16, 32, 40 and 64
|
||||
@@ -678,9 +680,9 @@ static int CmdEM410xClone(const char *Cmd) {
|
||||
|
||||
uint64_t id = bytes_to_num(uid, uid_len);
|
||||
PrintAndLogEx(SUCCESS, "Preparing to clone EM4102 to " _YELLOW_("%s") " tag with EM Tag ID " _GREEN_("%010" PRIX64) " (RF/%d)",
|
||||
q5 ? "Q5/T5555" : (em ? "EM4305/4469" : (hts ? "Hitag S/82xx" : "T55x7")), id, clk);
|
||||
q5 ? "Q5/T5555" : (em ? "EM4305/4469" : (hts ? "Hitag S/82xx" : (htu ? "Hitag µ/82xx" : "T55x7"))), id, clk);
|
||||
|
||||
uint8_t data[HITAG_BLOCK_SIZE * 2] = {0xFF, 0x80}; // EM410X_HEADER 9 bits of one
|
||||
uint8_t data[8] = {0xFF, 0x80}; // EM410X_HEADER 9 bits of one
|
||||
uint32_t databits = 9;
|
||||
uint8_t c_parity = 0;
|
||||
|
||||
@@ -706,35 +708,45 @@ static int CmdEM410xClone(const char *Cmd) {
|
||||
lf_hitag_data_t packet;
|
||||
memset(&packet, 0, sizeof(packet));
|
||||
|
||||
for (size_t steps = 0; steps < 3; steps++) {
|
||||
switch (steps) {
|
||||
case 0:
|
||||
packet.data[0] = 0xCA; //compatiable for 82xx, no impact on Hitag S
|
||||
// clk -> TTFDR1 TTFDR0
|
||||
// 32 -> 0x00 4 kBit/s
|
||||
// 16 -> 0x10 8 kBit/s
|
||||
// 64 -> 0x20 2 kBit/s
|
||||
packet.data[1] = 0x04;
|
||||
for (size_t step = 0; step < 3; step++) {
|
||||
switch (step) {
|
||||
case 0: {
|
||||
hitags_config_t config = {0};
|
||||
config.MEMT = 0x02; // compatiable for 82xx, no impact on Hitag S
|
||||
config.TTFM = 0x01; // 0 = "Block 0, Block 1, Block 2, Block 3", 1 = "Block 0, Block 1"
|
||||
config.TTFC = 0x00; // Manchester
|
||||
config.auth = 0x00; // Plain
|
||||
|
||||
//compatiable for 82xx, no impact on Hitag S
|
||||
config.RES1 = 0x01;
|
||||
config.RES4 = 0x01;
|
||||
config.RES5 = 0x01;
|
||||
switch (clk) {
|
||||
case 64:
|
||||
// 2 kBit/s
|
||||
config.TTFDR = 0x02;
|
||||
break;
|
||||
case 32:
|
||||
// 4 kBit/s
|
||||
config.TTFDR = 0x00;
|
||||
break;
|
||||
case 16:
|
||||
packet.data[1] |= 0x10;
|
||||
break;
|
||||
case 64:
|
||||
packet.data[1] |= 0x20;
|
||||
// 8 kBit/s
|
||||
config.TTFDR = 0x01;
|
||||
break;
|
||||
}
|
||||
packet.data[2] = 0;
|
||||
packet.data[3] = 0; //TODO: keep PWDH0?
|
||||
//TODO: keep other fields?
|
||||
memcpy(packet.data, &config, sizeof(config));
|
||||
// PrintAndLogEx(INFO, "packet.data: %s", sprint_hex(packet.data, sizeof(packet.data)));
|
||||
packet.page = 1;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
memcpy(packet.data, &data[HITAG_BLOCK_SIZE * 0], HITAG_BLOCK_SIZE);
|
||||
memcpy(packet.data, &data[HITAGS_PAGE_SIZE * 0], HITAGS_PAGE_SIZE);
|
||||
packet.page = 4;
|
||||
break;
|
||||
case 2:
|
||||
memcpy(packet.data, &data[HITAG_BLOCK_SIZE * 1], HITAG_BLOCK_SIZE);
|
||||
memcpy(packet.data, &data[HITAGS_PAGE_SIZE * 1], HITAGS_PAGE_SIZE);
|
||||
packet.page = 5;
|
||||
break;
|
||||
}
|
||||
@@ -748,10 +760,78 @@ static int CmdEM410xClone(const char *Cmd) {
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
if (resp.status != PM3_SUCCESS) {
|
||||
PrintAndLogEx(WARNING, "Something went wrong");
|
||||
PrintAndLogEx(WARNING, "Something went wrong in step %zu", step);
|
||||
return resp.status;
|
||||
}
|
||||
}
|
||||
} else if (htu) {
|
||||
lf_hitag_data_t packet;
|
||||
memset(&packet, 0, sizeof(packet));
|
||||
|
||||
// Use password auth with default password
|
||||
packet.cmd = HTUF_82xx;
|
||||
memcpy(packet.pwd, "\x00\x00\x00\x00", HITAG_PASSWORD_SIZE);
|
||||
// memcpy(packet.pwd, "\x9A\xC4\x99\x9C", HITAGU_BLOCK_SIZE);
|
||||
|
||||
for (size_t step = 0; step < 3; step++) {
|
||||
switch (step) {
|
||||
case 0: {
|
||||
// Configure datarate based on clock
|
||||
// clk -> datarate
|
||||
// 64 -> 0x00 2 kBit/s
|
||||
// 32 -> 0x01 4 kBit/s
|
||||
// 16 -> 0x10 8 kBit/s
|
||||
hitagu82xx_config_t config = {0};
|
||||
|
||||
config.datarate_override = 0x00; // no datarate override
|
||||
config.encoding = 0x00; // Manchester
|
||||
config.ttf_mode = 0x01; // 01 = "Block 0, Block 1"
|
||||
config.ttf = 0x01; // enable TTF
|
||||
|
||||
switch (clk) {
|
||||
case 64:
|
||||
break;
|
||||
case 32:
|
||||
config.datarate = 0x01;
|
||||
break;
|
||||
case 16:
|
||||
config.datarate = 0x02;
|
||||
break;
|
||||
}
|
||||
packet.data[0] = reflect8(*(uint8_t*)&config);
|
||||
packet.page = HITAGU_CONFIG_PADR; // Config block
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
memcpy(packet.data, &data[HITAGU_BLOCK_SIZE * 0], HITAGU_BLOCK_SIZE);
|
||||
packet.page = 0; // Start writing EM410x data
|
||||
break;
|
||||
case 2:
|
||||
memcpy(packet.data, &data[HITAGU_BLOCK_SIZE * 1], HITAGU_BLOCK_SIZE);
|
||||
packet.page = 1; // Continue with second block
|
||||
break;
|
||||
}
|
||||
|
||||
SendCommandNG(CMD_LF_HITAGU_WRITE, (uint8_t *)&packet, sizeof(packet));
|
||||
if (WaitForResponseTimeout(CMD_LF_HITAGU_WRITE, &resp, 4000) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
if (resp.status != PM3_ENODATA && resp.status != PM3_SUCCESS) {
|
||||
PrintAndLogEx(WARNING, "Something went wrong in step %zu, retrying... Press " _GREEN_("<Enter>") " to exit", step);
|
||||
// 8265 Often fails during continuous command execution, need to retry
|
||||
if (kbd_enter_pressed()) {
|
||||
PrintAndLogEx(INFO, "Button pressed, user aborted");
|
||||
return PM3_EOPABORTED;
|
||||
}
|
||||
|
||||
step--;
|
||||
continue;
|
||||
}
|
||||
//TODO: fix this
|
||||
resp.status = PM3_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
struct {
|
||||
bool Q5;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
// Low frequency Hitag support
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "cmdlfhitag.h"
|
||||
#include "cmdlfhitaghts.h"
|
||||
#include "cmdlfhitagu.h"
|
||||
#include <ctype.h>
|
||||
#include "cmdparser.h" // command_t
|
||||
#include "comms.h"
|
||||
@@ -31,7 +33,6 @@
|
||||
#include "pm3_cmd.h" // return codes
|
||||
#include "hitag2/hitag2_crypto.h"
|
||||
#include "util_posix.h" // msclock
|
||||
#include "cmdlfhitaghts.h"
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
@@ -2458,6 +2459,7 @@ static command_t CommandTable[] = {
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"list", CmdLFHitagList, AlwaysAvailable, "List Hitag trace history"},
|
||||
{"hts", CmdLFHitagS, AlwaysAvailable, "{ Hitag S/8211 operations }"},
|
||||
{"htu", CmdLFHitagU, AlwaysAvailable, "{ Hitag µ/8265 operations }"},
|
||||
{"-----------", CmdHelp, IfPm3Hitag, "------------------------ " _CYAN_("General") " ------------------------"},
|
||||
{"info", CmdLFHitagInfo, IfPm3Hitag, "Hitag 2 tag information"},
|
||||
{"reader", CmdLFHitagReader, IfPm3Hitag, "Act like a Hitag 2 reader"},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// See LICENSE.txt for the text of the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Low frequency Hitag µ support
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef CMDLFHITAGU_H__
|
||||
#define CMDLFHITAGU_H__
|
||||
|
||||
#include "common.h"
|
||||
#include "hitag.h"
|
||||
|
||||
uint8_t hitagu_CRC_check(uint8_t *d, uint32_t nbit);
|
||||
void annotateHitagU(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, bool is_response);
|
||||
|
||||
int CmdLFHitagU(const char *Cmd);
|
||||
|
||||
int read_htu_uid(void);
|
||||
|
||||
#endif //CMDLFHITAGU_H__
|
||||
+16
-5
@@ -29,6 +29,7 @@
|
||||
#include "fileutils.h" // for saveFile
|
||||
#include "cmdlfhitag.h" // annotate hitag
|
||||
#include "cmdlfhitaghts.h" // annotate hitags
|
||||
#include "cmdlfhitagu.h" // annotate hitagu
|
||||
#include "pm3_cmd.h" // tracelog_hdr_t
|
||||
#include "cliparser.h" // args..
|
||||
|
||||
@@ -586,8 +587,12 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
case PROTO_HITAG1:
|
||||
case PROTO_HITAGS:
|
||||
crcStatus = hitag1_CRC_check(frame, (data_len * 8) - ((8 - parityBytes[0]) % 8));
|
||||
case PROTO_CRYPTORF:
|
||||
break;
|
||||
case PROTO_HITAGU:
|
||||
crcStatus = hitagu_CRC_check(frame, (data_len * 8) - ((8 - parityBytes[0]) % 8));
|
||||
break;
|
||||
case PROTO_HITAG2:
|
||||
case PROTO_CRYPTORF:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -625,6 +630,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
&& protocol != PROTO_HITAG1
|
||||
&& protocol != PROTO_HITAG2
|
||||
&& protocol != PROTO_HITAGS
|
||||
&& protocol != PROTO_HITAGU
|
||||
&& protocol != THINFILM
|
||||
&& protocol != FELICA
|
||||
&& protocol != LTO
|
||||
@@ -647,7 +653,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
snprintf(line[j / 18] + ((j % 18) * 4), 120, "%02X! ", frame[j]);
|
||||
}
|
||||
|
||||
} else if (((protocol == PROTO_HITAG1) || (protocol == PROTO_HITAG2) || (protocol == PROTO_HITAGS))) {
|
||||
} else if (((protocol == PROTO_HITAG1) || (protocol == PROTO_HITAG2) || (protocol == PROTO_HITAGS) || (protocol == PROTO_HITAGU))) {
|
||||
|
||||
if (j == 0) {
|
||||
|
||||
@@ -803,6 +809,9 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
case PROTO_HITAGS:
|
||||
annotateHitagS(explanation, sizeof(explanation), frame, (data_len * 8) - ((8 - parityBytes[0]) % 8), hdr->isResponse);
|
||||
break;
|
||||
case PROTO_HITAGU:
|
||||
annotateHitagU(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||
break;
|
||||
case ICLASS:
|
||||
annotateIclass(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||
break;
|
||||
@@ -1314,6 +1323,7 @@ int CmdTraceList(const char *Cmd) {
|
||||
"trace list -t hitag1 -> interpret as " _YELLOW_("Hitag 1") "\n"
|
||||
"trace list -t hitag2 -> interpret as " _YELLOW_("Hitag 2") "\n"
|
||||
"trace list -t hitags -> interpret as " _YELLOW_("Hitag S") "\n"
|
||||
"trace list -t hitagu -> interpret as " _YELLOW_("Hitag µ") "\n"
|
||||
"trace list -t iclass -> interpret as " _YELLOW_("iCLASS") "\n"
|
||||
"trace list -t legic -> interpret as " _YELLOW_("LEGIC") "\n"
|
||||
"trace list -t lto -> interpret as " _YELLOW_("LTO-CM") "\n"
|
||||
@@ -1381,6 +1391,7 @@ int CmdTraceList(const char *Cmd) {
|
||||
else if (strcmp(type, "hitag1") == 0) protocol = PROTO_HITAG1;
|
||||
else if (strcmp(type, "hitag2") == 0) protocol = PROTO_HITAG2;
|
||||
else if (strcmp(type, "hitags") == 0) protocol = PROTO_HITAGS;
|
||||
else if (strcmp(type, "hitagu") == 0) protocol = PROTO_HITAGU;
|
||||
else if (strcmp(type, "iclass") == 0) protocol = ICLASS;
|
||||
else if (strcmp(type, "legic") == 0) protocol = LEGIC;
|
||||
else if (strcmp(type, "lto") == 0) protocol = LTO;
|
||||
@@ -1470,8 +1481,8 @@ int CmdTraceList(const char *Cmd) {
|
||||
if (protocol == ISO_7816_4)
|
||||
PrintAndLogEx(INFO, _YELLOW_("ISO7816-4 / Smartcard") " - Timings n/a");
|
||||
|
||||
if (protocol == PROTO_HITAG1 || protocol == PROTO_HITAG2 || protocol == PROTO_HITAGS) {
|
||||
PrintAndLogEx(INFO, _YELLOW_("Hitag 1 / Hitag 2 / Hitag S") " - Timings in ETU (8us)");
|
||||
if (protocol == PROTO_HITAG1 || protocol == PROTO_HITAG2 || protocol == PROTO_HITAGS || protocol == PROTO_HITAGU) {
|
||||
PrintAndLogEx(INFO, _YELLOW_("Hitag 1 / Hitag 2 / Hitag S / Hitag µ") " - Timings in ETU (8us)");
|
||||
}
|
||||
|
||||
if (protocol == PROTO_FMCOS20) {
|
||||
@@ -1552,7 +1563,7 @@ int CmdTraceList(const char *Cmd) {
|
||||
}
|
||||
|
||||
// reset hitag state machine
|
||||
if (protocol == PROTO_HITAG1 || protocol == PROTO_HITAG2 || protocol == PROTO_HITAGS) {
|
||||
if (protocol == PROTO_HITAG1 || protocol == PROTO_HITAG2 || protocol == PROTO_HITAGS || protocol == PROTO_HITAGU) {
|
||||
annotateHitag2_init();
|
||||
}
|
||||
|
||||
|
||||
+9
-4
@@ -142,12 +142,17 @@ uint16_t update_crc16(uint16_t crc, uint8_t c) {
|
||||
}
|
||||
|
||||
// two ways. msb or lsb loop.
|
||||
uint16_t Crc16(uint8_t const *d, size_t length, uint16_t remainder, uint16_t polynomial, bool refin, bool refout) {
|
||||
if (length == 0)
|
||||
uint16_t Crc16(uint8_t const *d, size_t bitlength, uint16_t remainder, uint16_t polynomial, bool refin, bool refout) {
|
||||
if (bitlength == 0)
|
||||
return (~remainder);
|
||||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
uint8_t c = d[i];
|
||||
uint8_t offset = 8 - (bitlength % 8);
|
||||
// front padding with 0s won't change the CRC result
|
||||
uint8_t prebits = 0;
|
||||
for (uint32_t i = 0; i < (bitlength + 7) / 8; ++i) {
|
||||
uint8_t c = prebits | d[i] >> offset;
|
||||
prebits = d[i] << (8 - offset);
|
||||
|
||||
if (refin) c = reflect8(c);
|
||||
|
||||
// xor in at msb
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ typedef enum {
|
||||
|
||||
uint16_t update_crc16_ex(uint16_t crc, uint8_t c, uint16_t polynomial);
|
||||
uint16_t update_crc16(uint16_t crc, uint8_t c);
|
||||
uint16_t Crc16(uint8_t const *d, size_t length, uint16_t remainder, uint16_t polynomial, bool refin, bool refout);
|
||||
uint16_t Crc16(uint8_t const *d, size_t bitlength, uint16_t remainder, uint16_t polynomial, bool refin, bool refout);
|
||||
|
||||
uint16_t Crc16ex(CrcType_t ct, const uint8_t *d, size_t n);
|
||||
void compute_crc(CrcType_t ct, const uint8_t *d, size_t n, uint8_t *first, uint8_t *second);
|
||||
|
||||
@@ -155,14 +155,20 @@ This is the cheapest and most common ID82xx chip available. It is usually sold a
|
||||
|
||||
#### Characteristics
|
||||
|
||||
* Chip is likely a cut down version of Hitag μ (micro) clone
|
||||
* Chip is likely a cut down version of Hitag µ (micro) clone
|
||||
* UID `00 00 00 00 00 00`
|
||||
* Password protection (4b), usually "00000000"(default) or "9AC4999C"(FURUI)
|
||||
* CON0
|
||||
* bit 0-1 -> data rate ’00’... 2kbit/s ’01’... 4kbit/s ’10’... 8kbit/s ’11’... 2kbit/s
|
||||
* bit 2 when set, fixed to MC 2kbit/s
|
||||
* bit 3-6 reversed? all blocks always read without password and write with password
|
||||
* bit 7 -> enable TTF
|
||||
* Config block 0xFF
|
||||
* Byte0
|
||||
* bit 0-1 : Data Rate. ’00’ -> 2kbit/s, ’01’ -> 4kbit/s, ’10’ -> 8kbit/s, ’11’ -> 2kbit/s
|
||||
* bit 2 : 1 -> fixed to 2kbit/s
|
||||
* bit 3 : 0 -> Manchester, 1 -> Bi-phase
|
||||
* bit 4 : TTF blocks. 0 -> "Block 0, Block 1, Block 2, Block 3", 1 -> "Block 0, Block 1"
|
||||
* bit 5-6 : reversed? all blocks always read without password and write with password
|
||||
* bit 7 : 1 -> enable TTF
|
||||
* Byte1 only bit 0 changable
|
||||
* Byte2 fixed 0x00
|
||||
* Byte3 only higher nibble changable
|
||||
* Currently unimplemented in proxmark3 client
|
||||
* Other names:
|
||||
* ID8210 (CN)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user