merge hell p.x
This commit is contained in:
@@ -134,7 +134,7 @@ static bool waitCmd14b(bool verbose) {
|
||||
|
||||
PacketResponseNG resp;
|
||||
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
|
||||
|
||||
if ((resp.oldarg[0] & 0xFF) > 0) return false;
|
||||
|
||||
@@ -314,7 +314,7 @@ static bool get_14b_UID(iso14b_card_select_t *card) {
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0, NULL, 0);
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
|
||||
|
||||
uint8_t status = resp.oldarg[0];
|
||||
if (status == 0) {
|
||||
@@ -330,7 +330,7 @@ static bool get_14b_UID(iso14b_card_select_t *card) {
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT, 0, 0, NULL, 0);
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
|
||||
|
||||
uint8_t status = resp.oldarg[0];
|
||||
if (status == 0) {
|
||||
@@ -515,7 +515,7 @@ static bool HF14B_Std_Info(bool verbose) {
|
||||
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
|
||||
if (!WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
|
||||
if (verbose) PrintAndLogEx(WARNING, "command execution timeout");
|
||||
switch_off_field_14b();
|
||||
return false;
|
||||
@@ -556,7 +556,7 @@ static bool HF14B_ST_Info(bool verbose) {
|
||||
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
|
||||
if (!WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
|
||||
if (verbose) PrintAndLogEx(WARNING, "command execution timeout");
|
||||
return false;
|
||||
}
|
||||
@@ -611,7 +611,7 @@ static bool HF14B_ST_Reader(bool verbose) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
|
||||
if (!WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
|
||||
if (verbose) PrintAndLogEx(WARNING, "command execution timeout");
|
||||
return false;
|
||||
}
|
||||
@@ -651,7 +651,7 @@ static bool HF14B_Std_Reader(bool verbose) {
|
||||
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT, 0, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
|
||||
if (!WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
|
||||
if (verbose) PrintAndLogEx(WARNING, "command execution timeout");
|
||||
return false;
|
||||
}
|
||||
@@ -695,7 +695,7 @@ static bool HF14B_Other_Reader(void) {
|
||||
// clearCommandBuffer();
|
||||
// SendCommandMIX(CMD_HF_ISO14443B_COMMAND, flags, datalen, 0, data, datalen);
|
||||
// PacketResponseNG resp;
|
||||
// WaitForResponse(CMD_ACK,&resp);
|
||||
// WaitForResponse(CMD_HF_ISO14443B_COMMAND,&resp);
|
||||
|
||||
// if (datalen > 2 ) {
|
||||
// PrintAndLogEx(NORMAL, "\n14443-3b tag found:");
|
||||
@@ -709,7 +709,7 @@ static bool HF14B_Other_Reader(void) {
|
||||
// clearCommandBuffer();
|
||||
// SendCommandMIX(CMD_HF_ISO14443B_COMMAND, flags, 1, 0, data, 1);
|
||||
// PacketResponseNG resp;
|
||||
// WaitForResponse(CMD_ACK, &resp);
|
||||
// WaitForResponse(CMD_HF_ISO14443B_COMMAND, &resp);
|
||||
|
||||
// if (datalen > 0) {
|
||||
// PrintAndLogEx(NORMAL, "\n14443-3b tag found:");
|
||||
@@ -723,7 +723,7 @@ static bool HF14B_Other_Reader(void) {
|
||||
// clearCommandBuffer();
|
||||
// SendCommandMIX(CMD_HF_ISO14443B_COMMAND, flags, 1, 0, data, 1);
|
||||
// PacketResponseNG resp;
|
||||
// WaitForResponse(CMD_ACK, &resp);
|
||||
// WaitForResponse(CMD_HF_ISO14443B_COMMAND, &resp);
|
||||
|
||||
// if (datalen > 0) {
|
||||
// PrintAndLogEx(NORMAL, "\n14443-3b tag found:");
|
||||
@@ -899,7 +899,7 @@ static int CmdHF14BDump(const char *Cmd) {
|
||||
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, ISO14B_CONNECT | ISO14B_SELECT_SR, 0, 0, NULL, 0);
|
||||
|
||||
//select
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, 2000)) {
|
||||
if (resp.oldarg[0]) {
|
||||
PrintAndLogEx(INFO, "failed to select %" PRId64 " | %" PRId64, resp.oldarg[0], resp.oldarg[1]);
|
||||
goto out;
|
||||
@@ -915,7 +915,7 @@ static int CmdHF14BDump(const char *Cmd) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO14443B_COMMAND, ISO14B_APPEND_CRC | ISO14B_RAW, 2, 0, req, sizeof(req));
|
||||
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, 2000)) {
|
||||
|
||||
uint8_t status = resp.oldarg[0] & 0xFF;
|
||||
if (status > 0) {
|
||||
|
||||
@@ -529,21 +529,19 @@ static int CmdHFiClassSim(const char *Cmd) {
|
||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (strlen(Cmd) < 1 || cmdp == 'h') return usage_hf_iclass_sim();
|
||||
|
||||
uint8_t simType = 0;
|
||||
uint8_t CSN[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t sim_type = param_get8ex(Cmd, 0, 0, 10);
|
||||
|
||||
simType = param_get8ex(Cmd, 0, 0, 10);
|
||||
|
||||
if (simType == 0) {
|
||||
if (sim_type == 0) {
|
||||
if (param_gethex(Cmd, 1, CSN, 16)) {
|
||||
PrintAndLogEx(ERR, "A CSN should consist of 16 HEX symbols");
|
||||
return usage_hf_iclass_sim();
|
||||
}
|
||||
PrintAndLogEx(INFO, " simtype: %02x CSN: %s", simType, sprint_hex(CSN, 8));
|
||||
PrintAndLogEx(INFO, " simtype: %02x CSN: %s", sim_type, sprint_hex(CSN, 8));
|
||||
}
|
||||
|
||||
if (simType > 4) {
|
||||
PrintAndLogEx(ERR, "Undefined simptype %d", simType);
|
||||
if (sim_type > 4) {
|
||||
PrintAndLogEx(ERR, "Undefined simtype %d", sim_type);
|
||||
return usage_hf_iclass_sim();
|
||||
}
|
||||
|
||||
@@ -575,14 +573,14 @@ static int CmdHFiClassSim(const char *Cmd) {
|
||||
**/
|
||||
uint8_t tries = 0;
|
||||
|
||||
switch (simType) {
|
||||
switch (sim_type) {
|
||||
|
||||
case 2: {
|
||||
case ICLASS_SIM_MODE_READER_ATTACK: {
|
||||
PrintAndLogEx(INFO, "Starting iCLASS sim 2 attack (elite mode)");
|
||||
PrintAndLogEx(INFO, "press Enter to cancel");
|
||||
PrintAndLogEx(INFO, "press " _YELLOW_("`enter`") " to cancel");
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ICLASS_SIMULATE, simType, NUM_CSNS, 0, csns, 8 * NUM_CSNS);
|
||||
SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, NUM_CSNS, 0, csns, 8 * NUM_CSNS);
|
||||
|
||||
while (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||
tries++;
|
||||
@@ -625,13 +623,13 @@ static int CmdHFiClassSim(const char *Cmd) {
|
||||
free(dump);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
case ICLASS_SIM_MODE_READER_ATTACK_KEYROLL: {
|
||||
// reader in key roll mode, when it has two keys it alternates when trying to verify.
|
||||
PrintAndLogEx(INFO, "Starting iCLASS sim 4 attack (elite mode, reader in key roll mode)");
|
||||
PrintAndLogEx(INFO, "press Enter to cancel");
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ICLASS_SIMULATE, simType, NUM_CSNS, 0, csns, 8 * NUM_CSNS);
|
||||
SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, NUM_CSNS, 0, csns, 8 * NUM_CSNS);
|
||||
|
||||
while (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||
tries++;
|
||||
@@ -689,12 +687,13 @@ static int CmdHFiClassSim(const char *Cmd) {
|
||||
free(dump);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 3:
|
||||
case ICLASS_SIM_MODE_CSN:
|
||||
case ICLASS_SIM_MODE_CSN_DEFAULT:
|
||||
case ICLASS_SIM_MODE_FULL:
|
||||
default: {
|
||||
uint8_t numberOfCSNs = 0;
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ICLASS_SIMULATE, simType, numberOfCSNs, 0, CSN, 8);
|
||||
SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, numberOfCSNs, 0, CSN, 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user