mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
chg: 'hf iclass sim' - get ride of the "waiting for response" message.
-- sim 2, 4 - cancel by keypress.
This commit is contained in:
parent
b881a4d850
commit
3248bb5a56
1 changed files with 32 additions and 15 deletions
|
@ -353,21 +353,29 @@ int CmdHFiClassSim(const char *Cmd) {
|
||||||
switch(simType) {
|
switch(simType) {
|
||||||
|
|
||||||
case 2: {
|
case 2: {
|
||||||
PrintAndLog("Starting the sim 2 attack");
|
PrintAndLog("[+] Starting the sim 2 attack");
|
||||||
|
PrintAndLog("[+] press keyboard to cancel");
|
||||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}};
|
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}};
|
||||||
UsbCommand resp = {0};
|
UsbCommand resp = {0};
|
||||||
memcpy(c.d.asBytes, csns, 8*NUM_CSNS);
|
memcpy(c.d.asBytes, csns, 8*NUM_CSNS);
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
// -1 make it wait all the time (iceman)
|
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, -1)) {
|
while (true) {
|
||||||
PrintAndLog("Command timed out");
|
if (ukbhit()) {
|
||||||
return 0;
|
int gc = getchar(); (void)gc;
|
||||||
}
|
PrintAndLog("[!] aborted via keyboard.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||||
|
PrintAndLog("[!] timeout while waiting for reply.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
uint8_t num_mac_responses = resp.arg[1];
|
uint8_t num_mac_responses = resp.arg[1];
|
||||||
bool success = ( NUM_CSNS == num_mac_responses );
|
bool success = ( NUM_CSNS == num_mac_responses );
|
||||||
PrintAndLog("Mac responses: %d MACs obtained (should be %d) %s"
|
PrintAndLog("[+] Mac responses: %d MACs obtained (should be %d) %s"
|
||||||
, num_mac_responses
|
, num_mac_responses
|
||||||
, NUM_CSNS
|
, NUM_CSNS
|
||||||
, (success) ? "OK":"FAIL"
|
, (success) ? "OK":"FAIL"
|
||||||
|
@ -380,7 +388,7 @@ int CmdHFiClassSim(const char *Cmd) {
|
||||||
|
|
||||||
void* dump = malloc(datalen);
|
void* dump = malloc(datalen);
|
||||||
if ( !dump ) {
|
if ( !dump ) {
|
||||||
PrintAndLog("Failed to allocate memory");
|
PrintAndLog("[!] Failed to allocate memory");
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,21 +406,30 @@ int CmdHFiClassSim(const char *Cmd) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
PrintAndLog("Starting the sim 4 keyroll attack");
|
PrintAndLog("[+] Starting the sim 4 keyroll attack");
|
||||||
|
PrintAndLog("[+] press keyboard to cancel");
|
||||||
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}};
|
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}};
|
||||||
UsbCommand resp = {0};
|
UsbCommand resp = {0};
|
||||||
memcpy(c.d.asBytes, csns, 8*NUM_CSNS);
|
memcpy(c.d.asBytes, csns, 8*NUM_CSNS);
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
// -1 make it wait all the time (iceman)
|
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, -1)) {
|
while (true) {
|
||||||
PrintAndLog("Command timed out");
|
if (ukbhit()) {
|
||||||
return 0;
|
int gc = getchar(); (void)gc;
|
||||||
|
PrintAndLog("[!] aborted via keyboard.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||||
|
PrintAndLog("[!] timeout while waiting for reply.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t num_mac_responses = resp.arg[1];
|
uint8_t num_mac_responses = resp.arg[1];
|
||||||
bool success = ( (NUM_CSNS * 2) == num_mac_responses );
|
bool success = ( (NUM_CSNS * 2) == num_mac_responses );
|
||||||
PrintAndLog("Mac responses: %d MACs obtained (should be %d) %s"
|
PrintAndLog("[+] Mac responses: %d MACs obtained (should be %d) %s"
|
||||||
, num_mac_responses
|
, num_mac_responses
|
||||||
, NUM_CSNS * 2
|
, NUM_CSNS * 2
|
||||||
, (success) ? "OK":"FAIL"
|
, (success) ? "OK":"FAIL"
|
||||||
|
@ -424,7 +441,7 @@ int CmdHFiClassSim(const char *Cmd) {
|
||||||
size_t datalen = NUM_CSNS * 24;
|
size_t datalen = NUM_CSNS * 24;
|
||||||
void* dump = malloc(datalen);
|
void* dump = malloc(datalen);
|
||||||
if ( !dump ) {
|
if ( !dump ) {
|
||||||
PrintAndLog("Failed to allocate memory");
|
PrintAndLog("[!] Failed to allocate memory");
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue