This commit is contained in:
iceman1001
2026-07-15 16:39:15 +02:00
parent 067688422c
commit 2c6e607110
56 changed files with 628 additions and 586 deletions
+2 -2
View File
@@ -172,7 +172,7 @@ static int saMifareChkKeys(uint8_t const blockNo, uint8_t const keyType, bool co
if (i) {
--i; // try same key once again
}
}
--selectRetries;
if (selectRetries > 0) {
@@ -210,7 +210,7 @@ static int saMifareChkKeys(uint8_t const blockNo, uint8_t const keyType, bool co
if (i) {
--i; // try same key once again
}
--selectRetries;
if (selectRetries > 0) {
continue;
+1 -1
View File
@@ -541,7 +541,7 @@ static int b64dec(const char *src, int n, char *dst) {
int len = 0;
while (src + 3 < end) {
int a = b64rev(src[0]), b = b64rev(src[1]), c = b64rev(src[2]),
d = b64rev(src[3]);
d = b64rev(src[3]);
dst[len++] = (a << 2) | (b >> 4);
if (src[2] != '=') {
dst[len++] = (b << 4) | (c >> 2);
+1 -1
View File
@@ -203,7 +203,7 @@ int CmdSmartRaw(const uint8_t prepend, const uint8_t *data, int dlen, uint8_t *o
int timeout = 600;
payload->flags = ( SC_LOG | SC_CONNECT | SC_CLEARLOG );
payload->flags = (SC_LOG | SC_CONNECT | SC_CLEARLOG);
payload->wait_delay = 0;
if (timeout > -1) {
+1 -1
View File
@@ -4826,7 +4826,7 @@ void SimulateIso14443aTagAID(uint8_t tagType, uint16_t flags, uint8_t *uid,
// Respond Not Found
dynamic_response_info.response[1 + offset] = 0x6A;
dynamic_response_info.response[2 + offset] = 0x82;
dynamic_response_info.response_n = 3 + offset;
dynamic_response_info.response_n = 3 + offset;
}
}
}
+20 -20
View File
@@ -2335,7 +2335,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
}
// remove the CRC from the cmd
cmd_len -= 2;
cmd_len -= 2;
recvLen = 0;
tag->expectFast = ((cmd[0] & ISO15_REQ_DATARATE_HIGH) == ISO15_REQ_DATARATE_HIGH);
@@ -2372,7 +2372,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
if ((cmd[0] & ISO15_REQINV_AFI) == ISO15_REQINV_AFI) {
if (cmd[cmdCpt] != tag->afi && cmd[cmdCpt] != 0) {
// bad AFI : drop request
continue;
continue;
}
cmdCpt++;
}
@@ -2380,7 +2380,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
// Check mask
if (cmdCpt >= cmd_len) {
// mask is not present : drop request
continue;
continue;
}
mask_len = cmd[cmdCpt++];
@@ -2388,10 +2388,10 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
maskCpt = 0;
// Byte comparison
while (mask_len >= 8 && cmdCpt < (uint8_t)cmd_len && maskCpt < 8) {
while (mask_len >= 8 && cmdCpt < (uint8_t)cmd_len && maskCpt < 8) {
if (cmd[cmdCpt++] != tag->uid[maskCpt++]) {
// mask don't match : drop request
error++;
error++;
break;
}
mask_len -= 8;
@@ -2399,15 +2399,15 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
if (mask_len > 0 && cmdCpt >= cmd_len) {
// mask is shorter than declared mask lenght: drop request
continue;
continue;
}
// Bit comparison
while (mask_len > 0) {
while (mask_len > 0) {
mask_len--;
if (((cmd[cmdCpt] >> mask_len) & 1) != ((tag->uid[maskCpt] >> mask_len) & 1)) {
// mask don't match : drop request
error++;
error++;
break;
}
}
@@ -2456,7 +2456,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
}
if (cmd[1] == ISO15693_SELECT) {
// we are not anymore the selected TAG
// we are not anymore the selected TAG
tag->state = TAG_STATE_READY;
}
@@ -2478,7 +2478,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
Dbprintf("Unaddressed request in quiet state: drop");
}
// drop unadressed request in quiet state
// drop unadressed request in quiet state
continue;
}
@@ -2514,7 +2514,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
recv[0] = ISO15_NOERROR;
recvLen = 1;
// ask for lock status
if ((cmd[0] & ISO15_REQ_OPTION) == ISO15_REQ_OPTION) {
if ((cmd[0] & ISO15_REQ_OPTION) == ISO15_REQ_OPTION) {
recv[1] = tag->locks[pageNum];
recvLen++;
}
@@ -2605,7 +2605,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
}
break;
}
case ISO15693_LOCK_AFI:{
case ISO15693_LOCK_AFI: {
if (g_dbglevel >= DBG_DEBUG) {
Dbprintf("LockAFI cmd");
@@ -2716,8 +2716,8 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
recvLen = 3;
break;
}
case ISO15693_SET_PASSWORD:{
case ISO15693_SET_PASSWORD: {
if (g_dbglevel >= DBG_DEBUG) {
Dbprintf("SetPassword cmd");
}
@@ -2727,9 +2727,9 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
}
if (cmd_len > cmdCpt + 4) {
pwdId = cmd[cmdCpt++];
if (pwdId == 4) { // Privacy password
tag->privacyPasswd[0] = cmd[cmdCpt] ^ tag->random[0];
tag->privacyPasswd[1] = cmd[cmdCpt + 1] ^ tag->random[1];
@@ -2737,7 +2737,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
tag->privacyPasswd[3] = cmd[cmdCpt + 3] ^ tag->random[1];
}
}
recv[0] = ISO15_NOERROR;
recvLen = 1;
break;
@@ -2763,7 +2763,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
}
// Error happened
if (error != 0) {
if (error != 0) {
recv[0] = ISO15_RES_ERROR;
recv[1] = error;
recvLen = 2;
@@ -2775,7 +2775,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
}
// We need to answer
if (recvLen > 0) {
if (recvLen > 0) {
AddCrc15(recv, recvLen);
recvLen += 2;
CodeIso15693AsTag(recv, recvLen);
@@ -2783,7 +2783,7 @@ void SimTagIso15693(const uint8_t *uid, uint8_t block_size) {
uint32_t response_time = reader_eof_time + DELAY_ISO15693_VCD_TO_VICC_SIM;
// Not suppoted yet
if (tag->expectFsk) {
if (tag->expectFsk) {
if (g_dbglevel >= DBG_DEBUG) {
Dbprintf("%ERROR: FSK answers are not supported yet");
}
+1 -1
View File
@@ -380,7 +380,7 @@ out:
Dbprintf("Authentication failed");
}
}
reply_ng(CMD_HF_MIFAREU3P_AUTH, res, (uint8_t *)&rpayload, packet->get_nonces ? sizeof(uint32_t) * 2 + nonce_size * auths : sizeof(uint32_t) * 2);
reply_ng(CMD_HF_MIFAREU3P_AUTH, res, (uint8_t *)&rpayload, packet->get_nonces ? sizeof(uint32_t) * 2 + nonce_size *auths : sizeof(uint32_t) * 2);
if (packet->turn_off_field) {
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
+1 -1
View File
@@ -58,7 +58,7 @@ int open_nb_socket(const char *addr, const char *port) {
// make non-blocking
if (sockfd != -1) {
if(fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFL) | O_NONBLOCK) < 0) {
if (fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFL) | O_NONBLOCK) < 0) {
fprintf(stderr, "fcntl failed in open_nb_socket");
return -1;
}
+6 -6
View File
@@ -73,10 +73,10 @@ main(int argc, char *argv[]) {
setbmp();
if (BMP_BIT != bmpbit || BMP_SUB != bmpsub) {
fprintf(stderr, "reveng: configuration fault. Update "
"reveng/config.h with these definitions and "
"recompile:\n"
"\t#define BMP_BIT %d\n"
"\t#define BMP_SUB %d\n",
"reveng/config.h with these definitions and "
"recompile:\n"
"\t#define BMP_BIT %d\n"
"\t#define BMP_SUB %d\n",
bmpbit, bmpsub);
exit(EXIT_FAILURE);
}
@@ -84,8 +84,8 @@ main(int argc, char *argv[]) {
/* check the bitmap constant macro */
if (~(bmp_t) 0 != ~BMP_C(0)) {
fprintf(stderr, "reveng: configuration fault. Edit "
"the definition of BMP_C() in config.h to "
"match BMP_T and recompile.\n");
"the definition of BMP_C() in config.h to "
"match BMP_T and recompile.\n");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -619,4 +619,4 @@ if __name__ == "__main__":
except Exception as exc:
disable_tearoff()
print(f"\n[x] Error: {exc}")
raise
raise
+1 -1
View File
@@ -467,7 +467,7 @@ static int CmdFlashMemSpiFFSWipe(const char *Cmd) {
CLIParserInit(&ctx, "mem spiffs wipe",
_RED_("* * * Warning * * *") " \n"
_CYAN_("This command wipes all files on the device SPIFFS file system"),
"mem spiffs wipe");
"mem spiffs wipe");
void *argtable[] = {
arg_param_begin,
+2 -2
View File
@@ -3030,7 +3030,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
int16_t fsci = card.ats[1] & 0x0f;
PrintAndLogEx(INFO, " ..." _YELLOW_("%02X") "............ T0 TA1 is%s present, TB1 is%s present, "
"TC1 is%s present, FSCI is %d (FSC = %d)",
"TC1 is%s present, FSCI is %d (FSC = %d)",
card.ats[1],
(ta1 ? "" : _RED_(" NOT")),
(tb1 ? "" : _RED_(" NOT")),
@@ -3052,7 +3052,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
if (strlen(ds) != 0) ds[strlen(ds) - 2] = '\0';
if (strlen(dr) != 0) dr[strlen(dr) - 2] = '\0';
PrintAndLogEx(INFO, " ......" _YELLOW_("%02X") "......... TA1 different divisors are%s supported, "
"DR: [%s], DS: [%s]",
"DR: [%s], DS: [%s]",
card.ats[pos],
((card.ats[pos] & 0x80) ? _RED_(" NOT") : ""),
dr,
+1 -1
View File
@@ -3132,7 +3132,7 @@ static int CmdHF14BAPDU(const char *Cmd) {
arg_lit0("t", "tlv", "executes TLV decoder if it possible"),
arg_lit0(NULL, "decode", "decode apdu request if it possible"),
arg_str0("m", "make", "<hex>", "make apdu with head from this field and data from data field.\n"
" must be 4 bytes: <CLA INS P1 P2>"),
" must be 4 bytes: <CLA INS P1 P2>"),
arg_lit0("e", "extended", "make extended length apdu if `m` parameter included"),
arg_int0("l", "le", "<int>", "Le apdu parameter if `m` parameter included"),
arg_str1("d", "data", "<hex>", "<APDU | data> if `m` parameter included"),
+6 -6
View File
@@ -3440,7 +3440,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
[=] 16 | 77 66 55 44 | 0 | wfUD
[=] 17 | 33 22 11 E0 | 0 | 3"..
*/
uint8_t blk_lo[4] = {0};
uint8_t blk_lo[4] = {0};
uint8_t blk_hi[4] = {0};
reverse_array_copy(payload.uid + 4, 4, blk_lo);
reverse_array_copy(payload.uid, 4, blk_hi);
@@ -3948,12 +3948,12 @@ static int CmdHF15SlixProtectPage(const char *Cmd) {
PrintAndLogEx(INFO, "Trying to set page protection pointer to " _YELLOW_("%d"), payload.divide_ptr);
PrintAndLogEx(INFO, _YELLOW_("LO") " page access %s%s"
, (payload.prot_status & 0x01) ? _RED_("r") : _GREEN_("r")
, (payload.prot_status & 0x02) ? _RED_("w") : _GREEN_("w")
);
, (payload.prot_status & 0x01) ? _RED_("r") : _GREEN_("r")
, (payload.prot_status & 0x02) ? _RED_("w") : _GREEN_("w")
);
PrintAndLogEx(INFO, _YELLOW_("HI") " page access %s%s"
, (payload.prot_status & 0x10) ? _RED_("r") : _GREEN_("r")
, (payload.prot_status & 0x20) ? _RED_("w") : _GREEN_("w"));
, (payload.prot_status & 0x10) ? _RED_("r") : _GREEN_("r")
, (payload.prot_status & 0x20) ? _RED_("w") : _GREEN_("w"));
PacketResponseNG resp;
clearCommandBuffer();
+19 -19
View File
@@ -479,10 +479,10 @@ static void print_status_flag1_interpretation(void) {
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
PrintAndLogEx(INFO, " 00 | Indicates the successful completion of a command.");
PrintAndLogEx(INFO, " FF | If an error occurs during the processing of a command that includes no list in the command packet, \n"
" | or if an error occurs independently of any list, the card returns a response by setting FFh to Status Flag1.");
" | or if an error occurs independently of any list, the card returns a response by setting FFh to Status Flag1.");
PrintAndLogEx(INFO, " XX | If an error occurs while processing a command that includes Service Code List or Block List \n"
" | in the command packet, the card returns a response by setting a number in the list to Status Flag1,\n"
" | indicating the location of the error.");
" | in the command packet, the card returns a response by setting a number in the list to Status Flag1,\n"
" | indicating the location of the error.");
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
}
@@ -491,28 +491,28 @@ static void print_status_flag2_interpration(void) {
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
PrintAndLogEx(INFO, " 00 | Indicates the successful completion of a command.");
PrintAndLogEx(INFO, " 01 | The calculated result is either less than zero when the purse data is decremented, or exceeds 4\n"
" | Bytes when the purse data is incremented.");
" | Bytes when the purse data is incremented.");
PrintAndLogEx(INFO, " 02 | The specified data exceeds the value of cashback data at cashback of purse.");
PrintAndLogEx(INFO, " 70 | Memory error (fatal error).");
PrintAndLogEx(INFO, " 71 | The number of memory rewrites exceeds the upper limit (this is only a warning; data writing is performed as normal).\n"
" | The maximum number of rewrites can differ, depending on the product being used.\n"
" | In addition, Status Flag1 is either 00h or FFh depending on the product being used.");
" | The maximum number of rewrites can differ, depending on the product being used.\n"
" | In addition, Status Flag1 is either 00h or FFh depending on the product being used.");
PrintAndLogEx(INFO, " A1 | Illegal Number of Service| Number of Service or Number of Node specified by the command \n"
" | falls outside the range of the prescribed value.");
" | falls outside the range of the prescribed value.");
PrintAndLogEx(INFO, " A2 | Illegal command packet (specified Number of Block) : Number of Block specified by the \n"
" | command falls outside the range of the prescribed values for the product.");
" | command falls outside the range of the prescribed values for the product.");
PrintAndLogEx(INFO, " A3 | Illegal Block List (specified order of Service) : Service Code List Order specified by \n"
" | Block List Element falls outside the Number of Service specified by the command \n"
" | (or the Number of Service specified at the times of mutual authentication).");
" | Block List Element falls outside the Number of Service specified by the command \n"
" | (or the Number of Service specified at the times of mutual authentication).");
PrintAndLogEx(INFO, " A4 | Illegal Service type : Area Attribute specified by the command or Service Attribute of Service Code is incorrect.");
PrintAndLogEx(INFO, " A5 | Access is not allowed : Area or Service specified by the command cannot be accessed.\n"
" | The parameter specified by the command does not satisfy the conditions for success.");
" | The parameter specified by the command does not satisfy the conditions for success.");
PrintAndLogEx(INFO, " A6 | Illegal Service Code List : Target to be accessed, identified by Service Code List Order, specified by Block\n"
" | List Element does not exist. Or, Node specified by Node Code List does not exist.");
" | List Element does not exist. Or, Node specified by Node Code List does not exist.");
PrintAndLogEx(INFO, " A7 | Illegal Block List (Access Mode) : Access Mode specified by Block List Element is incorrect.");
PrintAndLogEx(INFO, " A8 | Illegal Block Number Block Number (access to the specified data is inhibited) :\n"
" | specified by Block List Element exceeds the number of Blocks assigned to Service.");
" | specified by Block List Element exceeds the number of Blocks assigned to Service.");
PrintAndLogEx(INFO, " A9 | Data write failure : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " AA | Key-change failure : Key change failed.");
PrintAndLogEx(INFO, " AB | Illegal Package Parity or illegal Package MAC : This is the error that occurs in issuance commands.");
@@ -520,7 +520,7 @@ static void print_status_flag2_interpration(void) {
PrintAndLogEx(INFO, " AD | Service exists already : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " AE | Illegal System Code : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " AF | Too many simultaneous cyclic write operations : Number of simultaneous write Blocks\n"
" | specified by the command to Cyclic Service exceeds the number of Blocks assigned to Service.");
" | specified by the command to Cyclic Service exceeds the number of Blocks assigned to Service.");
PrintAndLogEx(INFO, " C0 | Illegal Package Identifier : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " C1 | Discrepancy of parameters inside and outside Package : This is the error that occurs in issuance commands.");
PrintAndLogEx(INFO, " C2 | Command is disabled already : This is the error that occurs in issuance commands.");
@@ -544,16 +544,16 @@ static void print_number_of_service_constraints(void) {
static void print_number_of_block_constraints(void) {
PrintAndLogEx(INFO, " - Number of Block: shall be less than or equal to the maximum number of Blocks that can be read simultaneously.\n"
" The maximum number of Blocks that can be read simultaneously can differ, depending on the product being used.\n"
" Use as default 01");
" The maximum number of Blocks that can be read simultaneously can differ, depending on the product being used.\n"
" Use as default 01");
}
static void print_service_code_list_constraints(void) {
PrintAndLogEx(INFO, " - Service Code List: For Service Code List, only Service Code existing in the product shall be specified:");
PrintAndLogEx(INFO, " - Even when Service Code exists in the product, Service Code not referenced from Block List shall not \n"
" be specified to Service Code List.");
" be specified to Service Code List.");
PrintAndLogEx(INFO, " - For existence or nonexistence of Service in a product, please check using the Request Service \n"
" (or Request Service v2) command.");
" (or Request Service v2) command.");
}
/*
@@ -6840,7 +6840,7 @@ static int CmdHFFelicaSim(const char *Cmd) {
arg_param_begin,
arg_str1("f", "file", "<fn>", "JSON dump file"),
arg_str0(NULL, "read-without-encryption-error-location-indication",
"<mask|index|flag>", "Read Without Encryption error location indication (default: mask)"),
"<mask|index|flag>", "Read Without Encryption error location indication (default: mask)"),
arg_lit0("v", "verbose", "verbose output"),
arg_param_end
};
+9 -9
View File
@@ -381,7 +381,7 @@ static int hfgal_create_creds_app(DesfireContext_t *ctx, uint8_t *site_key, uint
// UID is required for key diversification
if (ctx->uidlen == 0) {
PM3_RET_ERR(PM3_EINVARG, "UID is required for key diversification. "
"Please fetch it before calling `hfgal_create_creds_app`");
"Please fetch it before calling `hfgal_create_creds_app`");
}
// Create application
@@ -871,11 +871,11 @@ static int hfgal_read_desfire_card(uint32_t aid, uint8_t *site_key, bool verbose
PM3_RET_IF_ERR_MAYBE_MSG(res, !quiet, "Failed reading card application credentials");
PrintAndLogEx(SUCCESS, "Gallagher (AID %06X) - region: " _GREEN_("%c") " ( " _GREEN_("%u") " )"
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
current_aid,
'A' + creds.region_code,
'A' + creds.region_code,
creds.region_code,
creds.facility_code,
creds.card_number,
@@ -1693,10 +1693,10 @@ static int CmdGallagherDecode(const char *cmd) {
gallagher_decode_creds(data_buf, &creds);
PrintAndLogEx(SUCCESS, "Gallagher - region: " _GREEN_("%c") " ( " _GREEN_("%u") " )"
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
'A' + creds.region_code,
", facility: " _GREEN_("%u")
", card number: " _GREEN_("%u")
", issue level: " _GREEN_("%u"),
'A' + creds.region_code,
creds.region_code,
creds.facility_code,
creds.card_number,
+2 -2
View File
@@ -1602,7 +1602,7 @@ static int CmdHFiClassTagSim(const char *Cmd) {
card.FacilityCode,
card.CardNumber,
sprint_hex(csn, 8)
);
);
} else {
PrintAndLogEx(INFO, "Press " _GREEN_("`pm3 button`") " to abort");
}
@@ -1725,7 +1725,7 @@ static int CmdHFiClassTagSim(const char *Cmd) {
card.FacilityCode,
card.CardNumber,
sprint_hex(csn, 8)
);
);
}
tagsim_rawmode_exit();
+2 -2
View File
@@ -500,7 +500,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff
// for printing the complete segment we need at least wrc + wrp_len + remain_seg_payload_len bytes
if ((i + wrc + wrp_len + remain_seg_payload_len) > card_size) {
PrintAndLogEx(FAILED, "Cannot read segment body, because the input buffer is too small. "
"Please check that the data is correct and properly aligned. ");
"Please check that the data is correct and properly aligned. ");
return_value = PM3_EOUTOFBOUND;
goto out;
}
@@ -584,7 +584,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff
// for printing the complete segment we need at least wrc + wrp_len + remain_seg_payload_len bytes
if ((i + wrc + wrp_len + remain_seg_payload_len) > card_size) {
PrintAndLogEx(FAILED, "Cannot read segment body, because the input buffer is too small. "
"Please check that the data is correct and properly aligned. ");
"Please check that the data is correct and properly aligned. ");
return_value = PM3_EOUTOFBOUND;
goto out;
}
+15 -11
View File
@@ -5092,7 +5092,7 @@ void printKeyTableEx(size_t sectorscnt, sector_t *e_sector, uint8_t start_sector
_YELLOW_("H") ":Hardnested / "
_YELLOW_("C") ":statiCnested / "
_YELLOW_("A") ":keyA "
" )"
" )"
);
if (sectorscnt == 18) {
PrintAndLogEx(INFO, "( " _MAGENTA_("*") " ) These sectors used for signature. Lays outside of user memory");
@@ -8556,7 +8556,7 @@ static int CmdHF14AMfView(const char *Cmd) {
block_cnt = MIFARE_2K_MAXBLOCK;
} else if (bytes_read == MIFARE_4K_MAX_BYTES) {
block_cnt = MIFARE_4K_MAXBLOCK;
}
}
if (verbose) {
PrintAndLogEx(INFO, "File size %zu bytes, file blocks %d (0x%x)", bytes_read, block_cnt, block_cnt);
@@ -9899,8 +9899,8 @@ static int CmdHF14AGen4_GDM_SetCfg(const char *Cmd) {
PrintAndLogEx(FAILED, "Write ( " _RED_("fail") " )");
}
return PM3_SUCCESS;
}
}
// Config flag mode
if (any_flag == false) {
PrintAndLogEx(FAILED, "Must specify at least one configuration flag, or provide raw data using -d");
@@ -9914,7 +9914,7 @@ static int CmdHF14AGen4_GDM_SetCfg(const char *Cmd) {
}
bool changed = false;
#define APPLY_CONFIG_FLAG(flag, idx, on_val, off_val, name) \
#define APPLY_CONFIG_FLAG(flag, idx, on_val, off_val, name) \
if (flag != -1) { \
uint8_t val = (flag == 1) ? on_val : off_val; \
if (config[idx] != val) { \
@@ -9927,12 +9927,16 @@ static int CmdHF14AGen4_GDM_SetCfg(const char *Cmd) {
if (gen1_flag != -1) {
if (gen1_flag == 1) {
if (config[0] != 0x7A || config[1] != 0xFF) {
config[0] = 0x7A; config[1] = 0xFF; changed = true;
config[0] = 0x7A;
config[1] = 0xFF;
changed = true;
PrintAndLogEx(INFO, "Set Gen1 mode to on");
}
} else {
if (config[0] != 0x85 || config[1] != 0x00) {
config[0] = 0x85; config[1] = 0x00; changed = true;
config[0] = 0x85;
config[1] = 0x00;
changed = true;
PrintAndLogEx(INFO, "Set Gen1 mode to off");
}
}
@@ -9944,7 +9948,7 @@ static int CmdHF14AGen4_GDM_SetCfg(const char *Cmd) {
APPLY_CONFIG_FLAG(magicauth_flag, 11, 0x5A, 0x00, "Magic auth");
APPLY_CONFIG_FLAG(statenc_flag, 12, 0x5A, 0x00, "Static encrypted nonce");
APPLY_CONFIG_FLAG(sigsec_flag, 13, 0x5A, 0x00, "Signature sector");
#undef APPLY_CONFIG_FLAG
#undef APPLY_CONFIG_FLAG
if (cl2_flag == 1) {
PrintAndLogEx(WARNING, "CL2 (7-byte UID) perso enabled via config flag only - this does NOT set a valid 7-byte UID");
@@ -10565,7 +10569,7 @@ static int CmdHF14AGen4_GDM_Wipe(const char *Cmd) {
} else {
memcpy(write_payload.block_data, data_to_write, MFBLOCK_SIZE);
}
clearCommandBuffer();
SendCommandNG(CMD_HF_MIFARE_WRITEBL_EX, (uint8_t *)&write_payload, sizeof(write_payload));
WaitForResponseTimeout(CMD_HF_MIFARE_WRITEBL_EX, &resp, 1500);
@@ -10575,14 +10579,14 @@ static int CmdHF14AGen4_GDM_Wipe(const char *Cmd) {
if (blk == 7) {
memcpy(write_payload.block_data, MF_SIGNATURE_KEYS, MFBLOCK_SIZE);
}
clearCommandBuffer();
SendCommandNG(CMD_HF_MIFARE_WRITEBL_EX, (uint8_t *)&write_payload, sizeof(write_payload));
WaitForResponseTimeout(CMD_HF_MIFARE_WRITEBL_EX, &resp, 1500);
}
PrintAndLogEx(INFO, "Wiping sector %d...", sec);
}
PrintAndLogEx(SUCCESS, "Wipe completed!");
return PM3_SUCCESS;
}
+6 -6
View File
@@ -6904,7 +6904,7 @@ static int CmdHF14ADesCreateMFCMapping(const char *Cmd) {
license_len = saved_mfclicense_len;
memcpy(license_mac, saved_mfclicense_mac, 8);
} else {
if (CLIParamHexToBuf(mfc_license_arg, license, sizeof (license), &license_len) != 0) {
if (CLIParamHexToBuf(mfc_license_arg, license, sizeof(license), &license_len) != 0) {
goto createmfcmapping_parsing_error;
}
int license_mac_len = 0;
@@ -8137,7 +8137,7 @@ static int MfdSelectionApplyCmdParameters(CLIParserContext *ctx, uint8_t aidid,
PrintAndLogEx(ERR, "DF name must be 1-16 bytes, got %d", dfname_len);
return PM3_EINVARG;
}
cmd_select.dfname_present = true;
cmd_select.dfname_len = dfname_len;
memcpy(cmd_select.dfname, dfname, dfname_len);
@@ -8164,14 +8164,14 @@ static int MfdSelectionApplyCmdParameters(CLIParserContext *ctx, uint8_t aidid,
if (CLIParamHexToBuf(arg_get_str(ctx, aidid), aid_bytes, sizeof(aid_bytes), &aid_len)) {
return PM3_EINVARG;
}
if (aid_len > 0) {
if (aid_len != (int)sizeof(aid_bytes)) {
PrintAndLogEx(ERR, "AID must be exactly 3 bytes, got %d", aid_len);
return PM3_EINVARG;
}
cmd_select.aid_present = true;
cmd_select.aid = DesfireAIDByteToUint(aid_bytes);
}
@@ -9362,7 +9362,7 @@ static int CmdHF14ADesVerifyCert(const char *Cmd) {
arg_str0(NULL, "fid", "<hex>", "Certificate file ID (1 byte)"), // 15
arg_lit0(NULL, "no-auth", "Read certificate file without authentication"), // 16
arg_strn(NULL, "ca", "<name|cert|pubkey|path|skip>", 0, MFDES_VERIFYCERT_MAX_CAS,
"CA input, or `skip` to skip certificate signature validation. Repeat --ca for multiple entries"), // 17
"CA input, or `skip` to skip certificate signature validation. Repeat --ca for multiple entries"), // 17
arg_str0(NULL, "keyaid", "<hex>", "Key application ID (default: cert app)"), // 18
arg_str0(NULL, "keyisoid", "<hex>", "Key application ISO DF ID (2 bytes)"), // 19
arg_str0(NULL, "keydfname", "<hex>", "Key application DF name (default: cert app)"), // 20

Some files were not shown because too many files have changed in this diff Show More