mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
Merge branch 'master' of https://github.com/RfidResearchGroup/proxmark3
This commit is contained in:
commit
a91f922537
3 changed files with 35 additions and 22 deletions
|
@ -1390,7 +1390,6 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
|
||||||
char progress_text[80];
|
char progress_text[80];
|
||||||
FILE *fnonces = NULL;
|
FILE *fnonces = NULL;
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
||||||
num_acquired_nonces = 0;
|
num_acquired_nonces = 0;
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
@ -1402,24 +1401,35 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
|
||||||
flags |= field_off ? 0x0004 : 0;
|
flags |= field_off ? 0x0004 : 0;
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandMIX(CMD_HF_MIFARE_ACQ_ENCRYPTED_NONCES, blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, flags, key, 6);
|
|
||||||
|
|
||||||
if (field_off) break;
|
if (field_off) {
|
||||||
|
SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
SendCommandMIX(CMD_HF_MIFARE_ACQ_ENCRYPTED_NONCES, blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, flags, key, 6);
|
||||||
|
}
|
||||||
|
|
||||||
if (initialize) {
|
if (initialize) {
|
||||||
|
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
||||||
uint8_t nullkey[6] = {0};
|
|
||||||
//strange second call (iceman)
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandMIX(CMD_HF_MIFARE_ACQ_ENCRYPTED_NONCES, blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, 4, nullkey, sizeof(nullkey));
|
SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (resp.oldarg[0]) return resp.oldarg[0]; // error during nested_hard
|
|
||||||
|
// error during nested_hard
|
||||||
|
if (resp.oldarg[0]) {
|
||||||
|
clearCommandBuffer();
|
||||||
|
SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0);
|
||||||
|
return resp.oldarg[0];
|
||||||
|
}
|
||||||
|
|
||||||
cuid = resp.oldarg[1];
|
cuid = resp.oldarg[1];
|
||||||
if (nonce_file_write && fnonces == NULL) {
|
if (nonce_file_write && fnonces == NULL) {
|
||||||
if ((fnonces = fopen(filename, "wb")) == NULL) {
|
if ((fnonces = fopen(filename, "wb")) == NULL) {
|
||||||
PrintAndLogEx(WARNING, "Could not create file %s", filename);
|
PrintAndLogEx(WARNING, "Could not create file %s", filename);
|
||||||
|
clearCommandBuffer();
|
||||||
|
SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
snprintf(progress_text, 80, "Writing acquired nonces to binary file %s", filename);
|
snprintf(progress_text, 80, "Writing acquired nonces to binary file %s", filename);
|
||||||
|
@ -1486,17 +1496,24 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initialize) {
|
if (!initialize) {
|
||||||
|
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
||||||
if (nonce_file_write) {
|
if (nonce_file_write) {
|
||||||
fclose(fnonces);
|
fclose(fnonces);
|
||||||
}
|
}
|
||||||
|
clearCommandBuffer();
|
||||||
|
SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// error during nested_hard
|
||||||
if (resp.oldarg[0]) {
|
if (resp.oldarg[0]) {
|
||||||
if (nonce_file_write) {
|
if (nonce_file_write) {
|
||||||
fclose(fnonces);
|
fclose(fnonces);
|
||||||
}
|
}
|
||||||
return resp.oldarg[0]; // error during nested_hard
|
clearCommandBuffer();
|
||||||
|
SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0);
|
||||||
|
return resp.oldarg[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1513,11 +1530,6 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
|
||||||
fclose(fnonces);
|
fclose(fnonces);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrintAndLogEx(NORMAL, "Sampled a total of %d nonces in %d seconds (%0.0f nonces/minute)",
|
|
||||||
// total_num_nonces,
|
|
||||||
// time(NULL)-time1,
|
|
||||||
// (float)total_num_nonces*60.0/(time(NULL)-time1));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1681,11 +1693,12 @@ static bool all_bitflips_match(uint8_t byte, uint32_t state, odd_even_t odd_even
|
||||||
for (uint8_t remaining_bits = 0; remaining_bits <= (~mask & 0xff); remaining_bits++) {
|
for (uint8_t remaining_bits = 0; remaining_bits <= (~mask & 0xff); remaining_bits++) {
|
||||||
if (remaining_bits_match(num_common, bytes_diff, state, (state & mask) | remaining_bits, odd_even)) {
|
if (remaining_bits_match(num_common, bytes_diff, state, (state & mask) | remaining_bits, odd_even)) {
|
||||||
|
|
||||||
#ifdef DEBUG_KEY_ELIMINATION
|
# ifdef DEBUG_KEY_ELIMINATION
|
||||||
if (bitflips_match(byte2, (state & mask) | remaining_bits, odd_even, true)) {
|
if (bitflips_match(byte2, (state & mask) | remaining_bits, odd_even, true))
|
||||||
#else
|
# else
|
||||||
if (bitflips_match(byte2, (state & mask) | remaining_bits, odd_even)) {
|
if (bitflips_match(byte2, (state & mask) | remaining_bits, odd_even))
|
||||||
#endif
|
# endif
|
||||||
|
{
|
||||||
found_match = true;
|
found_match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1694,7 +1707,7 @@ static bool all_bitflips_match(uint8_t byte, uint32_t state, odd_even_t odd_even
|
||||||
|
|
||||||
if (!found_match) {
|
if (!found_match) {
|
||||||
|
|
||||||
#ifdef DEBUG_KEY_ELIMINATION
|
# ifdef DEBUG_KEY_ELIMINATION
|
||||||
if (known_target_key != -1 && state == test_state[odd_even]) {
|
if (known_target_key != -1 && state == test_state[odd_even]) {
|
||||||
PrintAndLogEx(NORMAL, "all_bitflips_match() 1st Byte: %s test state (0x%06x): Eliminated. Bytes = %02x, %02x, Common Bits = %d\n",
|
PrintAndLogEx(NORMAL, "all_bitflips_match() 1st Byte: %s test state (0x%06x): Eliminated. Bytes = %02x, %02x, Common Bits = %d\n",
|
||||||
odd_even == ODD_STATE ? "odd" : "even",
|
odd_even == ODD_STATE ? "odd" : "even",
|
||||||
|
@ -1706,7 +1719,7 @@ static bool all_bitflips_match(uint8_t byte, uint32_t state, odd_even_t odd_even
|
||||||
sprintf(failstr, "Other 1st Byte %s, all_bitflips_match(), no match", odd_even ? "odd" : "even");
|
sprintf(failstr, "Other 1st Byte %s, all_bitflips_match(), no match", odd_even ? "odd" : "even");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ static int check_comm(void) {
|
||||||
rl_set_prompt(PROXPROMPT_OFFLINE);
|
rl_set_prompt(PROXPROMPT_OFFLINE);
|
||||||
rl_forced_update_display();
|
rl_forced_update_display();
|
||||||
CloseProxmark();
|
CloseProxmark();
|
||||||
PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Use \"hw connect\" to reconnect\n");
|
PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Use "_YELLOW_("\"hw connect\"") "to reconnect\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ If you don't need the graphical components of the Proxmark3 client (such as in `
|
||||||
## On openSUSE
|
## On openSUSE
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo zypper install git patterns-devel-base-devel_basis gcc-c++ readline-devel cross-arm-none-gcc9 cross-arm-none-newlib-devel
|
sudo zypper install git patterns-devel-base-devel_basis gcc-c++ readline-devel cross-arm-none-gcc9 cross-arm-none-newlib-devel libqt5-qtbase-devel
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't need the graphical components of the Proxmark3 client (such as in `hw tune`), you can skip the installation of `libqt5-qtbase-devel`.
|
If you don't need the graphical components of the Proxmark3 client (such as in `hw tune`), you can skip the installation of `libqt5-qtbase-devel`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue