mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 14:23:50 -07:00
Merge branch 'RfidResearchGroup:master' into fix_lf_bps
This commit is contained in:
commit
7e8ffb46b7
13 changed files with 374 additions and 121 deletions
|
@ -3,6 +3,7 @@ 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 `hf tesla info` - intital information command to read TESLA cards (@iceman1001)
|
||||
- Changed `hf emrtd info` - looking for lower case .bin extensions (@iceman1001)
|
||||
- Changed `hf emrtd dump` - looking for lower case .bin extensions (@iceman1001)
|
||||
- Changed `lf paradox clone` - it now accepts FC/CN (@mwalker33)
|
||||
|
@ -1367,3 +1368,5 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
|
|||
### Added
|
||||
- iClass functionality: full simulation of iclass tags, so tags can be simulated with data (not only CSN). Not yet support for write/update, but readers do not seem to enforce update. (@holiman).
|
||||
- iClass decryption. Proxmark can now decrypt data on an iclass tag, but requires you to have the HID decryption key locally on your computer, as this is not bundled with the sourcecode.
|
||||
- `hf 15 info` can detect NTAG 5 tags
|
||||
- `hf 15 info` include an EAS status check on more of the icode tags which support EAS (SLI, SLIX, SLIX-L, and SLIX-S)
|
|
@ -83,7 +83,7 @@ We define generic Proxmark3 platforms as following devices.
|
|||
- **Note**: unknown pin assignments.
|
||||
- ⚠ Ryscorp Proxmark3 Pro
|
||||
- **Note**: device has different fpga and unknown pin assignments.
|
||||
- **Note**: Company have dissappared, leaving their customers in the dark.
|
||||
- **Note**: Company have disappeared, leaving their customers in the dark.
|
||||
- ⚠ iCopy-X
|
||||
- **Note**: experimental support, currently incompatible with iCopy-X GUI as Proxmark client commands are now using cliparser.
|
||||
- **Note**: see also [icopyx-community repos](https://github.com/iCopy-X-Community/) for upstream sources, reversed hw etc.
|
||||
|
|
|
@ -59,6 +59,9 @@ define KNOWN_STANDALONE_DEFINITIONS
|
|||
| LF_PROXBRUTE | HID ProxII bruteforce |
|
||||
| | - Brad Antoniewicz |
|
||||
+----------------------------------------------------------+
|
||||
| LF_PROX2BRUTE | HID ProxII bruteforce v2 |
|
||||
| | |
|
||||
+----------------------------------------------------------+
|
||||
| LF_SAMYRUN | HID26 read/clone/sim |
|
||||
| (default) | - Samy Kamkar |
|
||||
+----------------------------------------------------------+
|
||||
|
@ -121,7 +124,8 @@ define KNOWN_STANDALONE_DEFINITIONS
|
|||
+----------------------------------------------------------+
|
||||
endef
|
||||
|
||||
STANDALONE_MODES := LF_SKELETON LF_EM4100EMUL LF_EM4100RSWB LF_EM4100RSWW LF_EM4100RWC LF_HIDBRUTE LF_HIDFCBRUTE LF_ICEHID LF_PROXBRUTE LF_SAMYRUN LF_THAREXDE LF_NEXID LF_NEDAP_SIM
|
||||
|
||||
STANDALONE_MODES := LF_SKELETON LF_EM4100EMUL LF_EM4100RSWB LF_EM4100RSWW LF_EM4100RWC LF_HIDBRUTE LF_HIDFCBRUTE LF_ICEHID LF_PROXBRUTE LF_PROX2BRUTE LF_SAMYRUN LF_THAREXDE LF_NEXID LF_NEDAP_SIM
|
||||
STANDALONE_MODES += HF_14ASNIFF HF_14BSNIFF HF_15SNIFF HF_AVEFUL HF_BOG HF_COLIN HF_CRAFTBYTE HF_ICECLASS HF_LEGIC HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_TCPRST HF_TMUDFORD HF_YOUNG HF_REBLAY DANKARMULTI
|
||||
STANDALONE_MODES_REQ_BT := HF_REBLAY
|
||||
STANDALONE_MODES_REQ_SMARTCARD :=
|
||||
|
|
|
@ -29,6 +29,10 @@ endif
|
|||
ifneq (,$(findstring WITH_STANDALONE_LF_PROXBRUTE,$(APP_CFLAGS)))
|
||||
SRC_STANDALONE = lf_proxbrute.c
|
||||
endif
|
||||
# WITH_STANDALONE_LF_PROX2BRUTE
|
||||
ifneq (,$(findstring WITH_STANDALONE_LF_PROX2BRUTE,$(APP_CFLAGS)))
|
||||
SRC_STANDALONE = lf_prox2brute.c
|
||||
endif
|
||||
# WITH_STANDALONE_LF_HIDBRUTE
|
||||
ifneq (,$(findstring WITH_STANDALONE_LF_HIDBRUTE,$(APP_CFLAGS)))
|
||||
SRC_STANDALONE = lf_hidbrute.c
|
||||
|
|
108
armsrc/Standalone/lf_prox2brute.c
Normal file
108
armsrc/Standalone/lf_prox2brute.c
Normal file
|
@ -0,0 +1,108 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) Brad Antoniewicz 2011
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
// LF HID ProxII Brutforce v2 by lnv42 - based on Proxbrute by Brad antoniewicz
|
||||
//
|
||||
// Following code is a trivial brute forcer for when you know the facility
|
||||
// code and want to find valid(s) card number(s). It will try all card
|
||||
// fnumbers rom CARDNUM_START to CARDNUM_END one by one (max. ~65k tries).
|
||||
// This brute force will be a lot faster than Proxbrute that will try all
|
||||
// possibles values for LF low, even those with bad checksum (~4g tries).
|
||||
// LEDs will help you know which card number(s) worked.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "standalone.h" // standalone definitions
|
||||
#include "proxmark3_arm.h"
|
||||
#include "appmain.h"
|
||||
#include "fpgaloader.h"
|
||||
#include "util.h"
|
||||
#include "dbprint.h"
|
||||
#include "lfops.h"
|
||||
#include "parity.h"
|
||||
|
||||
#define CARDNUM_START 0
|
||||
#define CARDNUM_END 0xFFFF
|
||||
#define FACILITY_CODE 2
|
||||
|
||||
void ModInfo(void) {
|
||||
DbpString(" LF HID ProxII bruteforce v2");
|
||||
}
|
||||
|
||||
// samy's sniff and repeat routine for LF
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> LF HID proxII bruteforce v2 a.k.a Prox2Brute Started <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
|
||||
const uint32_t high = 0x20; // LF high value is always 0x20 here
|
||||
uint32_t low = 0;
|
||||
|
||||
uint32_t fac = FACILITY_CODE, cardnum = 0;
|
||||
|
||||
LED_D_ON();
|
||||
while (BUTTON_HELD(200) != BUTTON_HOLD) { // Waiting for a 200ms button press
|
||||
WDT_HIT();
|
||||
// exit from SamyRun, send a usbcommand.
|
||||
if (data_available()) { // early exit
|
||||
DbpString("[=] You can take the shell back :) ...");
|
||||
LEDsoff();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LED_C_ON();
|
||||
WAIT_BUTTON_RELEASED(); // We are now ready to start brutforcing card numbers
|
||||
LEDsoff();
|
||||
|
||||
Dbprintf("[=] Starting HID ProxII Bruteforce from card %08x to %08x",
|
||||
CARDNUM_START, MIN(CARDNUM_END, 0xFFFF));
|
||||
|
||||
for (cardnum = CARDNUM_START ; cardnum <= MIN(CARDNUM_END, 0xFFFF) ; cardnum++) {
|
||||
WDT_HIT();
|
||||
|
||||
// exit from SamyRun, send a usbcommand.
|
||||
if (data_available()) break;
|
||||
|
||||
// short button press may be used for fast-forward
|
||||
if (BUTTON_HELD(1000) == BUTTON_HOLD) break; // long button press (>=1sec) exit
|
||||
|
||||
// calculate the new LF low value including Card number, Facility code and checksum
|
||||
low = (cardnum << 1) | (fac << 17);
|
||||
low |= oddparity32((low >> 1) & 0xFFF);
|
||||
low |= evenparity32((low >> 13) & 0xFFF) << 25;
|
||||
|
||||
Dbprintf("[=] trying Facility = %08x, Card = %08x, raw = %08x%08x",
|
||||
fac, cardnum, high, low);
|
||||
|
||||
// Start simulating an HID TAG, with high/low values, no led control and 20000 cycles timeout
|
||||
CmdHIDsimTAGEx(0, high, low, 0, false, 20000);
|
||||
|
||||
// switch leds to be able to know (aproximatly) which card number worked (64 tries loop)
|
||||
LED_A_INV(); // switch led A every try
|
||||
if ((cardnum-CARDNUM_START) % 8 == 7) // switch led B every 8 tries
|
||||
LED_B_INV();
|
||||
if ((cardnum-CARDNUM_START) % 16 == 15) // switch led C every 16 tries
|
||||
LED_C_INV();
|
||||
if ((cardnum-CARDNUM_START) % 32 == 31) // switch led D every 32 tries
|
||||
LED_D_INV();
|
||||
}
|
||||
|
||||
SpinErr((LED_A | LED_B | LED_C | LED_D), 250, 5); // Xmax tree
|
||||
Dbprintf("[=] Ending HID ProxII Bruteforce from card %08x to %08x",
|
||||
CARDNUM_START, cardnum - 1);
|
||||
DbpString("[=] You can take the shell back :) ...");
|
||||
LEDsoff(); // This is the end
|
||||
}
|
|
@ -39,14 +39,14 @@
|
|||
|
||||
typedef struct {
|
||||
uint8_t *buffer;
|
||||
uint8_t numbits;
|
||||
uint8_t position;
|
||||
uint32_t numbits;
|
||||
uint32_t position;
|
||||
} BitstreamIn_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t *buffer;
|
||||
uint8_t numbits;
|
||||
uint8_t position;
|
||||
uint32_t numbits;
|
||||
uint32_t position;
|
||||
} BitstreamOut_t;
|
||||
|
||||
bool headBit(BitstreamIn_t *stream);
|
||||
|
|
|
@ -1909,3 +1909,79 @@ D144BD193063
|
|||
# Keys Swim
|
||||
8627C10A7014
|
||||
453857395635
|
||||
#
|
||||
##########################################
|
||||
# added by colonelborkmundus
|
||||
# "the more, the marriott" mifare project
|
||||
#
|
||||
# 1k - graduate hotel
|
||||
C49DAE1C6049
|
||||
209A2B910545
|
||||
#
|
||||
# 1k - westin
|
||||
8C29F8320617
|
||||
5697519A8F02
|
||||
7D0A1C277C05
|
||||
2058580A941F
|
||||
C40964215509
|
||||
D44CFC178460
|
||||
#
|
||||
# 1k - marriott
|
||||
7B4DFC6D6525
|
||||
23C9FDD9A366
|
||||
3119A70628EB
|
||||
30AAD6A711EF
|
||||
1330824CD356
|
||||
43012BD9EB87
|
||||
035C70558D7B
|
||||
9966588CB9A0
|
||||
12AB4C37BB8B
|
||||
#
|
||||
# 1k - AC hotels marriott
|
||||
8EA8EC3F2320
|
||||
7B56B2B38725
|
||||
#
|
||||
# 1k - the ritz-carlton
|
||||
30FB20D0EFEF
|
||||
D20289CD9E6E
|
||||
66A3B064CC4B
|
||||
D18296CD9E6E
|
||||
#
|
||||
# 1k - unknown
|
||||
722538817225
|
||||
#
|
||||
# 1k - aria resort & casino
|
||||
316B8FAA12EF
|
||||
A18D9F4E75AF
|
||||
#
|
||||
# 1k - fairfield inn & suites marriott
|
||||
7AEB989A5525
|
||||
7B3B589A5525
|
||||
215E9DED9DDF
|
||||
334E91BE3377
|
||||
310308EC52EF
|
||||
#
|
||||
# 1k - residence inn marriott
|
||||
F72CD208FDF9
|
||||
#
|
||||
# 1k - sheraton
|
||||
42FC522DE987
|
||||
#
|
||||
# 1k - millenium hotels
|
||||
132F641C948B
|
||||
#
|
||||
# 1k - moxy hotels
|
||||
20C166C00ADB
|
||||
9EE3896C4530
|
||||
#
|
||||
# 1k - residence inn marriott
|
||||
3122AE5341EB
|
||||
#
|
||||
# 1k - americinn
|
||||
8AC04C1A4A25
|
||||
#
|
||||
# 1k - the industrialist
|
||||
2158E314C3DF
|
||||
#
|
||||
# 1k - waldorf astoria
|
||||
011C6CF459E8
|
|
@ -99,6 +99,7 @@ static const productName_t uidmapping[] = {
|
|||
//I-Code SLIX-L [IC id = 03 + bit36 set to 1]
|
||||
{ 0xE004000000000000LL, 16, "NXP Semiconductors Germany (Philips)" },
|
||||
{ 0xE004010000000000LL, 24, "NXP(Philips); IC SL2 ICS20/ICS21(SLI) ICS2002/ICS2102(SLIX) ICS2602(SLIX2)" },
|
||||
{ 0xE004011800000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC NTP53x2/NTP5210/NTA5332(NTAG 5)" },
|
||||
{ 0xE004010000000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS20/ICS21(SLI)" },
|
||||
{ 0xE004011000000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS2002/ICS2102(SLIX)" },
|
||||
{ 0xE004010800000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS2602(SLIX2)" },
|
||||
|
@ -651,6 +652,95 @@ static int CmdHF15Samples(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int NxpTestEAS(uint8_t *uid)
|
||||
{
|
||||
uint8_t fast = 1;
|
||||
uint8_t reply = 1;
|
||||
PacketResponseNG resp;
|
||||
uint16_t reqlen = 0;
|
||||
uint8_t req[PM3_CMD_DATA_SIZE] = {0};
|
||||
|
||||
req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
||||
req[reqlen++] = ISO15693_EAS_ALARM;
|
||||
req[reqlen++] = 0x04; // IC manufacturer code
|
||||
memcpy(req + 3, uid, 8); // add UID
|
||||
reqlen += 8;
|
||||
|
||||
AddCrc15(req, reqlen);
|
||||
reqlen += 2;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen);
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||
PrintAndLogEx(WARNING, "iso15693 timeout");
|
||||
} else {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
|
||||
if (resp.length < 2) {
|
||||
PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is not active");
|
||||
} else {
|
||||
uint8_t * recv = resp.data.asBytes;
|
||||
|
||||
if (!(recv[0] & ISO15_RES_ERROR)) {
|
||||
PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is active.");
|
||||
PrintAndLogEx(INFO, " EAS sequence: %s", sprint_hex(recv + 1, 32));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int NxpCheckSig(uint8_t *uid) {
|
||||
uint8_t fast = 1;
|
||||
uint8_t reply = 1;
|
||||
PacketResponseNG resp;
|
||||
uint16_t reqlen = 0;
|
||||
uint8_t req[PM3_CMD_DATA_SIZE] = {0};
|
||||
|
||||
// Check if we can also read the signature
|
||||
req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
||||
req[reqlen++] = ISO15693_READ_SIGNATURE;
|
||||
req[reqlen++] = 0x04; // IC manufacturer code
|
||||
memcpy(req + 3, uid, 8); // add UID
|
||||
reqlen += 8;
|
||||
|
||||
AddCrc15(req, reqlen);
|
||||
reqlen += 2;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen);
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||
PrintAndLogEx(WARNING, "iso15693 timeout");
|
||||
DropField();
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
DropField();
|
||||
|
||||
if (resp.length < 2) {
|
||||
PrintAndLogEx(WARNING, "iso15693 card doesn't answer to READ SIGNATURE command");
|
||||
return PM3_EWRONGANSWER;
|
||||
}
|
||||
|
||||
uint8_t *recv = resp.data.asBytes;
|
||||
|
||||
if ((recv[0] & ISO15_RES_ERROR) == ISO15_RES_ERROR) {
|
||||
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
|
||||
return PM3_EWRONGANSWER;
|
||||
}
|
||||
|
||||
uint8_t signature[32] = {0x00};
|
||||
memcpy(signature, recv + 1, 32);
|
||||
|
||||
nxp_15693_print_signature(uid, signature);
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// Get NXP system information from SLIX2 tag/VICC
|
||||
static int NxpSysInfo(uint8_t *uid) {
|
||||
|
||||
|
@ -732,77 +822,11 @@ static int NxpSysInfo(uint8_t *uid) {
|
|||
PrintAndLogEx(INFO, " * Additional 32 bits feature flags are%s transmitted", ((recv[5] & 0x80) ? "" : " not"));
|
||||
|
||||
if (support_easmode) {
|
||||
reqlen = 0;
|
||||
req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
||||
req[reqlen++] = ISO15693_EAS_ALARM;
|
||||
req[reqlen++] = 0x04; // IC manufacturer code
|
||||
memcpy(req + 3, uid, 8); // add UID
|
||||
reqlen += 8;
|
||||
|
||||
AddCrc15(req, reqlen);
|
||||
reqlen += 2;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen);
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||
PrintAndLogEx(WARNING, "iso15693 timeout");
|
||||
} else {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
|
||||
if (resp.length < 2) {
|
||||
PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is not active");
|
||||
} else {
|
||||
recv = resp.data.asBytes;
|
||||
|
||||
if (!(recv[0] & ISO15_RES_ERROR)) {
|
||||
PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is active.");
|
||||
PrintAndLogEx(INFO, " EAS sequence: %s", sprint_hex(recv + 1, 32));
|
||||
}
|
||||
}
|
||||
}
|
||||
NxpTestEAS(uid);
|
||||
}
|
||||
|
||||
if (support_signature) {
|
||||
// Check if we can also read the signature
|
||||
reqlen = 0;
|
||||
req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
||||
req[reqlen++] = ISO15693_READ_SIGNATURE;
|
||||
req[reqlen++] = 0x04; // IC manufacturer code
|
||||
memcpy(req + 3, uid, 8); // add UID
|
||||
reqlen += 8;
|
||||
|
||||
AddCrc15(req, reqlen);
|
||||
reqlen += 2;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen);
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||
PrintAndLogEx(WARNING, "iso15693 timeout");
|
||||
DropField();
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
DropField();
|
||||
|
||||
if (resp.length < 2) {
|
||||
PrintAndLogEx(WARNING, "iso15693 card doesn't answer to READ SIGNATURE command");
|
||||
return PM3_EWRONGANSWER;
|
||||
}
|
||||
|
||||
recv = resp.data.asBytes;
|
||||
|
||||
if ((recv[0] & ISO15_RES_ERROR) == ISO15_RES_ERROR) {
|
||||
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
|
||||
return PM3_EWRONGANSWER;
|
||||
}
|
||||
|
||||
uint8_t signature[32] = {0x00};
|
||||
memcpy(signature, recv + 1, 32);
|
||||
|
||||
nxp_15693_print_signature(uid, signature);
|
||||
NxpCheckSig(uid);
|
||||
}
|
||||
|
||||
return PM3_SUCCESS;
|
||||
|
@ -945,6 +969,16 @@ static int CmdHF15Info(const char *Cmd) {
|
|||
PrintAndLogEx(DEBUG, "SLIX2 Detected, getting NXP System Info");
|
||||
return NxpSysInfo(uid);
|
||||
}
|
||||
else if(data[8] == 0x04 && data[7] == 0x01 && nxp_version == 0x18) //If it is an NTAG 5
|
||||
{
|
||||
PrintAndLogEx(DEBUG, "NTAG 5 Detected, getting NXP System Info");
|
||||
return NxpSysInfo(uid);
|
||||
}
|
||||
else if(data[8] == 0x04 && (data[7] == 0x01 || data[7] == 0x02 || data[7] == 0x03)) //If SLI, SLIX, SLIX-l, or SLIX-S check EAS status
|
||||
{
|
||||
PrintAndLogEx(DEBUG, "SLI, SLIX, SLIX-L, or SLIX-S Detected checking EAS status");
|
||||
return NxpTestEAS(uid);
|
||||
}
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
|
|
|
@ -971,6 +971,11 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
|||
for (blockNo = 0; blockNo < mfNumBlocksPerSector(sectorNo); blockNo++) {
|
||||
bool received = false;
|
||||
current_key = MF_KEY_A;
|
||||
uint8_t data_area = (sectorNo < 32) ? blockNo : blockNo / 5;
|
||||
if (rights[sectorNo][data_area] == 0x07) { // no key would work
|
||||
PrintAndLogEx(WARNING, "access rights do not allow reading of sector %2d block %3d, skipping", sectorNo, blockNo);
|
||||
continue;
|
||||
}
|
||||
for (tries = 0; tries < MIFARE_SECTOR_RETRY; tries++) {
|
||||
if (blockNo == mfNumBlocksPerSector(sectorNo) - 1) { // sector trailer. At least the Access Conditions can always be read with key A.
|
||||
|
||||
|
@ -982,7 +987,6 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
|||
SendCommandNG(CMD_HF_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
|
||||
received = WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500);
|
||||
} else { // data block. Check if it can be read with key A or key B
|
||||
uint8_t data_area = (sectorNo < 32) ? blockNo : blockNo / 5;
|
||||
if ((rights[sectorNo][data_area] == 0x03) || (rights[sectorNo][data_area] == 0x05)) { // only key B would work
|
||||
|
||||
payload.blockno = mfFirstBlockOfSector(sectorNo) + blockNo;
|
||||
|
@ -992,10 +996,6 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
|||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
|
||||
received = WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500);
|
||||
} else if (rights[sectorNo][data_area] == 0x07) { // no key would work
|
||||
PrintAndLogEx(WARNING, "access rights do not allow reading of sector %2d block %3d", sectorNo, blockNo);
|
||||
// where do you want to go?? Next sector or block?
|
||||
break;
|
||||
} else { // key A would work
|
||||
|
||||
payload.blockno = mfFirstBlockOfSector(sectorNo) + blockNo;
|
||||
|
@ -1044,11 +1044,9 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, "successfully read block %2d of sector %2d.", blockNo, sectorNo);
|
||||
} else {
|
||||
PrintAndLogEx(FAILED, "could not read block %2d of sector %2d", blockNo, sectorNo);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
PrintAndLogEx(WARNING, "command execute timeout when trying to read block %2d of sector %2d.", blockNo, sectorNo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,26 +64,36 @@ static int info_hf_tesla(void) {
|
|||
param_gethex_to_eol("00a404000a7465736c614c6f676963", 0, aSELECT_AID, sizeof(aSELECT_AID), &aSELECT_AID_n);
|
||||
int res = ExchangeAPDU14a(aSELECT_AID, aSELECT_AID_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
|
||||
if (res != PM3_SUCCESS) {
|
||||
DropField();
|
||||
return res;
|
||||
}
|
||||
|
||||
if (resplen < 2) {
|
||||
DropField();
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
uint16_t sw = get_sw(response, resplen);
|
||||
if (sw != ISO7816_OK) {
|
||||
PrintAndLogEx(ERR, "Selecting TESLA aid failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||
DropField();
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
activate_field = false;
|
||||
uint16_t sw = get_sw(response, resplen);
|
||||
|
||||
if ((resplen < 2) || (sw != ISO7816_OK)) {
|
||||
|
||||
param_gethex_to_eol("00a404000af465736c614c6f676963", 0, aSELECT_AID, sizeof(aSELECT_AID), &aSELECT_AID_n);
|
||||
res = ExchangeAPDU14a(aSELECT_AID, aSELECT_AID_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
|
||||
if (res != PM3_SUCCESS) {
|
||||
DropField();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if ((resplen < 2) || (sw != ISO7816_OK)) {
|
||||
PrintAndLogEx(ERR, "Selecting TESLA aid failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||
// DropField();
|
||||
// return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
keep_field_on = true;
|
||||
|
||||
|
||||
// --------------- ECDH public key file reading ----------------
|
||||
uint8_t pk[3][65] = {{0}};
|
||||
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
|
||||
uint8_t aSELECT_PK[5] = {0x80, 0x04, i, 0x00, 0x00};
|
||||
|
@ -94,12 +104,7 @@ static int info_hf_tesla(void) {
|
|||
|
||||
sw = get_sw(response, resplen);
|
||||
if (sw == ISO7816_OK) {
|
||||
// save PK for later
|
||||
uint8_t pk[65] = {0};
|
||||
memcpy(pk, response, resplen - 2);
|
||||
|
||||
PrintAndLogEx(INFO, "PUBLIC KEY # %i", i);
|
||||
PrintAndLogEx(INFO, "%s", sprint_hex_inrow(pk, sizeof(pk)));
|
||||
memcpy(pk[i], response, resplen - 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,21 +191,33 @@ static int info_hf_tesla(void) {
|
|||
memcpy(auth, response, sizeof(auth));
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "CHALL... %s", sprint_hex_inrow(auth, sizeof(auth)));
|
||||
|
||||
keep_field_on = false;
|
||||
DropField();
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
// PrintAndLogEx(INFO, "PUBLIC KEY");
|
||||
// PrintAndLogEx(INFO, "%zu - %s", sizeof(pk), sprint_hex_inrow(pk, sizeof(pk)));
|
||||
PrintAndLogEx(INFO, "Form factor");
|
||||
PrintAndLogEx(INFO, "%zu - %s", sizeof(form_factor), sprint_hex_inrow(form_factor, sizeof(form_factor)));
|
||||
PrintAndLogEx(INFO, "VERSION");
|
||||
PrintAndLogEx(INFO, "%zu - %s", sizeof(version), sprint_hex_inrow(version, sizeof(version)));
|
||||
PrintAndLogEx(INFO, "PUBLIC KEY");
|
||||
for (int i=0; i < 3; i++) {
|
||||
PrintAndLogEx(INFO, "%d - %s", i, sprint_hex_inrow(pk[i], 65));
|
||||
}
|
||||
if (form_factor[1] == 1) {
|
||||
PrintAndLogEx(INFO, "Form factor... %s (card)", sprint_hex_inrow(form_factor, sizeof(form_factor)));
|
||||
} else if (form_factor[1] == 2){
|
||||
PrintAndLogEx(INFO, "Form factor... %s (phone app)", sprint_hex_inrow(form_factor, sizeof(form_factor)));
|
||||
}
|
||||
|
||||
if (sizeof(version) > 0) {
|
||||
PrintAndLogEx(INFO, "Version....... %s", sprint_hex_inrow(version, sizeof(version)));
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "CHALL......... %s", sprint_hex_inrow(auth, sizeof(auth)));
|
||||
|
||||
PrintAndLogEx(INFO, "Fingerprint");
|
||||
if ((memcmp(pk[0], pk[1], 65) == 0)) {
|
||||
PrintAndLogEx(INFO, " GaussKey detected");
|
||||
}
|
||||
//
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ static int split(char *str, char **arr) {
|
|||
return word_cnt;
|
||||
}
|
||||
|
||||
static void set_python_path(char *path) {
|
||||
static void set_python_path(const char *path) {
|
||||
PyObject *syspath = PySys_GetObject("path");
|
||||
if (syspath == 0) {
|
||||
PrintAndLogEx(WARNING, "Python failed to getobject");
|
||||
|
@ -172,7 +172,7 @@ static void set_python_paths(void) {
|
|||
char scripts_path[strlen(exec_path) + strlen(PYTHON_SCRIPTS_SUBDIR) + strlen(PYTHON_LIBRARIES_WILDCARD) + 1];
|
||||
strcpy(scripts_path, exec_path);
|
||||
strcat(scripts_path, PYTHON_SCRIPTS_SUBDIR);
|
||||
// strcat(scripts_path, PYTHON_LIBRARIES_WILDCARD);
|
||||
// strcat(scripts_path, PYTHON_LIBRARIES_WILDCARD);
|
||||
set_python_path(scripts_path);
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ static void set_python_paths(void) {
|
|||
strcpy(scripts_path, user_path);
|
||||
strcat(scripts_path, PM3_USER_DIRECTORY);
|
||||
strcat(scripts_path, PYTHON_SCRIPTS_SUBDIR);
|
||||
// strcat(scripts_path, PYTHON_LIBRARIES_WILDCARD);
|
||||
// strcat(scripts_path, PYTHON_LIBRARIES_WILDCARD);
|
||||
set_python_path(scripts_path);
|
||||
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static void set_python_paths(void) {
|
|||
strcpy(scripts_path, exec_path);
|
||||
strcat(scripts_path, PM3_SHARE_RELPATH);
|
||||
strcat(scripts_path, PYTHON_SCRIPTS_SUBDIR);
|
||||
// strcat(scripts_path, PYTHON_LIBRARIES_WILDCARD);
|
||||
// strcat(scripts_path, PYTHON_LIBRARIES_WILDCARD);
|
||||
set_python_path(scripts_path);
|
||||
}
|
||||
}
|
||||
|
@ -407,12 +407,16 @@ static int CmdScriptRun(const char *Cmd) {
|
|||
Py_Initialize();
|
||||
#else
|
||||
PyConfig py_conf;
|
||||
PyConfig_InitIsolatedConfig(&py_conf);
|
||||
// Despite being isolated we probably want to allow users to use
|
||||
// the Python packages they installed on their user directory as well
|
||||
// as system ones. But it seems isolated mode still enforces them off.
|
||||
py_conf.use_environment = 1;
|
||||
// We need to use Python mode instead of isolated to avoid breaking stuff.
|
||||
PyConfig_InitPythonConfig(&py_conf);
|
||||
// Let's still make things bit safer by being as close as possible to isolated mode.
|
||||
py_conf.configure_c_stdio = -1;
|
||||
py_conf.faulthandler = 0;
|
||||
py_conf.use_hash_seed = 0;
|
||||
py_conf.install_signal_handlers = 0;
|
||||
py_conf.parse_argv = 0;
|
||||
py_conf.user_site_directory = 1;
|
||||
py_conf.use_environment = 0;
|
||||
#endif
|
||||
|
||||
//int argc, char ** argv
|
||||
|
@ -429,8 +433,13 @@ static int CmdScriptRun(const char *Cmd) {
|
|||
#else
|
||||
// The following line will implicitly pre-initialize Python
|
||||
PyConfig_SetBytesArgv(&py_conf, argc + 1, argv);
|
||||
|
||||
// We disallowed in py_conf environment variables interfering with python interpreter's behavior.
|
||||
// Let's manually enable the ones we truly need.
|
||||
// This is required by Proxspace to work with an isolated Python configuration
|
||||
PyConfig_SetBytesString(&py_conf, &py_conf.home, getenv("PYTHONHOME"));
|
||||
// This is required for allowing `import pm3` in python scripts
|
||||
PyConfig_SetBytesString(&py_conf, &py_conf.pythonpath_env, getenv("PYTHONPATH"));
|
||||
|
||||
Py_InitializeFromConfig(&py_conf);
|
||||
|
||||
|
|
|
@ -719,7 +719,7 @@ static int CmdSmartInfo(const char *Cmd) {
|
|||
|
||||
// print header
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Smartcard Information") " ---------");
|
||||
PrintAndLogEx(INFO, "ISO7618-3 ATR... %s", sprint_hex(card.atr, card.atr_len));
|
||||
PrintAndLogEx(INFO, "ISO7816-3 ATR... %s", sprint_hex(card.atr, card.atr_len));
|
||||
// convert bytes to str.
|
||||
char *hexstr = calloc((card.atr_len << 1) + 1, sizeof(uint8_t));
|
||||
if (hexstr == NULL) {
|
||||
|
|
|
@ -42,14 +42,14 @@
|
|||
|
||||
typedef struct {
|
||||
uint8_t *buffer;
|
||||
uint8_t numbits;
|
||||
uint8_t position;
|
||||
uint32_t numbits;
|
||||
uint32_t position;
|
||||
} BitstreamIn_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t *buffer;
|
||||
uint8_t numbits;
|
||||
uint8_t position;
|
||||
uint32_t numbits;
|
||||
uint32_t position;
|
||||
} BitstreamOut_t;
|
||||
|
||||
bool headBit(BitstreamIn_t *stream);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue