mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
Add hid preamble handle function for standalone
This commit is contained in:
parent
c36b352c2f
commit
7923d07ed0
5 changed files with 38 additions and 10 deletions
|
@ -257,7 +257,7 @@ void hid_corporate_1000_calculate_checksum_and_set(uint32_t *high, uint32_t *low
|
||||||
|
|
||||||
// Calculate new high and low base value from card number and facility code, without parity
|
// Calculate new high and low base value from card number and facility code, without parity
|
||||||
new_low = (fc << 21) | (cardnum << 1);
|
new_low = (fc << 21) | (cardnum << 1);
|
||||||
new_high = 0x28 | ((fc >> 11) & 1); // 0x28 is 101000
|
new_high = (fc >> 11) & 1;
|
||||||
|
|
||||||
int n_ones;
|
int n_ones;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -319,6 +319,7 @@ void hid_corporate_1000_calculate_checksum_and_set(uint32_t *high, uint32_t *low
|
||||||
new_high = new_high | 0x4;
|
new_high = new_high | 0x4;
|
||||||
|
|
||||||
// Setting new calculated values
|
// Setting new calculated values
|
||||||
|
add_HID_preamble(0, &new_high, &new_low, 35);
|
||||||
*low = new_low;
|
*low = new_low;
|
||||||
*high = new_high;
|
*high = new_high;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,8 +176,7 @@ void hid_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t card
|
||||||
newlow |= oddparity32((newlow >> 1) & 0xFFF);
|
newlow |= oddparity32((newlow >> 1) & 0xFFF);
|
||||||
newlow |= (evenparity32((newlow >> 13) & 0xFFF)) << 25;
|
newlow |= (evenparity32((newlow >> 13) & 0xFFF)) << 25;
|
||||||
|
|
||||||
newhigh |= 0x20; // Bit 37; standard header
|
add_HID_preamble(NULL, &newhigh, &newlow, 26);
|
||||||
newlow |= 1U << 26; // leading 1: start bit
|
|
||||||
|
|
||||||
*low = newlow;
|
*low = newlow;
|
||||||
*high = newhigh;
|
*high = newhigh;
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// LF HID ProxII Brutforce v2 by lnv42 - based on Proxbrute by Brad antoniewicz
|
// 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
|
// Following code is a trivial brute forcer (H10301 26-bit) when you know the
|
||||||
// code and want to find valid(s) card number(s). It will try all card
|
// 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).
|
// 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
|
// 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).
|
// possibles values for LF low, even those with bad checksum (~4g tries).
|
||||||
|
@ -46,8 +46,7 @@ void RunMod(void) {
|
||||||
StandAloneMode();
|
StandAloneMode();
|
||||||
Dbprintf(">> LF HID proxII bruteforce v2 a.k.a Prox2Brute Started <<");
|
Dbprintf(">> LF HID proxII bruteforce v2 a.k.a Prox2Brute Started <<");
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||||
|
uint32_t high = 0, low = 0;
|
||||||
const uint32_t high = 0x20; // LF high value is always 0x20 here
|
|
||||||
|
|
||||||
uint32_t fac = FACILITY_CODE, cardnum = 0;
|
uint32_t fac = FACILITY_CODE, cardnum = 0;
|
||||||
|
|
||||||
|
@ -79,9 +78,10 @@ void RunMod(void) {
|
||||||
if (BUTTON_HELD(1000) == BUTTON_HOLD) break; // long button press (>=1sec) exit
|
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
|
// calculate the new LF low value including Card number, Facility code and checksum
|
||||||
uint32_t low = (cardnum << 1) | (fac << 17);
|
low = (cardnum << 1) | (fac << 17);
|
||||||
low |= oddparity32((low >> 1) & 0xFFF);
|
low |= oddparity32((low >> 1) & 0xFFF);
|
||||||
low |= evenparity32((low >> 13) & 0xFFF) << 25;
|
low |= evenparity32((low >> 13) & 0xFFF) << 25;
|
||||||
|
add_HID_preamble(NULL, &high, &low, 26);
|
||||||
|
|
||||||
Dbprintf("[=] trying Facility = %08x, Card = %08x, raw = %08x%08x",
|
Dbprintf("[=] trying Facility = %08x, Card = %08x, raw = %08x%08x",
|
||||||
fac, cardnum, high, low);
|
fac, cardnum, high, low);
|
||||||
|
|
|
@ -944,6 +944,33 @@ static void fcAll(uint8_t fc, int *n, uint8_t clock, int16_t *remainder) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool add_HID_preamble(uint32_t *hi2, uint32_t *hi, uint32_t *lo, uint8_t length){
|
||||||
|
// Invalid value
|
||||||
|
if (length > 84 || length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (length == 48) {
|
||||||
|
*hi |= 1U << (length - 32); // Example leading 1: start bit
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (length >= 64) {
|
||||||
|
*hi2 |= 0x09e00000; // Extended-length header
|
||||||
|
*hi2 |= 1U << (length - 64); // leading 1: start bit
|
||||||
|
} else if (length > 37) {
|
||||||
|
*hi2 |= 0x09e00000; // Extended-length header
|
||||||
|
*hi |= 1U << (length - 32); // leading 1: start bit
|
||||||
|
} else if (length == 37) {
|
||||||
|
// No header bits added to 37-bit cards
|
||||||
|
} else if (length >= 32) {
|
||||||
|
*hi |= 0x20; // Bit 37; standard header
|
||||||
|
*hi |= 1U << (length - 32); // leading 1: start bit
|
||||||
|
} else {
|
||||||
|
*hi |= 0x20; // Bit 37; standard header
|
||||||
|
*lo |= 1U << length; // leading 1: start bit
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// prepare a waveform pattern in the buffer based on the ID given then
|
// prepare a waveform pattern in the buffer based on the ID given then
|
||||||
// simulate a HID tag until the button is pressed
|
// simulate a HID tag until the button is pressed
|
||||||
void CmdHIDsimTAGEx(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol, int numcycles) {
|
void CmdHIDsimTAGEx(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol, int numcycles) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ void SimulateTagLowFrequencyEx(int period, int gap, bool ledcontrol, int numcycl
|
||||||
void SimulateTagLowFrequency(int period, int gap, bool ledcontrol);
|
void SimulateTagLowFrequency(int period, int gap, bool ledcontrol);
|
||||||
void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
|
void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
|
||||||
|
|
||||||
|
bool add_HID_preamble(uint32_t *hi2, uint32_t *hi, uint32_t *lo, uint8_t length);
|
||||||
void CmdHIDsimTAGEx(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol, int numcycles);
|
void CmdHIDsimTAGEx(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol, int numcycles);
|
||||||
void CmdHIDsimTAG(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol);
|
void CmdHIDsimTAG(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue