mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
style
This commit is contained in:
parent
b135413995
commit
4df743c2a0
18 changed files with 1080 additions and 1006 deletions
|
@ -819,7 +819,7 @@ void SimulateIso14443bTag(const uint8_t *pupi) {
|
||||||
// WUP in HALTED state
|
// WUP in HALTED state
|
||||||
if (len == 5) {
|
if (len == 5) {
|
||||||
if ((receivedCmd[0] == ISO14443B_REQB && (receivedCmd[2] & 0x8) == 0x8 && cardSTATE == SIM_HALTED) ||
|
if ((receivedCmd[0] == ISO14443B_REQB && (receivedCmd[2] & 0x8) == 0x8 && cardSTATE == SIM_HALTED) ||
|
||||||
receivedCmd[0] == ISO14443B_REQB) {
|
receivedCmd[0] == ISO14443B_REQB) {
|
||||||
|
|
||||||
LogTrace(receivedCmd, len, 0, 0, NULL, true);
|
LogTrace(receivedCmd, len, 0, 0, NULL, true);
|
||||||
cardSTATE = SIM_SELECTING;
|
cardSTATE = SIM_SELECTING;
|
||||||
|
@ -1653,7 +1653,7 @@ int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void
|
||||||
|
|
||||||
// retrieve the result again (with increased timeout)
|
// retrieve the result again (with increased timeout)
|
||||||
eof_time += DELAY_ISO14443B_PCD_TO_PICC_READER;
|
eof_time += DELAY_ISO14443B_PCD_TO_PICC_READER;
|
||||||
|
|
||||||
if (Get14443bAnswerFromTag(rxdata, rxmaxlen, iso14b_timeout, &eof_time, &len) != PM3_SUCCESS) {
|
if (Get14443bAnswerFromTag(rxdata, rxmaxlen, iso14b_timeout, &eof_time, &len) != PM3_SUCCESS) {
|
||||||
FpgaDisableTracing();
|
FpgaDisableTracing();
|
||||||
return PM3_ECARDEXCHANGE;
|
return PM3_ECARDEXCHANGE;
|
||||||
|
@ -1670,8 +1670,8 @@ int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void
|
||||||
// current block number, toggle the current block number
|
// current block number, toggle the current block number
|
||||||
|
|
||||||
if ((len >= 3) && // PCB + CRC = 3 bytes
|
if ((len >= 3) && // PCB + CRC = 3 bytes
|
||||||
(((data_bytes[0] & 0xC0) == 0) || (data_bytes[0] & 0xD0) == 0x80) && // I-Block OR R-Block with ACK bit set to 0
|
(((data_bytes[0] & 0xC0) == 0) || (data_bytes[0] & 0xD0) == 0x80) && // I-Block OR R-Block with ACK bit set to 0
|
||||||
((data_bytes[0] & 0x01) == iso14b_pcb_blocknum)) { // equal block numbers
|
((data_bytes[0] & 0x01) == iso14b_pcb_blocknum)) { // equal block numbers
|
||||||
|
|
||||||
iso14b_pcb_blocknum ^= 1;
|
iso14b_pcb_blocknum ^= 1;
|
||||||
|
|
||||||
|
@ -1725,7 +1725,7 @@ static int iso14443b_select_cts_card(iso14b_cts_card_select_t *card) {
|
||||||
if (Get14443bAnswerFromTag(r, sizeof(r), iso14b_timeout, &eof_time, &retlen) != PM3_SUCCESS) {
|
if (Get14443bAnswerFromTag(r, sizeof(r), iso14b_timeout, &eof_time, &retlen) != PM3_SUCCESS) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
FpgaDisableTracing();
|
FpgaDisableTracing();
|
||||||
|
|
||||||
if (retlen != 4) {
|
if (retlen != 4) {
|
||||||
|
@ -1803,7 +1803,7 @@ static int iso14443b_select_srx_card(iso14b_card_select_t *card) {
|
||||||
eof_time += DELAY_ISO14443B_PCD_TO_PICC_READER;
|
eof_time += DELAY_ISO14443B_PCD_TO_PICC_READER;
|
||||||
uint16_t retlen = 0;
|
uint16_t retlen = 0;
|
||||||
if (Get14443bAnswerFromTag(r_init, sizeof(r_init), iso14b_timeout, &eof_time, &retlen) != PM3_SUCCESS) {
|
if (Get14443bAnswerFromTag(r_init, sizeof(r_init), iso14b_timeout, &eof_time, &retlen) != PM3_SUCCESS) {
|
||||||
FpgaDisableTracing();
|
FpgaDisableTracing();
|
||||||
return PM3_ECARDEXCHANGE;
|
return PM3_ECARDEXCHANGE;
|
||||||
}
|
}
|
||||||
FpgaDisableTracing();
|
FpgaDisableTracing();
|
||||||
|
@ -2526,12 +2526,12 @@ void SendRawCommand14443B_Ex(iso14b_raw_cmd_t *p) {
|
||||||
} else {
|
} else {
|
||||||
responselen = MIN(responselen, PM3_CMD_DATA_SIZE);
|
responselen = MIN(responselen, PM3_CMD_DATA_SIZE);
|
||||||
|
|
||||||
iso14b_raw_apdu_response_t *payload = (iso14b_raw_apdu_response_t *)BigBuf_calloc( sizeof(iso14b_raw_apdu_response_t) + responselen);
|
iso14b_raw_apdu_response_t *payload = (iso14b_raw_apdu_response_t *)BigBuf_calloc(sizeof(iso14b_raw_apdu_response_t) + responselen);
|
||||||
payload->response_byte = response_byte;
|
payload->response_byte = response_byte;
|
||||||
payload->datalen = responselen;
|
payload->datalen = responselen;
|
||||||
memcpy(payload->data, buf, payload->datalen);
|
memcpy(payload->data, buf, payload->datalen);
|
||||||
|
|
||||||
reply_ng(CMD_HF_ISO14443B_COMMAND, status, (uint8_t*)payload, sizeof(iso14b_raw_apdu_response_t) + responselen);
|
reply_ng(CMD_HF_ISO14443B_COMMAND, status, (uint8_t *)payload, sizeof(iso14b_raw_apdu_response_t) + responselen);
|
||||||
BigBuf_free_keep_EM();
|
BigBuf_free_keep_EM();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void iso14443b_setup(void);
|
void iso14443b_setup(void);
|
||||||
int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void *rxdata, uint16_t rxmaxlen, uint8_t *res, int * responselen);
|
int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void *rxdata, uint16_t rxmaxlen, uint8_t *res, int *responselen);
|
||||||
|
|
||||||
int iso14443b_select_card(iso14b_card_select_t *card);
|
int iso14443b_select_card(iso14b_card_select_t *card);
|
||||||
|
|
||||||
|
|
|
@ -2461,7 +2461,7 @@ void SendRawCommand15693(iso15_raw_cmd_t *packet) {
|
||||||
// This is part of ISO15693 protocol definitions where the following commands needs to request option.
|
// This is part of ISO15693 protocol definitions where the following commands needs to request option.
|
||||||
// note:
|
// note:
|
||||||
// it seem like previous we just guessed and never followed the fISO145_REQ_OPTION flag if it was set / not set from client side.
|
// it seem like previous we just guessed and never followed the fISO145_REQ_OPTION flag if it was set / not set from client side.
|
||||||
// this is a problem. Since without this the response from the tag is one byte shorter. And a lot of client side functions has been
|
// this is a problem. Since without this the response from the tag is one byte shorter. And a lot of client side functions has been
|
||||||
// hardcoded to assume for the extra byte in the response.
|
// hardcoded to assume for the extra byte in the response.
|
||||||
|
|
||||||
bool request_answer = false;
|
bool request_answer = false;
|
||||||
|
|
|
@ -10,8 +10,8 @@ copyright = ''
|
||||||
author = "Adam Foster (evildaemond)"
|
author = "Adam Foster (evildaemond)"
|
||||||
version = 'v0.0.1'
|
version = 'v0.0.1'
|
||||||
desc = [[
|
desc = [[
|
||||||
Convert a facility code and card number to a Mifare Classic UID, which can be used as part of a downgrade attack.
|
Convert a facility code and card number to a Mifare Classic UID, which can be used as part of a downgrade attack.
|
||||||
This abuses the fact that some controllers interpret the UID for Mifare Classic cards as a CN and FN, it requires the controller to interpret the wiegand payload in this way.
|
This abuses the fact that some controllers interpret the UID for Mifare Classic cards as a CN and FN, it requires the controller to interpret the wiegand payload in this way.
|
||||||
|
|
||||||
The example of FC 146 CN 5 would be read by the reader and send as a payload like 0920005, where 9200 is dec 146 and 05 is interpreted as 5
|
The example of FC 146 CN 5 would be read by the reader and send as a payload like 0920005, where 9200 is dec 146 and 05 is interpreted as 5
|
||||||
|
|
||||||
|
|
|
@ -2025,7 +2025,7 @@ int CmdTuneSamples(const char *Cmd) {
|
||||||
|
|
||||||
// Q measure with Vlr=Q*(2*Vdd/pi)
|
// Q measure with Vlr=Q*(2*Vdd/pi)
|
||||||
double lfq2 = (double)package->peak_v * 3.14 / 2 / vdd;
|
double lfq2 = (double)package->peak_v * 3.14 / 2 / vdd;
|
||||||
PrintAndLogEx(SUCCESS, "Peak voltage............ " _YELLOW_("%.1lf") , lfq2);
|
PrintAndLogEx(SUCCESS, "Peak voltage............ " _YELLOW_("%.1lf"), lfq2);
|
||||||
// cross-check results
|
// cross-check results
|
||||||
if (lfq1 > 3) {
|
if (lfq1 > 3) {
|
||||||
double approx_vdd = (double)package->peak_v * 3.14 / 2 / lfq1;
|
double approx_vdd = (double)package->peak_v * 3.14 / 2 / lfq1;
|
||||||
|
@ -2073,7 +2073,7 @@ int CmdTuneSamples(const char *Cmd) {
|
||||||
if (package->v_hf >= HF_UNUSABLE_V) {
|
if (package->v_hf >= HF_UNUSABLE_V) {
|
||||||
// Q measure with Vlr=Q*(2*Vdd/pi)
|
// Q measure with Vlr=Q*(2*Vdd/pi)
|
||||||
double hfq = (double)package->v_hf * 3.14 / 2 / vdd;
|
double hfq = (double)package->v_hf * 3.14 / 2 / vdd;
|
||||||
PrintAndLogEx(SUCCESS, "peak voltage............ " _YELLOW_("%.1lf") , hfq);
|
PrintAndLogEx(SUCCESS, "peak voltage............ " _YELLOW_("%.1lf"), hfq);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (package->v_hf < HF_UNUSABLE_V)
|
if (package->v_hf < HF_UNUSABLE_V)
|
||||||
|
@ -2098,13 +2098,13 @@ int CmdTuneSamples(const char *Cmd) {
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(INFO, "-------- " _CYAN_("LF tuning graph") " ---------");
|
PrintAndLogEx(INFO, "-------- " _CYAN_("LF tuning graph") " ---------");
|
||||||
PrintAndLogEx(SUCCESS, "Blue line Divisor %d / %.2f kHz"
|
PrintAndLogEx(SUCCESS, "Blue line Divisor %d / %.2f kHz"
|
||||||
, LF_DIVISOR_134
|
, LF_DIVISOR_134
|
||||||
, LF_DIV2FREQ(LF_DIVISOR_134)
|
, LF_DIV2FREQ(LF_DIVISOR_134)
|
||||||
);
|
);
|
||||||
PrintAndLogEx(SUCCESS, "Red line Divisor %d / %.2f kHz\n\n"
|
PrintAndLogEx(SUCCESS, "Red line Divisor %d / %.2f kHz\n\n"
|
||||||
, LF_DIVISOR_125
|
, LF_DIVISOR_125
|
||||||
, LF_DIV2FREQ(LF_DIVISOR_125)
|
, LF_DIV2FREQ(LF_DIVISOR_125)
|
||||||
);
|
);
|
||||||
g_GraphTraceLen = 256;
|
g_GraphTraceLen = 256;
|
||||||
g_CursorCPos = LF_DIVISOR_125;
|
g_CursorCPos = LF_DIVISOR_125;
|
||||||
g_CursorDPos = LF_DIVISOR_134;
|
g_CursorDPos = LF_DIVISOR_134;
|
||||||
|
@ -3208,7 +3208,7 @@ static int CmdDiff(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "inB null");
|
PrintAndLogEx(INFO, "inB null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char hdr0[400] = {0};
|
char hdr0[400] = {0};
|
||||||
|
|
||||||
int hdr_sln = (width * 4) + 2;
|
int hdr_sln = (width * 4) + 2;
|
||||||
|
@ -3224,13 +3224,13 @@ static int CmdDiff(const char *Cmd) {
|
||||||
fnlenB = strlen(filenameB);
|
fnlenB = strlen(filenameB);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fnlenA && fnlenB ) {
|
if (fnlenA && fnlenB) {
|
||||||
|
|
||||||
snprintf(hdr0, sizeof(hdr0) - 1, " # | " _CYAN_("%.*s"), max_fn_space, filenameA);
|
snprintf(hdr0, sizeof(hdr0) - 1, " # | " _CYAN_("%.*s"), max_fn_space, filenameA);
|
||||||
|
|
||||||
// add space if needed
|
// add space if needed
|
||||||
int padding_len = (hdr_sln - fnlenA - 1);
|
int padding_len = (hdr_sln - fnlenA - 1);
|
||||||
if ( padding_len > 0 ) {
|
if (padding_len > 0) {
|
||||||
memset(hdr0 + strlen(hdr0), ' ', padding_len);
|
memset(hdr0 + strlen(hdr0), ' ', padding_len);
|
||||||
}
|
}
|
||||||
snprintf(hdr0 + strlen(hdr0), sizeof(hdr0) - 1 - strlen(hdr0), "| " _CYAN_("%.*s"), max_fn_space, filenameB);
|
snprintf(hdr0 + strlen(hdr0), sizeof(hdr0) - 1 - strlen(hdr0), "| " _CYAN_("%.*s"), max_fn_space, filenameB);
|
||||||
|
|
|
@ -99,7 +99,7 @@ static void hf14b_aid_search(bool verbose) {
|
||||||
uint8_t vaid[200] = {0};
|
uint8_t vaid[200] = {0};
|
||||||
int vaidlen = 0;
|
int vaidlen = 0;
|
||||||
|
|
||||||
if ((AIDGetFromElm(data, vaid, sizeof(vaid), &vaidlen) == false) || (vaidlen == 0 )) {
|
if ((AIDGetFromElm(data, vaid, sizeof(vaid), &vaidlen) == false) || (vaidlen == 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ static bool wait_14b_response(bool only_first, uint8_t *datalen, uint8_t *data)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// treat first reponse as same.
|
// treat first reponse as same.
|
||||||
if (only_first) {
|
if (only_first) {
|
||||||
|
|
||||||
if (datalen) {
|
if (datalen) {
|
||||||
|
@ -219,7 +219,7 @@ static bool wait_14b_response(bool only_first, uint8_t *datalen, uint8_t *data)
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
memcpy(data, resp.data.asBytes, resp.length);
|
memcpy(data, resp.data.asBytes, resp.length);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ static const char *get_st25_chip_model(uint8_t id) {
|
||||||
return "ST25TB512-AC";
|
return "ST25TB512-AC";
|
||||||
case 0x33:
|
case 0x33:
|
||||||
return "ST25TB512-AT";
|
return "ST25TB512-AT";
|
||||||
case 0x3F:
|
case 0x3F:
|
||||||
return "ST25TB02K";
|
return "ST25TB02K";
|
||||||
case 0x1F:
|
case 0x1F:
|
||||||
return "ST25TB04K";
|
return "ST25TB04K";
|
||||||
|
@ -846,7 +846,7 @@ static uint8_t get_st_cardsize(const uint8_t *uid) {
|
||||||
switch (chipid) {
|
switch (chipid) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
case 0x3:
|
case 0x3:
|
||||||
case 0x7:
|
case 0x7:
|
||||||
return SR_SIZE_4K;
|
return SR_SIZE_4K;
|
||||||
case 0x4:
|
case 0x4:
|
||||||
case 0x6:
|
case 0x6:
|
||||||
|
@ -1137,9 +1137,9 @@ static int write_sr_block(uint8_t blockno, uint8_t datalen, uint8_t *data) {
|
||||||
free(packet);
|
free(packet);
|
||||||
|
|
||||||
if (wait_14b_response(true, NULL, NULL) == false) {
|
if (wait_14b_response(true, NULL, NULL) == false) {
|
||||||
PrintAndLogEx(FAILED, "SRx write block ( " _RED_("failed") " )" );
|
PrintAndLogEx(FAILED, "SRx write block ( " _RED_("failed") " )");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,7 +1163,7 @@ static bool HF14B_st_reader(bool verbose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (resp.status) {
|
switch (resp.status) {
|
||||||
case PM3_SUCCESS:{
|
case PM3_SUCCESS: {
|
||||||
iso14b_card_select_t card;
|
iso14b_card_select_t card;
|
||||||
memcpy(&card, (iso14b_card_select_t *)resp.data.asBytes, sizeof(iso14b_card_select_t));
|
memcpy(&card, (iso14b_card_select_t *)resp.data.asBytes, sizeof(iso14b_card_select_t));
|
||||||
|
|
||||||
|
@ -1297,7 +1297,7 @@ static bool HF14B_other_reader(bool verbose) {
|
||||||
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
|
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
|
||||||
|
|
||||||
// wait for the select message and wait for response
|
// wait for the select message and wait for response
|
||||||
if (wait_14b_response(false, NULL, NULL) ) {
|
if (wait_14b_response(false, NULL, NULL)) {
|
||||||
PrintAndLogEx(SUCCESS, "\n14443-3b tag found:");
|
PrintAndLogEx(SUCCESS, "\n14443-3b tag found:");
|
||||||
PrintAndLogEx(SUCCESS, "unknown tag type answered to a " _YELLOW_("0x000b3f80") " command");
|
PrintAndLogEx(SUCCESS, "unknown tag type answered to a " _YELLOW_("0x000b3f80") " command");
|
||||||
switch_off_field_14b();
|
switch_off_field_14b();
|
||||||
|
@ -1508,7 +1508,7 @@ static int CmdHF14BWriteSri(const char *Cmd) {
|
||||||
status = read_sr_block(blockno, out);
|
status = read_sr_block(blockno, out);
|
||||||
if (status == PM3_SUCCESS) {
|
if (status == PM3_SUCCESS) {
|
||||||
if (memcmp(data, out, 4) == 0) {
|
if (memcmp(data, out, 4) == 0) {
|
||||||
PrintAndLogEx(SUCCESS, "SRx write block ( " _GREEN_("ok") " )" );
|
PrintAndLogEx(SUCCESS, "SRx write block ( " _GREEN_("ok") " )");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(INFO, "Verifying block ( " _RED_("failed") " )");
|
PrintAndLogEx(INFO, "Verifying block ( " _RED_("failed") " )");
|
||||||
|
@ -1927,7 +1927,7 @@ static int handle_14b_apdu(bool chainingin, uint8_t *datain, int datainlen,
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( resp.status != PM3_SUCCESS) {
|
if (resp.status != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(ERR, "APDU: no APDU response");
|
PrintAndLogEx(ERR, "APDU: no APDU response");
|
||||||
return resp.status;
|
return resp.status;
|
||||||
}
|
}
|
||||||
|
@ -1959,7 +1959,7 @@ static int handle_14b_apdu(bool chainingin, uint8_t *datain, int datainlen,
|
||||||
PrintAndLogEx(ERR, "APDU: small APDU response, len " _RED_("%d"), apdu->datalen);
|
PrintAndLogEx(ERR, "APDU: small APDU response, len " _RED_("%d"), apdu->datalen);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy to output array
|
// copy to output array
|
||||||
memcpy(dataout, apdu->data, dlen);
|
memcpy(dataout, apdu->data, dlen);
|
||||||
|
|
||||||
|
|
|
@ -482,7 +482,7 @@ static int getUID(bool verbose, bool loop, uint8_t *buf) {
|
||||||
int res = PM3_ESOFT;
|
int res = PM3_ESOFT;
|
||||||
do {
|
do {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000)) {
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ static int NxpTestEAS(uint8_t *uid) {
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// params
|
// params
|
||||||
packet->raw[packet->rawlen++] = (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS);
|
packet->raw[packet->rawlen++] = (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS);
|
||||||
packet->raw[packet->rawlen++] = ISO15693_EAS_ALARM;
|
packet->raw[packet->rawlen++] = ISO15693_EAS_ALARM;
|
||||||
packet->raw[packet->rawlen++] = 0x04; // IC manufacturer code
|
packet->raw[packet->rawlen++] = 0x04; // IC manufacturer code
|
||||||
|
@ -730,7 +730,7 @@ static int NxpTestEAS(uint8_t *uid) {
|
||||||
packet->flags = (ISO15_CONNECT | ISO15_HIGH_SPEED | ISO15_READ_RESPONSE);
|
packet->flags = (ISO15_CONNECT | ISO15_HIGH_SPEED | ISO15_READ_RESPONSE);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
free(packet);
|
free(packet);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
@ -756,7 +756,7 @@ static int NxpCheckSig(uint8_t *uid) {
|
||||||
if (uid == NULL) {
|
if (uid == NULL) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t approxlen = 13;
|
uint8_t approxlen = 13;
|
||||||
iso15_raw_cmd_t *packet = (iso15_raw_cmd_t *)calloc(1, sizeof(iso15_raw_cmd_t) + approxlen);
|
iso15_raw_cmd_t *packet = (iso15_raw_cmd_t *)calloc(1, sizeof(iso15_raw_cmd_t) + approxlen);
|
||||||
if (packet == NULL) {
|
if (packet == NULL) {
|
||||||
|
@ -764,7 +764,7 @@ static int NxpCheckSig(uint8_t *uid) {
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// params
|
// params
|
||||||
// Check if we can also read the signature
|
// Check if we can also read the signature
|
||||||
packet->raw[packet->rawlen++] = (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS);
|
packet->raw[packet->rawlen++] = (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS);
|
||||||
packet->raw[packet->rawlen++] = ISO15693_READ_SIGNATURE;
|
packet->raw[packet->rawlen++] = ISO15693_READ_SIGNATURE;
|
||||||
|
@ -777,9 +777,9 @@ static int NxpCheckSig(uint8_t *uid) {
|
||||||
packet->rawlen += 2;
|
packet->rawlen += 2;
|
||||||
|
|
||||||
packet->flags = (ISO15_CONNECT | ISO15_HIGH_SPEED | ISO15_READ_RESPONSE);
|
packet->flags = (ISO15_CONNECT | ISO15_HIGH_SPEED | ISO15_READ_RESPONSE);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
free(packet);
|
free(packet);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ static int NxpSysInfo(uint8_t *uid) {
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// params
|
// params
|
||||||
packet->raw[packet->rawlen++] = (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS);
|
packet->raw[packet->rawlen++] = (ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS);
|
||||||
packet->raw[packet->rawlen++] = ISO15693_GET_NXP_SYSTEM_INFO;
|
packet->raw[packet->rawlen++] = ISO15693_GET_NXP_SYSTEM_INFO;
|
||||||
packet->raw[packet->rawlen++] = 0x04; // IC manufacturer code
|
packet->raw[packet->rawlen++] = 0x04; // IC manufacturer code
|
||||||
|
@ -836,7 +836,7 @@ static int NxpSysInfo(uint8_t *uid) {
|
||||||
packet->flags = (ISO15_CONNECT | ISO15_HIGH_SPEED | ISO15_READ_RESPONSE);
|
packet->flags = (ISO15_CONNECT | ISO15_HIGH_SPEED | ISO15_READ_RESPONSE);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
free(packet);
|
free(packet);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
@ -961,7 +961,7 @@ static int CmdHF15Info(const char *Cmd) {
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISO15693 protocol params
|
// ISO15693 protocol params
|
||||||
packet->raw[packet->rawlen++] = arg_get_raw_flag(uidlen, unaddressed, scan, add_option);
|
packet->raw[packet->rawlen++] = arg_get_raw_flag(uidlen, unaddressed, scan, add_option);
|
||||||
packet->raw[packet->rawlen++] = ISO15693_GET_SYSTEM_INFO;
|
packet->raw[packet->rawlen++] = ISO15693_GET_SYSTEM_INFO;
|
||||||
|
|
||||||
|
@ -989,7 +989,7 @@ static int CmdHF15Info(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
free(packet);
|
free(packet);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
@ -1617,7 +1617,7 @@ static int CmdHF15WriteDsfid(const char *Cmd) {
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// params
|
// params
|
||||||
packet->raw[packet->rawlen++] = arg_get_raw_flag(uidlen, unaddressed, scan, add_option);
|
packet->raw[packet->rawlen++] = arg_get_raw_flag(uidlen, unaddressed, scan, add_option);
|
||||||
packet->raw[packet->rawlen++] = ISO15693_WRITE_DSFID;
|
packet->raw[packet->rawlen++] = ISO15693_WRITE_DSFID;
|
||||||
|
|
||||||
|
@ -1651,7 +1651,7 @@ static int CmdHF15WriteDsfid(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
free(packet);
|
free(packet);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
@ -1684,9 +1684,9 @@ static int CmdHF15Dump(const char *Cmd) {
|
||||||
void *argtable[6 + 5] = {0};
|
void *argtable[6 + 5] = {0};
|
||||||
uint8_t arglen = arg_add_default(argtable);
|
uint8_t arglen = arg_add_default(argtable);
|
||||||
argtable[arglen++] = arg_str0("f", "file", "<fn>", "Specify a filename for dump file"),
|
argtable[arglen++] = arg_str0("f", "file", "<fn>", "Specify a filename for dump file"),
|
||||||
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
||||||
argtable[arglen++] = arg_lit0(NULL, "ns", "no save to file"),
|
argtable[arglen++] = arg_lit0(NULL, "ns", "no save to file"),
|
||||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||||
argtable[arglen++] = arg_param_end;
|
argtable[arglen++] = arg_param_end;
|
||||||
|
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
@ -1801,7 +1801,7 @@ static int CmdHF15Dump(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000)) {
|
||||||
|
|
||||||
|
@ -1846,7 +1846,7 @@ static int CmdHF15Dump(const char *Cmd) {
|
||||||
// copy read data
|
// copy read data
|
||||||
memcpy(mem[blocknum].block, d + 1 + offset, blklen);
|
memcpy(mem[blocknum].block, d + 1 + offset, blklen);
|
||||||
memcpy(data + (blocknum * 4), d + 1 + offset, 4);
|
memcpy(data + (blocknum * 4), d + 1 + offset, 4);
|
||||||
|
|
||||||
retry = 0;
|
retry = 0;
|
||||||
blocknum++;
|
blocknum++;
|
||||||
|
|
||||||
|
@ -1930,7 +1930,7 @@ static int CmdHF15Raw(const char *Cmd) {
|
||||||
arg_lit0("r", NULL, "do not read response"),
|
arg_lit0("r", NULL, "do not read response"),
|
||||||
arg_str1("d", "data", "<hex>", "raw bytes to send"),
|
arg_str1("d", "data", "<hex>", "raw bytes to send"),
|
||||||
arg_lit0("w", "wait", "wait longer for response. For writes etc."),
|
arg_lit0("w", "wait", "wait longer for response. For writes etc."),
|
||||||
arg_lit0("a", NULL, "activate field"),
|
arg_lit0("a", NULL, "activate field"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1994,9 +1994,9 @@ static int CmdHF15Raw(const char *Cmd) {
|
||||||
memcpy(packet->raw, data, datalen);
|
memcpy(packet->raw, data, datalen);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(datalen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(datalen));
|
||||||
free(packet);
|
free(packet);
|
||||||
|
|
||||||
if (read_respone) {
|
if (read_respone) {
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000)) {
|
||||||
|
@ -2038,7 +2038,7 @@ static int CmdHF15Readmulti(const char *Cmd) {
|
||||||
argtable[arglen++] = arg_int1("b", NULL, "<dec>", "first page number (0-255)");
|
argtable[arglen++] = arg_int1("b", NULL, "<dec>", "first page number (0-255)");
|
||||||
argtable[arglen++] = arg_int1(NULL, "cnt", "<dec>", "number of pages (1-6)");
|
argtable[arglen++] = arg_int1(NULL, "cnt", "<dec>", "number of pages (1-6)");
|
||||||
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
||||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||||
argtable[arglen++] = arg_param_end;
|
argtable[arglen++] = arg_param_end;
|
||||||
|
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
@ -2133,7 +2133,7 @@ static int CmdHF15Readmulti(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
free(packet);
|
free(packet);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
@ -2194,7 +2194,7 @@ static int CmdHF15Readblock(const char *Cmd) {
|
||||||
uint8_t arglen = arg_add_default(argtable);
|
uint8_t arglen = arg_add_default(argtable);
|
||||||
argtable[arglen++] = arg_int1("b", "blk", "<dec>", "page number (0-255)");
|
argtable[arglen++] = arg_int1("b", "blk", "<dec>", "page number (0-255)");
|
||||||
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
||||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||||
argtable[arglen++] = arg_param_end;
|
argtable[arglen++] = arg_param_end;
|
||||||
|
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
@ -2281,7 +2281,7 @@ static int CmdHF15Readblock(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
free(packet);
|
free(packet);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
@ -2313,20 +2313,20 @@ static int CmdHF15Readblock(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "#%3d |lck| ascii", blockno);
|
PrintAndLogEx(INFO, "#%3d |lck| ascii", blockno);
|
||||||
PrintAndLogEx(INFO, "------------+---+------");
|
PrintAndLogEx(INFO, "------------+---+------");
|
||||||
PrintAndLogEx(INFO, "%s| %s | %s"
|
PrintAndLogEx(INFO, "%s| %s | %s"
|
||||||
, sprint_hex(d + offset, 8)
|
, sprint_hex(d + offset, 8)
|
||||||
, lck
|
, lck
|
||||||
, sprint_ascii(d + offset, 8)
|
, sprint_ascii(d + offset, 8)
|
||||||
);
|
);
|
||||||
PrintAndLogEx(INFO, "------------+---+------");
|
PrintAndLogEx(INFO, "------------+---+------");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(INFO, "#%3d |lck| ascii", blockno);
|
PrintAndLogEx(INFO, "#%3d |lck| ascii", blockno);
|
||||||
PrintAndLogEx(INFO, "------------+---+------");
|
PrintAndLogEx(INFO, "------------+---+------");
|
||||||
PrintAndLogEx(INFO, "%s| %s | %s"
|
PrintAndLogEx(INFO, "%s| %s | %s"
|
||||||
, sprint_hex(d + offset, 4)
|
, sprint_hex(d + offset, 4)
|
||||||
, lck
|
, lck
|
||||||
, sprint_ascii(d + offset, 4)
|
, sprint_ascii(d + offset, 4)
|
||||||
);
|
);
|
||||||
PrintAndLogEx(INFO, "------------+---+------");
|
PrintAndLogEx(INFO, "------------+---+------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2345,10 +2345,10 @@ static int hf_15_write_blk(uint8_t *pm3flags, uint16_t flags, uint8_t *uid, bool
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISO15693 protocol params
|
// ISO15693 protocol params
|
||||||
packet->raw[packet->rawlen++] = flags;
|
packet->raw[packet->rawlen++] = flags;
|
||||||
packet->raw[packet->rawlen++] = ISO15693_WRITEBLOCK;
|
packet->raw[packet->rawlen++] = ISO15693_WRITEBLOCK;
|
||||||
|
|
||||||
// add UID
|
// add UID
|
||||||
if (uid) {
|
if (uid) {
|
||||||
memcpy(packet->raw + packet->rawlen, uid, HF15_UID_LENGTH);
|
memcpy(packet->raw + packet->rawlen, uid, HF15_UID_LENGTH);
|
||||||
|
@ -2364,7 +2364,7 @@ static int hf_15_write_blk(uint8_t *pm3flags, uint16_t flags, uint8_t *uid, bool
|
||||||
packet->rawlen += 2;
|
packet->rawlen += 2;
|
||||||
|
|
||||||
// PM3 params
|
// PM3 params
|
||||||
if (pm3flags ) {
|
if (pm3flags) {
|
||||||
packet->flags = *pm3flags;
|
packet->flags = *pm3flags;
|
||||||
} else {
|
} else {
|
||||||
packet->flags = (ISO15_CONNECT | ISO15_READ_RESPONSE | ISO15_LONG_WAIT);
|
packet->flags = (ISO15_CONNECT | ISO15_READ_RESPONSE | ISO15_LONG_WAIT);
|
||||||
|
@ -2374,7 +2374,7 @@ static int hf_15_write_blk(uint8_t *pm3flags, uint16_t flags, uint8_t *uid, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t*)packet, ISO15_RAW_LEN(packet->rawlen));
|
SendCommandNG(CMD_HF_ISO15693_COMMAND, (uint8_t *)packet, ISO15_RAW_LEN(packet->rawlen));
|
||||||
free(packet);
|
free(packet);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
@ -2487,9 +2487,9 @@ static int CmdHF15Restore(const char *Cmd) {
|
||||||
void *argtable[6 + 5] = {0};
|
void *argtable[6 + 5] = {0};
|
||||||
uint8_t arglen = arg_add_default(argtable);
|
uint8_t arglen = arg_add_default(argtable);
|
||||||
argtable[arglen++] = arg_str0("f", "file", "<fn>", "Specify a filename for dump file"),
|
argtable[arglen++] = arg_str0("f", "file", "<fn>", "Specify a filename for dump file"),
|
||||||
argtable[arglen++] = arg_int0("r", "retry", "<dec>", "number of retries (def 3)"),
|
argtable[arglen++] = arg_int0("r", "retry", "<dec>", "number of retries (def 3)"),
|
||||||
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
||||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||||
argtable[arglen++] = arg_param_end;
|
argtable[arglen++] = arg_param_end;
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
|
||||||
|
@ -2584,7 +2584,7 @@ static int CmdHF15Restore(const char *Cmd) {
|
||||||
size_t bytes = 0;
|
size_t bytes = 0;
|
||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
while (bytes < bytes_read) {
|
while (bytes < bytes_read) {
|
||||||
|
|
||||||
uint8_t data[blocksize];
|
uint8_t data[blocksize];
|
||||||
|
|
||||||
// copy over the data to the request
|
// copy over the data to the request
|
||||||
|
@ -2635,7 +2635,7 @@ static int CmdHF15Restore(const char *Cmd) {
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(HINT, "try `" _YELLOW_("hf 15 dump --ns") "` to read your card to verify");
|
PrintAndLogEx(HINT, "try `" _YELLOW_("hf 15 dump --ns") "` to read your card to verify");
|
||||||
PrintAndLogEx(INFO, "Done!");
|
PrintAndLogEx(INFO, "Done!");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3224,7 +3224,7 @@ static int CmdHF15Wipe(const char *Cmd) {
|
||||||
void *argtable[6 + 3] = {0};
|
void *argtable[6 + 3] = {0};
|
||||||
uint8_t arglen = arg_add_default(argtable);
|
uint8_t arglen = arg_add_default(argtable);
|
||||||
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)"),
|
||||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||||
argtable[arglen++] = arg_param_end;
|
argtable[arglen++] = arg_param_end;
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
|
||||||
|
|
|
@ -829,9 +829,9 @@ static int ulev1_print_configuration(uint64_t tagtype, uint8_t *data, uint8_t st
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(INFO, " mirror start page %02X | byte pos %02X - %s"
|
PrintAndLogEx(INFO, " mirror start page %02X | byte pos %02X - %s"
|
||||||
, mirror_page, mirror_byte
|
, mirror_page, mirror_byte
|
||||||
, (mirror_page >= 0x4 && ((mirror_user_mem_start_byte + bytes_required_for_mirror_data) <= 144)) ? _GREEN_("ok") : _YELLOW_("Invalid value")
|
, (mirror_page >= 0x4 && ((mirror_user_mem_start_byte + bytes_required_for_mirror_data) <= 144)) ? _GREEN_("ok") : _YELLOW_("Invalid value")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (tagtype & (MFU_TT_NTAG_213_F | MFU_TT_NTAG_216_F)) {
|
} else if (tagtype & (MFU_TT_NTAG_213_F | MFU_TT_NTAG_216_F)) {
|
||||||
|
|
|
@ -81,11 +81,11 @@ static model_t models[] = {
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
static uint8_t * map8to1(gdImagePtr img, int color) {
|
static uint8_t *map8to1(gdImagePtr img, int color) {
|
||||||
// Calculate width rounding up
|
// Calculate width rounding up
|
||||||
uint16_t width8 = (gdImageSX(img) + 7) / 8;
|
uint16_t width8 = (gdImageSX(img) + 7) / 8;
|
||||||
|
|
||||||
uint8_t * colormap8 = calloc(width8 * gdImageSY(img), sizeof(uint8_t));
|
uint8_t *colormap8 = calloc(width8 * gdImageSY(img), sizeof(uint8_t));
|
||||||
if (!colormap8) {
|
if (!colormap8) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -668,14 +668,14 @@ static int CmdHF14AWSLoad(const char *Cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t * black_plane = map8to1(pal_img, 1);
|
uint8_t *black_plane = map8to1(pal_img, 1);
|
||||||
if (!black_plane) {
|
if (!black_plane) {
|
||||||
PrintAndLogEx(WARNING, "Could not convert image to bit plane");
|
PrintAndLogEx(WARNING, "Could not convert image to bit plane");
|
||||||
gdImageDestroy(pal_img);
|
gdImageDestroy(pal_img);
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t * red_plane = NULL;
|
uint8_t *red_plane = NULL;
|
||||||
if (model_has_red) {
|
if (model_has_red) {
|
||||||
red_plane = map8to1(pal_img, 2);
|
red_plane = map8to1(pal_img, 2);
|
||||||
if (!red_plane) {
|
if (!red_plane) {
|
||||||
|
|
|
@ -441,23 +441,23 @@ static void xerox_generate_partno(const uint8_t *data, char *pn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xerox_print_hdr(void) {
|
static void xerox_print_hdr(void) {
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(INFO, "block# | data | ascii");
|
PrintAndLogEx(INFO, "block# | data | ascii");
|
||||||
PrintAndLogEx(INFO, "---------+--------------+----------");
|
PrintAndLogEx(INFO, "---------+--------------+----------");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xerox_print(uint8_t *data, uint16_t datalen) {
|
static void xerox_print(uint8_t *data, uint16_t datalen) {
|
||||||
|
|
||||||
uint16_t blockno = datalen / XEROX_BLOCK_SIZE;
|
uint16_t blockno = datalen / XEROX_BLOCK_SIZE;
|
||||||
|
|
||||||
for (int i = 0; i < blockno; i++) {
|
for (int i = 0; i < blockno; i++) {
|
||||||
PrintAndLogEx(INFO,
|
PrintAndLogEx(INFO,
|
||||||
"%3d/0x%02X | %s | %s",
|
"%3d/0x%02X | %s | %s",
|
||||||
i,
|
i,
|
||||||
i,
|
i,
|
||||||
sprint_hex(data + (i * XEROX_BLOCK_SIZE), XEROX_BLOCK_SIZE),
|
sprint_hex(data + (i * XEROX_BLOCK_SIZE), XEROX_BLOCK_SIZE),
|
||||||
sprint_ascii(data + (i * XEROX_BLOCK_SIZE), XEROX_BLOCK_SIZE)
|
sprint_ascii(data + (i * XEROX_BLOCK_SIZE), XEROX_BLOCK_SIZE)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,43 +477,43 @@ typedef struct {
|
||||||
|
|
||||||
// https://gist.github.com/JeroenSteen/4b45886b8d87fa0530af9b0364e6b277
|
// https://gist.github.com/JeroenSteen/4b45886b8d87fa0530af9b0364e6b277
|
||||||
static const xerox_part_t xerox_part_mappings[] = {
|
static const xerox_part_t xerox_part_mappings[] = {
|
||||||
{"cyan", "006R01532" , "DMO", "sold"},
|
{"cyan", "006R01532", "DMO", "sold"},
|
||||||
{"cyan", "006R01660", "DMO", "sold"},
|
{"cyan", "006R01660", "DMO", "sold"},
|
||||||
{"cyan", "006R01739", "DMO", "sold"},
|
{"cyan", "006R01739", "DMO", "sold"},
|
||||||
{"cyan", "006R01524", "WW", "metered"},
|
{"cyan", "006R01524", "WW", "metered"},
|
||||||
{"cyan", "006R01528", "NA/ESG", "sold"},
|
{"cyan", "006R01528", "NA/ESG", "sold"},
|
||||||
{"cyan", "006R01656", "NA/ESG", "sold"},
|
{"cyan", "006R01656", "NA/ESG", "sold"},
|
||||||
{"cyan", "006R01735", "NA/ESG", "sold"},
|
{"cyan", "006R01735", "NA/ESG", "sold"},
|
||||||
|
|
||||||
{"magenta", "006R01531", "DMO", "sold"},
|
{"magenta", "006R01531", "DMO", "sold"},
|
||||||
{"magenta", "006R01661", "DMO", "sold"},
|
{"magenta", "006R01661", "DMO", "sold"},
|
||||||
{"magenta", "006R01740", "DMO", "sold"},
|
{"magenta", "006R01740", "DMO", "sold"},
|
||||||
{"magenta", "006R01523", "WW", "metered"},
|
{"magenta", "006R01523", "WW", "metered"},
|
||||||
{"magenta", "006R01527", "NA/ESG", "sold"},
|
{"magenta", "006R01527", "NA/ESG", "sold"},
|
||||||
{"magenta", "006R01657", "NA/ESG", "sold"},
|
{"magenta", "006R01657", "NA/ESG", "sold"},
|
||||||
{"magenta", "006R01736", "NA/ESG", "sold"},
|
{"magenta", "006R01736", "NA/ESG", "sold"},
|
||||||
|
|
||||||
{"yellow", "006R01530", "DMO", "sold"},
|
{"yellow", "006R01530", "DMO", "sold"},
|
||||||
{"yellow", "006R01662", "DMO", "sold"},
|
{"yellow", "006R01662", "DMO", "sold"},
|
||||||
{"yellow", "006R01741", "DMO", "sold"},
|
{"yellow", "006R01741", "DMO", "sold"},
|
||||||
{"yellow", "006R01522", "WW", "metered"},
|
{"yellow", "006R01522", "WW", "metered"},
|
||||||
{"yellow", "006R01526", "NA/ESG", "sold"},
|
{"yellow", "006R01526", "NA/ESG", "sold"},
|
||||||
{"yellow", "006R01658", "NA/ESG", "sold"},
|
{"yellow", "006R01658", "NA/ESG", "sold"},
|
||||||
{"yellow", "006R01737", "NA/ESG", "sold"},
|
{"yellow", "006R01737", "NA/ESG", "sold"},
|
||||||
|
|
||||||
{"black", "006R01529", "DMO", "sold"},
|
{"black", "006R01529", "DMO", "sold"},
|
||||||
{"black", "006R01659", "DMO", "sold"},
|
{"black", "006R01659", "DMO", "sold"},
|
||||||
{"black", "006R01738", "DMO", "sold"},
|
{"black", "006R01738", "DMO", "sold"},
|
||||||
{"black", "006R01521", "WW", "metered"},
|
{"black", "006R01521", "WW", "metered"},
|
||||||
{"black", "006R01525", "NA/ESG", "sold"},
|
{"black", "006R01525", "NA/ESG", "sold"},
|
||||||
{"black", "006R01655", "NA/ESG", "sold"},
|
{"black", "006R01655", "NA/ESG", "sold"},
|
||||||
{"black", "006R01734", "NA/ESG", "sold"},
|
{"black", "006R01734", "NA/ESG", "sold"},
|
||||||
{"", "", "", ""} // must be the last entry
|
{"", "", "", ""} // must be the last entry
|
||||||
};
|
};
|
||||||
|
|
||||||
// get a product description based on the UID
|
// get a product description based on the UID
|
||||||
// returns description of the best match
|
// returns description of the best match
|
||||||
static const xerox_part_t *get_xerox_part_info(const char* pn) {
|
static const xerox_part_t *get_xerox_part_info(const char *pn) {
|
||||||
for (int i = 0; i < ARRAYLEN(xerox_part_mappings); ++i) {
|
for (int i = 0; i < ARRAYLEN(xerox_part_mappings); ++i) {
|
||||||
if (str_startswith(pn, xerox_part_mappings[i].partnumber) == 0) {
|
if (str_startswith(pn, xerox_part_mappings[i].partnumber) == 0) {
|
||||||
return &xerox_part_mappings[i];
|
return &xerox_part_mappings[i];
|
||||||
|
@ -533,8 +533,8 @@ int read_xerox_uid(bool loop, bool verbose) {
|
||||||
if (status != PM3_SUCCESS) {
|
if (status != PM3_SUCCESS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == PM3_SUCCESS) {
|
if (status == PM3_SUCCESS) {
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(SUCCESS, " UID..... %s", sprint_hex(card.uid, card.uidlen));
|
PrintAndLogEx(SUCCESS, " UID..... %s", sprint_hex(card.uid, card.uidlen));
|
||||||
|
@ -686,14 +686,14 @@ static int CmdHFXeroxInfo(const char *Cmd) {
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(FAILED, "Fuji/Xerox tag read failed");
|
PrintAndLogEx(FAILED, "Fuji/Xerox tag read failed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_off_field();
|
switch_off_field();
|
||||||
|
|
||||||
char pn[13];
|
char pn[13];
|
||||||
xerox_generate_partno(data, pn);
|
xerox_generate_partno(data, pn);
|
||||||
PrintAndLogEx(INFO, "-------- " _CYAN_("tag memory") " ---------");
|
PrintAndLogEx(INFO, "-------- " _CYAN_("tag memory") " ---------");
|
||||||
PrintAndLogEx(SUCCESS, " PartNo... %s", pn);
|
PrintAndLogEx(SUCCESS, " PartNo... %s", pn);
|
||||||
PrintAndLogEx(SUCCESS, " Date..... %02d.%02d.%02d", data[8], data[9], data[10]);
|
PrintAndLogEx(SUCCESS, " Date..... %02d.%02d.%02d", data[8], data[9], data[10]);
|
||||||
PrintAndLogEx(SUCCESS, " Serial... %d", (data[14] << 16) | (data[13] << 8) | data[12]);
|
PrintAndLogEx(SUCCESS, " Serial... %d", (data[14] << 16) | (data[13] << 8) | data[12]);
|
||||||
|
@ -704,7 +704,7 @@ static int CmdHFXeroxInfo(const char *Cmd) {
|
||||||
PrintAndLogEx(SUCCESS, "Color..... %s", item->color);
|
PrintAndLogEx(SUCCESS, "Color..... %s", item->color);
|
||||||
PrintAndLogEx(SUCCESS, "Region.... %s", item->region);
|
PrintAndLogEx(SUCCESS, "Region.... %s", item->region);
|
||||||
PrintAndLogEx(SUCCESS, "M/s....... %s", item->ms);
|
PrintAndLogEx(SUCCESS, "M/s....... %s", item->ms);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -722,7 +722,7 @@ static int CmdHFXeroxDump(const char *Cmd) {
|
||||||
arg_str0("f", "file", "<fn>", "filename to save dump to"),
|
arg_str0("f", "file", "<fn>", "filename to save dump to"),
|
||||||
arg_lit0("d", "decrypt", "decrypt secret blocks"),
|
arg_lit0("d", "decrypt", "decrypt secret blocks"),
|
||||||
arg_lit0(NULL, "ns", "no save to file"),
|
arg_lit0(NULL, "ns", "no save to file"),
|
||||||
arg_lit0("v", "verbose", "verbose output"),
|
arg_lit0("v", "verbose", "verbose output"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
@ -757,7 +757,7 @@ static int CmdHFXeroxDump(const char *Cmd) {
|
||||||
uint8_t data[256 * XEROX_BLOCK_SIZE] = {0};
|
uint8_t data[256 * XEROX_BLOCK_SIZE] = {0};
|
||||||
|
|
||||||
// set up the read command
|
// set up the read command
|
||||||
packet->flags = ( ISO14B_CONNECT | ISO14B_APPEND_CRC | ISO14B_RAW );
|
packet->flags = (ISO14B_CONNECT | ISO14B_APPEND_CRC | ISO14B_RAW);
|
||||||
packet->raw[packet->rawlen++] = 0x02;
|
packet->raw[packet->rawlen++] = 0x02;
|
||||||
|
|
||||||
// add one for command byte
|
// add one for command byte
|
||||||
|
@ -783,7 +783,7 @@ static int CmdHFXeroxDump(const char *Cmd) {
|
||||||
resp.cmd, resp.length, resp.magic, resp.status, resp.crc, resp.oldarg[0], resp.oldarg[1], resp.oldarg[2],
|
resp.cmd, resp.length, resp.magic, resp.status, resp.crc, resp.oldarg[0], resp.oldarg[1], resp.oldarg[2],
|
||||||
resp.data.asBytes[0], resp.data.asBytes[1], resp.data.asBytes[2], resp.ng ? 't' : 'f');
|
resp.data.asBytes[0], resp.data.asBytes[1], resp.data.asBytes[2], resp.ng ? 't' : 'f');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (resp.length < 7) {
|
if (resp.length < 7) {
|
||||||
PrintAndLogEx(FAILED, "retrying one more time");
|
PrintAndLogEx(FAILED, "retrying one more time");
|
||||||
continue;
|
continue;
|
||||||
|
@ -902,10 +902,10 @@ static int CmdHFXeroxDump(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "Using UID as filename");
|
PrintAndLogEx(INFO, "Using UID as filename");
|
||||||
fptr += snprintf(fptr, sizeof(filename), "hf-xerox-");
|
fptr += snprintf(fptr, sizeof(filename), "hf-xerox-");
|
||||||
FillFileNameByUID(fptr
|
FillFileNameByUID(fptr
|
||||||
, SwapEndian64(card.uid, card.uidlen, 8)
|
, SwapEndian64(card.uid, card.uidlen, 8)
|
||||||
, (decrypt) ? "-dump-dec" : "-dump"
|
, (decrypt) ? "-dump-dec" : "-dump"
|
||||||
, card.uidlen
|
, card.uidlen
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pm3_save_dump(filename, data, blockno * XEROX_BLOCK_SIZE, jsf14b_v2);
|
pm3_save_dump(filename, data, blockno * XEROX_BLOCK_SIZE, jsf14b_v2);
|
||||||
|
@ -956,7 +956,7 @@ static int CmdHFXeroxView(const char *Cmd) {
|
||||||
|
|
||||||
char pn[13];
|
char pn[13];
|
||||||
xerox_generate_partno(tmp, pn);
|
xerox_generate_partno(tmp, pn);
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(INFO, "-------- " _CYAN_("tag memory") " ---------");
|
PrintAndLogEx(INFO, "-------- " _CYAN_("tag memory") " ---------");
|
||||||
PrintAndLogEx(SUCCESS, " PartNo... %s", pn);
|
PrintAndLogEx(SUCCESS, " PartNo... %s", pn);
|
||||||
|
@ -969,9 +969,9 @@ static int CmdHFXeroxView(const char *Cmd) {
|
||||||
PrintAndLogEx(SUCCESS, "Color..... %s", item->color);
|
PrintAndLogEx(SUCCESS, "Color..... %s", item->color);
|
||||||
PrintAndLogEx(SUCCESS, "Region.... %s", item->region);
|
PrintAndLogEx(SUCCESS, "Region.... %s", item->region);
|
||||||
PrintAndLogEx(SUCCESS, "M/s....... %s", item->ms);
|
PrintAndLogEx(SUCCESS, "M/s....... %s", item->ms);
|
||||||
}
|
}
|
||||||
xerox_print_hdr();
|
xerox_print_hdr();
|
||||||
xerox_print(dump, bytes_read);
|
xerox_print(dump, bytes_read);
|
||||||
xerox_print_footer();
|
xerox_print_footer();
|
||||||
|
|
||||||
free(dump);
|
free(dump);
|
||||||
|
@ -985,7 +985,7 @@ static int CmdHFXeroxList(const char *Cmd) {
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||||
{"list", CmdHFXeroxList, AlwaysAvailable, "List ISO-14443B history"},
|
{"list", CmdHFXeroxList, AlwaysAvailable, "List ISO-14443B history"},
|
||||||
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("general") " -----------------------"},
|
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("general") " -----------------------"},
|
||||||
{"info", CmdHFXeroxInfo, IfPm3Iso14443b, "Short info on Fuji/Xerox tag"},
|
{"info", CmdHFXeroxInfo, IfPm3Iso14443b, "Short info on Fuji/Xerox tag"},
|
||||||
{"dump", CmdHFXeroxDump, IfPm3Iso14443b, "Read all memory pages of an Fuji/Xerox tag, save to file"},
|
{"dump", CmdHFXeroxDump, IfPm3Iso14443b, "Read all memory pages of an Fuji/Xerox tag, save to file"},
|
||||||
{"reader", CmdHFXeroxReader, IfPm3Iso14443b, "Act like a Fuji/Xerox reader"},
|
{"reader", CmdHFXeroxReader, IfPm3Iso14443b, "Act like a Fuji/Xerox reader"},
|
||||||
|
|
|
@ -2890,7 +2890,7 @@ static int CmdEMVReader(const char *Cmd) {
|
||||||
} while (continuous);
|
} while (continuous);
|
||||||
|
|
||||||
DropFieldEx(channel);
|
DropFieldEx(channel);
|
||||||
|
|
||||||
SetAPDULogging(old_logging);
|
SetAPDULogging(old_logging);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ struct ycbcr_t {
|
||||||
int cr;
|
int cr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void rgb_to_ycbcr(int rgb, struct ycbcr_t * ycbcr) {
|
static void rgb_to_ycbcr(int rgb, struct ycbcr_t *ycbcr) {
|
||||||
int r = gdTrueColorGetRed(rgb);
|
int r = gdTrueColorGetRed(rgb);
|
||||||
int g = gdTrueColorGetGreen(rgb);
|
int g = gdTrueColorGetGreen(rgb);
|
||||||
int b = gdTrueColorGetBlue(rgb);
|
int b = gdTrueColorGetBlue(rgb);
|
||||||
|
@ -25,7 +25,7 @@ static void rgb_to_ycbcr(int rgb, struct ycbcr_t * ycbcr) {
|
||||||
ycbcr->cr = (r * 32768 + g * -27439 + b * -5329) / 65536 + 128;
|
ycbcr->cr = (r * 32768 + g * -27439 + b * -5329) / 65536 + 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void cap_comp(int * x) {
|
static inline void cap_comp(int *x) {
|
||||||
if (*x < 0) {
|
if (*x < 0) {
|
||||||
*x = 0;
|
*x = 0;
|
||||||
} else if (*x > 255) {
|
} else if (*x > 255) {
|
||||||
|
@ -33,7 +33,7 @@ static inline void cap_comp(int * x) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gdImagePtr img_palettize(gdImagePtr rgb, int * palette, int palette_size) {
|
gdImagePtr img_palettize(gdImagePtr rgb, int *palette, int palette_size) {
|
||||||
assert(rgb != NULL);
|
assert(rgb != NULL);
|
||||||
assert(palette != NULL);
|
assert(palette != NULL);
|
||||||
assert(palette_size >= 2 && palette_size < 256);
|
assert(palette_size >= 2 && palette_size < 256);
|
||||||
|
@ -45,7 +45,7 @@ gdImagePtr img_palettize(gdImagePtr rgb, int * palette, int palette_size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate space for palette in YCbCr
|
// Allocate space for palette in YCbCr
|
||||||
struct ycbcr_t * pal_ycbcr = calloc(palette_size, sizeof(struct ycbcr_t));
|
struct ycbcr_t *pal_ycbcr = calloc(palette_size, sizeof(struct ycbcr_t));
|
||||||
if (!pal_ycbcr) {
|
if (!pal_ycbcr) {
|
||||||
gdImageDestroy(res);
|
gdImageDestroy(res);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -60,7 +60,7 @@ gdImagePtr img_palettize(gdImagePtr rgb, int * palette, int palette_size) {
|
||||||
* To reduce shifts and increase accuracy, each entry is stored with 16x times the error,
|
* To reduce shifts and increase accuracy, each entry is stored with 16x times the error,
|
||||||
* and gets divided by that amount when it is read.
|
* and gets divided by that amount when it is read.
|
||||||
*/
|
*/
|
||||||
struct ycbcr_t * forward = calloc(gdImageSX(rgb) + 2, sizeof(struct ycbcr_t));
|
struct ycbcr_t *forward = calloc(gdImageSX(rgb) + 2, sizeof(struct ycbcr_t));
|
||||||
if (!forward) {
|
if (!forward) {
|
||||||
free(pal_ycbcr);
|
free(pal_ycbcr);
|
||||||
gdImageDestroy(res);
|
gdImageDestroy(res);
|
||||||
|
@ -108,10 +108,10 @@ gdImagePtr img_palettize(gdImagePtr rgb, int * palette, int palette_size) {
|
||||||
};
|
};
|
||||||
|
|
||||||
int can_score = (
|
int can_score = (
|
||||||
can_err.y * can_err.y +
|
can_err.y * can_err.y +
|
||||||
can_err.cb * can_err.cb +
|
can_err.cb * can_err.cb +
|
||||||
can_err.cr * can_err.cr
|
can_err.cr * can_err.cr
|
||||||
);
|
);
|
||||||
|
|
||||||
if (can_score < best_score) {
|
if (can_score < best_score) {
|
||||||
best_idx = can_idx;
|
best_idx = can_idx;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* A comparison can be found at https://twitter.com/Socram4x8/status/1733157380097995205/photo/1.
|
* A comparison can be found at https://twitter.com/Socram4x8/status/1733157380097995205/photo/1.
|
||||||
*/
|
*/
|
||||||
gdImagePtr img_palettize(gdImagePtr rgb, int * palette, int palette_size);
|
gdImagePtr img_palettize(gdImagePtr rgb, int *palette, int palette_size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function scales and crops the image to the given size.
|
* This function scales and crops the image to the given size.
|
||||||
|
|
|
@ -182,6 +182,7 @@ const static vocabulary_t vocabulary[] = {
|
||||||
{ 0, "hf 15 restore" },
|
{ 0, "hf 15 restore" },
|
||||||
{ 0, "hf 15 samples" },
|
{ 0, "hf 15 samples" },
|
||||||
{ 1, "hf 15 view" },
|
{ 1, "hf 15 view" },
|
||||||
|
{ 0, "hf 15 wipe" },
|
||||||
{ 0, "hf 15 wrbl" },
|
{ 0, "hf 15 wrbl" },
|
||||||
{ 0, "hf 15 sim" },
|
{ 0, "hf 15 sim" },
|
||||||
{ 0, "hf 15 eload" },
|
{ 0, "hf 15 eload" },
|
||||||
|
@ -223,11 +224,11 @@ const static vocabulary_t vocabulary[] = {
|
||||||
{ 1, "hf emrtd list" },
|
{ 1, "hf emrtd list" },
|
||||||
{ 1, "hf felica help" },
|
{ 1, "hf felica help" },
|
||||||
{ 1, "hf felica list" },
|
{ 1, "hf felica list" },
|
||||||
{ 0, "hf felica reader" },
|
|
||||||
{ 0, "hf felica info" },
|
{ 0, "hf felica info" },
|
||||||
{ 0, "hf felica sniff" },
|
|
||||||
{ 0, "hf felica raw" },
|
{ 0, "hf felica raw" },
|
||||||
{ 0, "hf felica rdbl" },
|
{ 0, "hf felica rdbl" },
|
||||||
|
{ 0, "hf felica reader" },
|
||||||
|
{ 0, "hf felica sniff" },
|
||||||
{ 0, "hf felica wrbl" },
|
{ 0, "hf felica wrbl" },
|
||||||
{ 0, "hf felica rqservice" },
|
{ 0, "hf felica rqservice" },
|
||||||
{ 0, "hf felica rqresponse" },
|
{ 0, "hf felica rqresponse" },
|
||||||
|
@ -502,11 +503,13 @@ const static vocabulary_t vocabulary[] = {
|
||||||
{ 0, "hf vas reader" },
|
{ 0, "hf vas reader" },
|
||||||
{ 1, "hf vas decrypt" },
|
{ 1, "hf vas decrypt" },
|
||||||
{ 1, "hf waveshare help" },
|
{ 1, "hf waveshare help" },
|
||||||
{ 0, "hf waveshare loadbmp" },
|
{ 1, "hf waveshare load" },
|
||||||
{ 1, "hf xerox help" },
|
{ 1, "hf xerox help" },
|
||||||
|
{ 1, "hf xerox list" },
|
||||||
{ 0, "hf xerox info" },
|
{ 0, "hf xerox info" },
|
||||||
{ 0, "hf xerox reader" },
|
|
||||||
{ 0, "hf xerox dump" },
|
{ 0, "hf xerox dump" },
|
||||||
|
{ 0, "hf xerox reader" },
|
||||||
|
{ 1, "hf xerox view" },
|
||||||
{ 1, "hw help" },
|
{ 1, "hw help" },
|
||||||
{ 0, "hw break" },
|
{ 0, "hw break" },
|
||||||
{ 0, "hw bootloader" },
|
{ 0, "hw bootloader" },
|
||||||
|
|
|
@ -391,7 +391,7 @@ static const char *pref_show_status_msg(prefShowOpt_t opt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *pref_show_value(prefShowOpt_t opt, const char* msg) {
|
static const char *pref_show_value(prefShowOpt_t opt, const char *msg) {
|
||||||
|
|
||||||
static char s[128] = {0};
|
static char s[128] = {0};
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
@ -403,7 +403,7 @@ static const char *pref_show_value(prefShowOpt_t opt, const char* msg) {
|
||||||
sprintf(s, _GREEN_("%s"), msg);
|
sprintf(s, _GREEN_("%s"), msg);
|
||||||
return s;
|
return s;
|
||||||
case prefShowNone:
|
case prefShowNone:
|
||||||
if ((strncmp(msg, "off", 3) == 0) || (strncmp(msg, "normal", 6) ==0)) {
|
if ((strncmp(msg, "off", 3) == 0) || (strncmp(msg, "normal", 6) == 0)) {
|
||||||
sprintf(s, _WHITE_("%s"), msg);
|
sprintf(s, _WHITE_("%s"), msg);
|
||||||
} else {
|
} else {
|
||||||
sprintf(s, _GREEN_("%s"), msg);
|
sprintf(s, _GREEN_("%s"), msg);
|
||||||
|
@ -446,9 +446,9 @@ static void showEmojiState(prefShowOpt_t opt) {
|
||||||
|
|
||||||
static void showColorState(prefShowOpt_t opt) {
|
static void showColorState(prefShowOpt_t opt) {
|
||||||
PrintAndLogEx(INFO, " %s color................... %s "
|
PrintAndLogEx(INFO, " %s color................... %s "
|
||||||
, pref_show_status_msg(opt)
|
, pref_show_status_msg(opt)
|
||||||
, (g_session.supports_colors) ? pref_show_value(opt, "ansi") : pref_show_value(opt, "off")
|
, (g_session.supports_colors) ? pref_show_value(opt, "ansi") : pref_show_value(opt, "off")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showClientDebugState(prefShowOpt_t opt) {
|
static void showClientDebugState(prefShowOpt_t opt) {
|
||||||
|
@ -461,7 +461,7 @@ static void showClientDebugState(prefShowOpt_t opt) {
|
||||||
PrintAndLogEx(INFO, " %s client debug............ %s", pref_show_status_msg(opt), pref_show_value(opt, "simple"));
|
PrintAndLogEx(INFO, " %s client debug............ %s", pref_show_status_msg(opt), pref_show_value(opt, "simple"));
|
||||||
break;
|
break;
|
||||||
case cdbFULL:
|
case cdbFULL:
|
||||||
PrintAndLogEx(INFO, " %s client debug............ %s", pref_show_status_msg(opt), pref_show_value(opt,"full"));
|
PrintAndLogEx(INFO, " %s client debug............ %s", pref_show_status_msg(opt), pref_show_value(opt, "full"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintAndLogEx(INFO, " %s client debug............ %s", pref_show_status_msg(opt), pref_show_value(prefShowUnknown, "unknown"));
|
PrintAndLogEx(INFO, " %s client debug............ %s", pref_show_status_msg(opt), pref_show_value(prefShowUnknown, "unknown"));
|
||||||
|
@ -545,40 +545,40 @@ static void showOverlayPosState(void) {
|
||||||
|
|
||||||
static void showHintsState(prefShowOpt_t opt) {
|
static void showHintsState(prefShowOpt_t opt) {
|
||||||
PrintAndLogEx(INFO, " %s hints................... %s"
|
PrintAndLogEx(INFO, " %s hints................... %s"
|
||||||
, pref_show_status_msg(opt)
|
, pref_show_status_msg(opt)
|
||||||
, (g_session.show_hints) ? pref_show_value(opt,"on") : pref_show_value(opt,"off")
|
, (g_session.show_hints) ? pref_show_value(opt, "on") : pref_show_value(opt, "off")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showPlotSliderState(prefShowOpt_t opt) {
|
static void showPlotSliderState(prefShowOpt_t opt) {
|
||||||
PrintAndLogEx(INFO, " %s show plot sliders....... %s"
|
PrintAndLogEx(INFO, " %s show plot sliders....... %s"
|
||||||
, pref_show_status_msg(opt)
|
, pref_show_status_msg(opt)
|
||||||
, (g_session.overlay_sliders) ? pref_show_value(opt,"on") : pref_show_value(opt,"off")
|
, (g_session.overlay_sliders) ? pref_show_value(opt, "on") : pref_show_value(opt, "off")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showBarModeState(prefShowOpt_t opt) {
|
static void showBarModeState(prefShowOpt_t opt) {
|
||||||
|
|
||||||
switch (g_session.bar_mode) {
|
switch (g_session.bar_mode) {
|
||||||
case STYLE_BAR:
|
case STYLE_BAR:
|
||||||
PrintAndLogEx(INFO, " %s barmode................. %s", pref_show_status_msg(opt), pref_show_value(opt,"bar"));
|
PrintAndLogEx(INFO, " %s barmode................. %s", pref_show_status_msg(opt), pref_show_value(opt, "bar"));
|
||||||
break;
|
break;
|
||||||
case STYLE_MIXED:
|
case STYLE_MIXED:
|
||||||
PrintAndLogEx(INFO, " %s barmode................. %s", pref_show_status_msg(opt), pref_show_value(opt,"mixed"));
|
PrintAndLogEx(INFO, " %s barmode................. %s", pref_show_status_msg(opt), pref_show_value(opt, "mixed"));
|
||||||
break;
|
break;
|
||||||
case STYLE_VALUE:
|
case STYLE_VALUE:
|
||||||
PrintAndLogEx(INFO, " %s barmode................. %s", pref_show_status_msg(opt), pref_show_value(opt,"value"));
|
PrintAndLogEx(INFO, " %s barmode................. %s", pref_show_status_msg(opt), pref_show_value(opt, "value"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintAndLogEx(INFO, " %s barmode................. %s", pref_show_status_msg(opt), pref_show_value(prefShowUnknown,"unknown"));
|
PrintAndLogEx(INFO, " %s barmode................. %s", pref_show_status_msg(opt), pref_show_value(prefShowUnknown, "unknown"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showOutputState(prefShowOpt_t opt) {
|
static void showOutputState(prefShowOpt_t opt) {
|
||||||
PrintAndLogEx(INFO, " %s output.................. %s"
|
PrintAndLogEx(INFO, " %s output.................. %s"
|
||||||
, pref_show_status_msg(opt)
|
, pref_show_status_msg(opt)
|
||||||
, (g_session.dense_output) ? pref_show_value(opt,"dense") : pref_show_value(opt,"normal")
|
, (g_session.dense_output) ? pref_show_value(opt, "dense") : pref_show_value(opt, "normal")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showClientExeDelayState(void) {
|
static void showClientExeDelayState(void) {
|
||||||
|
|
|
@ -1265,7 +1265,7 @@ static int l_set_iso_dep_state(lua_State *L) {
|
||||||
|
|
||||||
size_t state = luaL_checknumber(L, 1);
|
size_t state = luaL_checknumber(L, 1);
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 0:
|
case 0:
|
||||||
SetISODEPState(ISODEP_INACTIVE);
|
SetISODEPState(ISODEP_INACTIVE);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
|
1722
doc/commands.json
1722
doc/commands.json
File diff suppressed because it is too large
Load diff
|
@ -241,6 +241,7 @@ Check column "offline" for their availability.
|
||||||
|`hf 15 restore `|N |`Restore from file to all memory pages of an ISO-15693 tag`
|
|`hf 15 restore `|N |`Restore from file to all memory pages of an ISO-15693 tag`
|
||||||
|`hf 15 samples `|N |`Acquire samples as reader (enables carrier, sends inquiry)`
|
|`hf 15 samples `|N |`Acquire samples as reader (enables carrier, sends inquiry)`
|
||||||
|`hf 15 view `|Y |`Display content from tag dump file`
|
|`hf 15 view `|Y |`Display content from tag dump file`
|
||||||
|
|`hf 15 wipe `|N |`Wipe card to zeros`
|
||||||
|`hf 15 wrbl `|N |`Write a block`
|
|`hf 15 wrbl `|N |`Write a block`
|
||||||
|`hf 15 sim `|N |`Fake an ISO-15693 tag`
|
|`hf 15 sim `|N |`Fake an ISO-15693 tag`
|
||||||
|`hf 15 eload `|N |`Load image file into emulator to be used by 'sim' command`
|
|`hf 15 eload `|N |`Load image file into emulator to be used by 'sim' command`
|
||||||
|
@ -314,11 +315,11 @@ Check column "offline" for their availability.
|
||||||
|------- |------- |-----------
|
|------- |------- |-----------
|
||||||
|`hf felica help `|Y |`This help`
|
|`hf felica help `|Y |`This help`
|
||||||
|`hf felica list `|Y |`List ISO 18092/FeliCa history`
|
|`hf felica list `|Y |`List ISO 18092/FeliCa history`
|
||||||
|`hf felica reader `|N |`Act like an ISO18092/FeliCa reader`
|
|
||||||
|`hf felica info `|N |`Tag information`
|
|`hf felica info `|N |`Tag information`
|
||||||
|`hf felica sniff `|N |`Sniff ISO 18092/FeliCa traffic`
|
|
||||||
|`hf felica raw `|N |`Send raw hex data to tag`
|
|`hf felica raw `|N |`Send raw hex data to tag`
|
||||||
|`hf felica rdbl `|N |`read block data from authentication-not-required Service.`
|
|`hf felica rdbl `|N |`read block data from authentication-not-required Service.`
|
||||||
|
|`hf felica reader `|N |`Act like an ISO18092/FeliCa reader`
|
||||||
|
|`hf felica sniff `|N |`Sniff ISO 18092/FeliCa traffic`
|
||||||
|`hf felica wrbl `|N |`write block data to an authentication-not-required Service.`
|
|`hf felica wrbl `|N |`write block data to an authentication-not-required Service.`
|
||||||
|`hf felica rqservice `|N |`verify the existence of Area and Service, and to acquire Key Version.`
|
|`hf felica rqservice `|N |`verify the existence of Area and Service, and to acquire Key Version.`
|
||||||
|`hf felica rqresponse `|N |`verify the existence of a card and its Mode.`
|
|`hf felica rqresponse `|N |`verify the existence of a card and its Mode.`
|
||||||
|
@ -761,7 +762,7 @@ Check column "offline" for their availability.
|
||||||
|command |offline |description
|
|command |offline |description
|
||||||
|------- |------- |-----------
|
|------- |------- |-----------
|
||||||
|`hf waveshare help `|Y |`This help`
|
|`hf waveshare help `|Y |`This help`
|
||||||
|`hf waveshare loadbmp `|N |`Load BMP file to Waveshare NFC ePaper`
|
|`hf waveshare load `|Y |`Load image file to Waveshare NFC ePaper`
|
||||||
|
|
||||||
|
|
||||||
### hf xerox
|
### hf xerox
|
||||||
|
@ -771,9 +772,11 @@ Check column "offline" for their availability.
|
||||||
|command |offline |description
|
|command |offline |description
|
||||||
|------- |------- |-----------
|
|------- |------- |-----------
|
||||||
|`hf xerox help `|Y |`This help`
|
|`hf xerox help `|Y |`This help`
|
||||||
|
|`hf xerox list `|Y |`List ISO-14443B history`
|
||||||
|`hf xerox info `|N |`Short info on Fuji/Xerox tag`
|
|`hf xerox info `|N |`Short info on Fuji/Xerox tag`
|
||||||
|`hf xerox reader `|N |`Act like a Fuji/Xerox reader`
|
|
||||||
|`hf xerox dump `|N |`Read all memory pages of an Fuji/Xerox tag, save to file`
|
|`hf xerox dump `|N |`Read all memory pages of an Fuji/Xerox tag, save to file`
|
||||||
|
|`hf xerox reader `|N |`Act like a Fuji/Xerox reader`
|
||||||
|
|`hf xerox view `|Y |`Display content from tag dump file`
|
||||||
|
|
||||||
|
|
||||||
### hw
|
### hw
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue