mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
Merge branch 'master' of https://github.com/RfidResearchGroup/proxmark3
This commit is contained in:
commit
61ece946e0
4 changed files with 26 additions and 25 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...
|
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]
|
## [unreleased][unreleased]
|
||||||
|
- Add colour to `lf hid` commands in cmdlfhid.c
|
||||||
- Change `script run hf_bruteforce -s start_id -e end_id -t timeout -x mifare_card_type` - The hf_bruteforce card script now requires Mifare type (mfc or mfu) (@dunderhay)
|
- Change `script run hf_bruteforce -s start_id -e end_id -t timeout -x mifare_card_type` - The hf_bruteforce card script now requires Mifare type (mfc or mfu) (@dunderhay)
|
||||||
- Updated `hf_bruteforce.lua` script - added support for brute forcing Mifare Ultralight EV1 cards (@dunderhay)
|
- Updated `hf_bruteforce.lua` script - added support for brute forcing Mifare Ultralight EV1 cards (@dunderhay)
|
||||||
- Added `hf mf personlize` - personalize the UID of a Mifare Classic EV1 card (@pwpiwi)
|
- Added `hf mf personlize` - personalize the UID of a Mifare Classic EV1 card (@pwpiwi)
|
||||||
|
|
|
@ -162,7 +162,7 @@ static int CmdHIDDemod(const char *Cmd) {
|
||||||
uint8_t bits[GraphTraceLen];
|
uint8_t bits[GraphTraceLen];
|
||||||
size_t size = getFromGraphBuf(bits);
|
size_t size = getFromGraphBuf(bits);
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID not enough samples");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - " _RED_("HID not enough samples"));
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
//get binary from fsk wave
|
//get binary from fsk wave
|
||||||
|
@ -171,17 +171,17 @@ static int CmdHIDDemod(const char *Cmd) {
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
|
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID not enough samples");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - " _RED_("HID not enough samples"));
|
||||||
else if (idx == -2)
|
else if (idx == -2)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID just noise detected");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - " _RED_("HID just noise detected"));
|
||||||
else if (idx == -3)
|
else if (idx == -3)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID problem during FSK demod");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - " _RED_("HID problem during FSK demod"));
|
||||||
else if (idx == -4)
|
else if (idx == -4)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID preamble not found");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - " _RED_("HID preamble not found"));
|
||||||
else if (idx == -5)
|
else if (idx == -5)
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error in Manchester data, size %zu", size);
|
PrintAndLogEx(DEBUG, "DEBUG: Error - " _RED_("HID error in Manchester data, size %zu"), size);
|
||||||
else
|
else
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID error demoding fsk %d", idx);
|
PrintAndLogEx(DEBUG, "DEBUG: Error - " _RED_("HID error demoding fsk %d"), idx);
|
||||||
|
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -190,12 +190,12 @@ static int CmdHIDDemod(const char *Cmd) {
|
||||||
setClockGrid(50, waveIdx + (idx * 50));
|
setClockGrid(50, waveIdx + (idx * 50));
|
||||||
|
|
||||||
if (hi2 == 0 && hi == 0 && lo == 0) {
|
if (hi2 == 0 && hi == 0 && lo == 0) {
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - HID no values found");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - " _RED_("HID no values found"));
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hi2 != 0) { //extra large HID tags
|
if (hi2 != 0) { //extra large HID tags
|
||||||
PrintAndLogEx(SUCCESS, "HID Prox TAG ID: %x%08x%08x (%u)", hi2, hi, lo, (lo >> 1) & 0xFFFF);
|
PrintAndLogEx(SUCCESS, "HID Prox TAG ID: " _GREEN_("%x%08x%08x (%u)"), hi2, hi, lo, (lo >> 1) & 0xFFFF);
|
||||||
} else { //standard HID tags <38 bits
|
} else { //standard HID tags <38 bits
|
||||||
uint8_t fmtLen = 0;
|
uint8_t fmtLen = 0;
|
||||||
uint32_t cc = 0;
|
uint32_t cc = 0;
|
||||||
|
@ -241,14 +241,14 @@ static int CmdHIDDemod(const char *Cmd) {
|
||||||
fc = ((hi & 0xF) << 12) | (lo >> 20);
|
fc = ((hi & 0xF) << 12) | (lo >> 20);
|
||||||
}
|
}
|
||||||
if (fmtLen == 32 && (lo & 0x40000000)) { //if 32 bit and Kastle bit set
|
if (fmtLen == 32 && (lo & 0x40000000)) { //if 32 bit and Kastle bit set
|
||||||
PrintAndLogEx(SUCCESS, "HID Prox TAG (Kastle format) ID: %x%08x (%u) - Format Len: 32bit - CC: %u - FC: %u - Card: %u", hi, lo, (lo >> 1) & 0xFFFF, cc, fc, cardnum);
|
PrintAndLogEx(SUCCESS, "HID Prox TAG (Kastle format) ID: " _GREEN_("%x%08x (%u)")"- Format Len: 32bit - CC: %u - FC: %u - Card: %u", hi, lo, (lo >> 1) & 0xFFFF, cc, fc, cardnum);
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(SUCCESS, "HID Prox TAG ID: %x%08x (%u) - Format Len: %ubit - OEM: %03u - FC: %u - Card: %u",
|
PrintAndLogEx(SUCCESS, "HID Prox TAG ID: " _GREEN_("%x%08x (%u)")"- Format Len: " _GREEN_("%u bit")"- OEM: %03u - FC: " _GREEN_("%u")"- Card: " _GREEN_("%u"),
|
||||||
hi, lo, cardnum, fmtLen, oem, fc, cardnum);
|
hi, lo, cardnum, fmtLen, oem, fc, cardnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: HID idx: %d, Len: %zu, Printing Demod Buffer:", idx, size);
|
PrintAndLogEx(DEBUG, "DEBUG: HID idx: %d, Len: %zu, Printing Demod Buffer: ", idx, size);
|
||||||
if (g_debugMode)
|
if (g_debugMode)
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
|
|
||||||
|
@ -288,14 +288,14 @@ static int CmdHIDSim(const char *Cmd) {
|
||||||
lo = (lo << 4) | (n & 0xf);
|
lo = (lo << 4) | (n & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Simulating HID tag with long ID %x%08x%08x", hi2, hi, lo);
|
PrintAndLogEx(INFO, "Simulating HID tag with long ID: " _GREEN_("%x%08x%08x"), hi2, hi, lo);
|
||||||
payload.longFMT = 1;
|
payload.longFMT = 1;
|
||||||
} else {
|
} else {
|
||||||
while (sscanf(&Cmd[i++], "%1x", &n) == 1) {
|
while (sscanf(&Cmd[i++], "%1x", &n) == 1) {
|
||||||
hi = (hi << 4) | (lo >> 28);
|
hi = (hi << 4) | (lo >> 28);
|
||||||
lo = (lo << 4) | (n & 0xf);
|
lo = (lo << 4) | (n & 0xf);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(SUCCESS, "Simulating HID tag with ID %x%08x", hi, lo);
|
PrintAndLogEx(SUCCESS, "Simulating HID tag with ID: " _GREEN_("%x%08x"), hi, lo);
|
||||||
hi2 = 0;
|
hi2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ static int CmdHIDClone(const char *Cmd) {
|
||||||
lo = (lo << 4) | (n & 0xf);
|
lo = (lo << 4) | (n & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Preparing to clone HID tag with long ID %x%08x%08x", hi2, hi, lo);
|
PrintAndLogEx(INFO, "Preparing to clone HID tag with long ID: " _GREEN_("%x%08x%08x"), hi2, hi, lo);
|
||||||
|
|
||||||
longid[0] = 1;
|
longid[0] = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -339,7 +339,7 @@ static int CmdHIDClone(const char *Cmd) {
|
||||||
hi = (hi << 4) | (lo >> 28);
|
hi = (hi << 4) | (lo >> 28);
|
||||||
lo = (lo << 4) | (n & 0xf);
|
lo = (lo << 4) | (n & 0xf);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(INFO, "Preparing to clone HID tag with ID %x%08x", hi, lo);
|
PrintAndLogEx(INFO, "Preparing to clone HID tag with ID: " _GREEN_("%x%08x"), hi, lo);
|
||||||
hi2 = 0;
|
hi2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ static int CmdHIDBrute(const char *Cmd) {
|
||||||
param_getstr(Cmd, cmdp + 1, format, sizeof(format));
|
param_getstr(Cmd, cmdp + 1, format, sizeof(format));
|
||||||
format_idx = HIDFindCardFormat(format);
|
format_idx = HIDFindCardFormat(format);
|
||||||
if (format_idx == -1) {
|
if (format_idx == -1) {
|
||||||
PrintAndLogEx(WARNING, "Unknown format: %s", format);
|
PrintAndLogEx(WARNING, "Unknown format: " _YELLOW_("%s"), format);
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
cmdp += 2;
|
cmdp += 2;
|
||||||
|
@ -431,7 +431,7 @@ static int CmdHIDBrute(const char *Cmd) {
|
||||||
cmdp++;
|
cmdp++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
|
PrintAndLogEx(WARNING, "Unknown parameter: " _YELLOW_("'%c'"), param_getchar(Cmd, cmdp));
|
||||||
errors = true;
|
errors = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,17 +229,17 @@ static uint32_t hitag2_crypt(uint64_t x);
|
||||||
((S >> (C - 3)) & 8) )
|
((S >> (C - 3)) & 8) )
|
||||||
|
|
||||||
|
|
||||||
static uint32_t hitag2_crypt(uint64_t s) {
|
static uint32_t hitag2_crypt(uint64_t x) {
|
||||||
const uint32_t ht2_function4a = 0x2C79; // 0010 1100 0111 1001
|
const uint32_t ht2_function4a = 0x2C79; // 0010 1100 0111 1001
|
||||||
const uint32_t ht2_function4b = 0x6671; // 0110 0110 0111 0001
|
const uint32_t ht2_function4b = 0x6671; // 0110 0110 0111 0001
|
||||||
const uint32_t ht2_function5c = 0x7907287B; // 0111 1001 0000 0111 0010 1000 0111 1011
|
const uint32_t ht2_function5c = 0x7907287B; // 0111 1001 0000 0111 0010 1000 0111 1011
|
||||||
uint32_t bitindex;
|
uint32_t bitindex;
|
||||||
|
|
||||||
bitindex = (ht2_function4a >> pickbits2_2(s, 1, 4)) & 1;
|
bitindex = (ht2_function4a >> pickbits2_2(x, 1, 4)) & 1;
|
||||||
bitindex |= ((ht2_function4b << 1) >> pickbits1_1_2(s, 7, 11, 13)) & 0x02;
|
bitindex |= ((ht2_function4b << 1) >> pickbits1_1_2(x, 7, 11, 13)) & 0x02;
|
||||||
bitindex |= ((ht2_function4b << 2) >> pickbits1x4(s, 16, 20, 22, 25)) & 0x04;
|
bitindex |= ((ht2_function4b << 2) >> pickbits1x4(x, 16, 20, 22, 25)) & 0x04;
|
||||||
bitindex |= ((ht2_function4b << 3) >> pickbits2_1_1(s, 27, 30, 32)) & 0x08;
|
bitindex |= ((ht2_function4b << 3) >> pickbits2_1_1(x, 27, 30, 32)) & 0x08;
|
||||||
bitindex |= ((ht2_function4a << 4) >> pickbits1_2_1(s, 33, 42, 45)) & 0x10;
|
bitindex |= ((ht2_function4a << 4) >> pickbits1_2_1(x, 33, 42, 45)) & 0x10;
|
||||||
|
|
||||||
DEBUG_PRINTF("hitag2_crypt bitindex = %02x\n", bitindex);
|
DEBUG_PRINTF("hitag2_crypt bitindex = %02x\n", bitindex);
|
||||||
return (ht2_function5c >> bitindex) & 1;
|
return (ht2_function5c >> bitindex) & 1;
|
||||||
|
|
|
@ -575,7 +575,7 @@ void check_supplied_testkey(unsigned int size) {
|
||||||
|
|
||||||
for (i = 0; i < num_guesses; i++) {
|
for (i = 0; i < num_guesses; i++) {
|
||||||
if (guesses[i].key == partkey) {
|
if (guesses[i].key == partkey) {
|
||||||
fprintf(stderr, " supplied test key score = %1.10f, position = %d\n", guesses[i].score, i);
|
fprintf(stderr, " supplied test key score = %1.10f, position = %u\n", guesses[i].score, i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue