make style
This commit is contained in:
1 parent
169d31cc8e
commit
ba8e90edfd
11 files changed
+113
-95
No files matched your search
@@ -1324,8 +1324,7 @@ static int CmdHFiClassESetBlk(const char *Cmd) {
|
||||
static bool iclass_detect_new_pacs(uint8_t *d) {
|
||||
uint8_t n = 0;
|
||||
while (n++ < (PICOPASS_BLOCK_SIZE / 2)) {
|
||||
if (d[n] &&
|
||||
d[n + 1] == 0xA6) {
|
||||
if (d[n] && d[n + 1] == 0xA6) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1336,7 +1335,7 @@ static bool iclass_detect_new_pacs(uint8_t *d) {
|
||||
static int iclass_decode_credentials_new_pacs(uint8_t *d) {
|
||||
|
||||
uint8_t offset = 0;
|
||||
while(d[offset] == 0 && (offset < PICOPASS_BLOCK_SIZE / 2)) {
|
||||
while (d[offset] == 0 && (offset < PICOPASS_BLOCK_SIZE / 2)) {
|
||||
offset++;
|
||||
}
|
||||
|
||||
|
||||
@@ -2431,7 +2431,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||
int in_keys_len = 0;
|
||||
uint8_t in_keys[100 * MIFARE_KEY_SIZE] = {0};
|
||||
CLIGetHexWithReturn(ctx, 1, in_keys, &in_keys_len);
|
||||
|
||||
|
||||
uint8_t sectorno = arg_get_u32_def(ctx, 2, 0);
|
||||
|
||||
uint8_t keytype = MF_KEY_A;
|
||||
@@ -7409,7 +7409,7 @@ static int CmdHF14AGen4Info(const char *cmd) {
|
||||
PrintAndLogEx(INFO, "Raw config [%02zu]..... %s", resplen, sprint_hex_inrow(resp, resplen));
|
||||
|
||||
PrintAndLogEx(INFO, "UL protocol......... %02x" NOLF, resp[0]);
|
||||
switch (resp[0]){
|
||||
switch (resp[0]) {
|
||||
case 0x00:
|
||||
PrintAndLogEx(NORMAL, " (MIFARE Classic mode)");
|
||||
break;
|
||||
@@ -7423,7 +7423,7 @@ static int CmdHF14AGen4Info(const char *cmd) {
|
||||
|
||||
uint8_t uid_len = resp[1];
|
||||
PrintAndLogEx(INFO, "UID length.......... %02x" NOLF, resp[1]);
|
||||
switch (resp[1]){
|
||||
switch (resp[1]) {
|
||||
case 0x00:
|
||||
PrintAndLogEx(NORMAL, " (4 byte)");
|
||||
break;
|
||||
@@ -7441,7 +7441,7 @@ static int CmdHF14AGen4Info(const char *cmd) {
|
||||
PrintAndLogEx(INFO, "Password............ %s", sprint_hex_inrow(&resp[2], 4));
|
||||
|
||||
PrintAndLogEx(INFO, "GTU mode............ %02x" NOLF, resp[6]);
|
||||
switch (resp[6]){
|
||||
switch (resp[6]) {
|
||||
case 0x00:
|
||||
PrintAndLogEx(NORMAL, " (pre-write, shadow data can be written)");
|
||||
break;
|
||||
@@ -7464,7 +7464,7 @@ static int CmdHF14AGen4Info(const char *cmd) {
|
||||
PrintAndLogEx(INFO, "SAK................. %02x", resp[26]);
|
||||
|
||||
PrintAndLogEx(INFO, "UL mode............. %02x" NOLF, resp[27]);
|
||||
switch (resp[27]){
|
||||
switch (resp[27]) {
|
||||
case 0x00:
|
||||
PrintAndLogEx(NORMAL, " (UL EV1)");
|
||||
break;
|
||||
@@ -7484,7 +7484,7 @@ static int CmdHF14AGen4Info(const char *cmd) {
|
||||
|
||||
PrintAndLogEx(INFO, "max rd/wr sectors... %02x", resp[28]);
|
||||
PrintAndLogEx(INFO, "block0 direct wr.... %02x" NOLF, resp[29]);
|
||||
switch (resp[29]){
|
||||
switch (resp[29]) {
|
||||
case 0x00:
|
||||
PrintAndLogEx(NORMAL, " (Activate direct write to block 0 (Same behaviour of Gen2 cards. Some readers may identify the card as magic))");
|
||||
break;
|
||||
@@ -7524,7 +7524,7 @@ static int CmdHF14AGen4Info(const char *cmd) {
|
||||
PrintAndLogEx(INFO, "");
|
||||
PrintAndLogEx(INFO, "Block 0............. %s", sprint_hex_inrow(resp, 16));
|
||||
|
||||
switch (uid_len){
|
||||
switch (uid_len) {
|
||||
case 0x00:
|
||||
PrintAndLogEx(INFO, "UID [4]............. %s", sprint_hex(resp, 4));
|
||||
break;
|
||||
|
||||
+11
-11
@@ -1123,7 +1123,7 @@ static int ulev1_print_signature(uint64_t tagtype, uint8_t *uid, uint8_t *signat
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Signature"));
|
||||
if (is_192_valid ) {
|
||||
if (is_192_valid) {
|
||||
PrintAndLogEx(INFO, " IC signature public key name: " _GREEN_("%s"), nxp_mfu_192_public_keys[i].desc);
|
||||
PrintAndLogEx(INFO, "IC signature public key value: %s", nxp_mfu_192_public_keys[i].value);
|
||||
PrintAndLogEx(INFO, " Elliptic curve parameters: NID_secp192r1");
|
||||
@@ -1141,7 +1141,7 @@ static int ulev1_print_signature(uint64_t tagtype, uint8_t *uid, uint8_t *signat
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, " Elliptic curve parameters: %s", (signature_len == 48) ? "NID_secp192r1" : "NID_secp128r1" );
|
||||
PrintAndLogEx(INFO, " Elliptic curve parameters: %s", (signature_len == 48) ? "NID_secp192r1" : "NID_secp128r1");
|
||||
PrintAndLogEx(INFO, " TAG IC Signature: %s", sprint_hex_inrow(signature, signature_len));
|
||||
PrintAndLogEx(SUCCESS, " Signature verification ( " _RED_("fail") " )");
|
||||
return PM3_ESOFT;
|
||||
@@ -1926,10 +1926,10 @@ static int CmdHF14AMfUInfo(const char *Cmd) {
|
||||
|
||||
// Read signature
|
||||
if ((tagtype & (MFU_TT_UL_EV1_48 | MFU_TT_UL_EV1_128 | MFU_TT_UL_EV1 | MFU_TT_UL_NANO_40 |
|
||||
MFU_TT_NTAG_210u | MFU_TT_NTAG_213 | MFU_TT_NTAG_213_F | MFU_TT_NTAG_213_C |
|
||||
MFU_TT_NTAG_213_TT | MFU_TT_NTAG_215 | MFU_TT_NTAG_216 | MFU_TT_NTAG_216_F |
|
||||
MFU_TT_NTAG_I2C_1K | MFU_TT_NTAG_I2C_2K | MFU_TT_NTAG_I2C_1K_PLUS | MFU_TT_NTAG_I2C_2K_PLUS |
|
||||
MFU_TT_UL_AES))) {
|
||||
MFU_TT_NTAG_210u | MFU_TT_NTAG_213 | MFU_TT_NTAG_213_F | MFU_TT_NTAG_213_C |
|
||||
MFU_TT_NTAG_213_TT | MFU_TT_NTAG_215 | MFU_TT_NTAG_216 | MFU_TT_NTAG_216_F |
|
||||
MFU_TT_NTAG_I2C_1K | MFU_TT_NTAG_I2C_2K | MFU_TT_NTAG_I2C_1K_PLUS | MFU_TT_NTAG_I2C_2K_PLUS |
|
||||
MFU_TT_UL_AES))) {
|
||||
uint8_t ulev1_signature[49] = {0x00};
|
||||
status = ulev1_readSignature(ulev1_signature, sizeof(ulev1_signature));
|
||||
if (status == -1) {
|
||||
@@ -2377,11 +2377,11 @@ void printMFUdumpEx(mfu_dump_t *card, uint16_t pages, uint8_t startpage) {
|
||||
for (uint16_t i = 0; i < pages; ++i) {
|
||||
if (i < 3) {
|
||||
PrintAndLogEx(INFO, "%3d/0x%02X | " _RED_("%s")"| | %s",
|
||||
i + startpage,
|
||||
i + startpage,
|
||||
sprint_hex(data + i * 4, 4),
|
||||
sprint_ascii(data + i * 4, 4)
|
||||
);
|
||||
i + startpage,
|
||||
i + startpage,
|
||||
sprint_hex(data + i * 4, 4),
|
||||
sprint_ascii(data + i * 4, 4)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
switch (i) {
|
||||
|
||||
+6
-6
@@ -116,19 +116,19 @@ static int CmdNfcDecode(const char *Cmd) {
|
||||
uint8_t *tmp = dump;
|
||||
|
||||
// if not MIFARE Classic default sizes, assume its Ultralight/NTAG
|
||||
if ( bytes_read != MIFARE_4K_MAX_BYTES
|
||||
&& bytes_read != MIFARE_2K_MAX_BYTES
|
||||
&& bytes_read != MIFARE_1K_MAX_BYTES
|
||||
&& bytes_read != MIFARE_MINI_MAX_BYTES) {
|
||||
if (bytes_read != MIFARE_4K_MAX_BYTES
|
||||
&& bytes_read != MIFARE_2K_MAX_BYTES
|
||||
&& bytes_read != MIFARE_1K_MAX_BYTES
|
||||
&& bytes_read != MIFARE_MINI_MAX_BYTES) {
|
||||
|
||||
uint8_t **pd = &tmp;
|
||||
mfu_df_e df = detect_mfu_dump_format(pd, verbose);
|
||||
if (df == MFU_DF_OLDBIN) {
|
||||
tmp += OLD_MFU_DUMP_PREFIX_LENGTH + (4 * 4);
|
||||
bytes_read -= OLD_MFU_DUMP_PREFIX_LENGTH + ( 4 * 4);
|
||||
bytes_read -= OLD_MFU_DUMP_PREFIX_LENGTH + (4 * 4);
|
||||
} else if (df == MFU_DF_NEWBIN) {
|
||||
tmp += MFU_DUMP_PREFIX_LENGTH + (4 * 4);
|
||||
bytes_read -= MFU_DUMP_PREFIX_LENGTH + ( 4 * 4);
|
||||
bytes_read -= MFU_DUMP_PREFIX_LENGTH + (4 * 4);
|
||||
}
|
||||
pd = NULL;
|
||||
|
||||
|
||||
@@ -112,79 +112,79 @@ MAKE_ENUM_TYPE(uint8_t)
|
||||
|
||||
// KSX6924LookupCardType
|
||||
MAKE_ENUM_CONST(CardType, uint8_t,
|
||||
{ 0x00, "Pre-paid" },
|
||||
{ 0x10, "Post-pay" },
|
||||
{ 0x20, "Mobile post-pay" },
|
||||
)
|
||||
{ 0x00, "Pre-paid" },
|
||||
{ 0x10, "Post-pay" },
|
||||
{ 0x20, "Mobile post-pay" },
|
||||
)
|
||||
|
||||
// KSX6924LookupAlg
|
||||
MAKE_ENUM_CONST(Alg, uint8_t,
|
||||
{ 0x00, "SEED" },
|
||||
{ 0x10, "3DES" },
|
||||
)
|
||||
{ 0x00, "SEED" },
|
||||
{ 0x10, "3DES" },
|
||||
)
|
||||
|
||||
// KSX6924LookupTMoneyIDCenter
|
||||
MAKE_ENUM_CONST(TMoneyIDCenter, uint8_t,
|
||||
{ 0x00, "Reserved" },
|
||||
{ 0x01, "Korea Financial Telecommunications and Clearings Institute" },
|
||||
{ 0x02, "A-Cash" },
|
||||
{ 0x03, "Mybi" },
|
||||
{ 0x04, "Reserved" },
|
||||
{ 0x05, "V-Cash" },
|
||||
{ 0x06, "Mondex Korea" },
|
||||
{ 0x07, "Korea Expressway Corporation" },
|
||||
{ 0x08, "Tmoney Co., Ltd." },
|
||||
{ 0x09, "KORAIL Networks" },
|
||||
{ 0x0a, "Reserved" },
|
||||
{ 0x0b, "EB Card Corporation" },
|
||||
{ 0x0c, "Seoul Bus Transport Association" },
|
||||
{ 0x0d, "Cardnet" },
|
||||
)
|
||||
{ 0x00, "Reserved" },
|
||||
{ 0x01, "Korea Financial Telecommunications and Clearings Institute" },
|
||||
{ 0x02, "A-Cash" },
|
||||
{ 0x03, "Mybi" },
|
||||
{ 0x04, "Reserved" },
|
||||
{ 0x05, "V-Cash" },
|
||||
{ 0x06, "Mondex Korea" },
|
||||
{ 0x07, "Korea Expressway Corporation" },
|
||||
{ 0x08, "Tmoney Co., Ltd." },
|
||||
{ 0x09, "KORAIL Networks" },
|
||||
{ 0x0a, "Reserved" },
|
||||
{ 0x0b, "EB Card Corporation" },
|
||||
{ 0x0c, "Seoul Bus Transport Association" },
|
||||
{ 0x0d, "Cardnet" },
|
||||
)
|
||||
|
||||
// KSX6924LookupTMoneyUserCode
|
||||
MAKE_ENUM_CONST(TMoneyUserCode, uint8_t,
|
||||
{ 0x01, "Regular/normal" },
|
||||
{ 0x02, "Child" },
|
||||
{ 0x04, "Youth" },
|
||||
{ 0x06, "elderly" },
|
||||
{ 0x0f, "Test" },
|
||||
{ 0xff, "Inactive" },
|
||||
)
|
||||
{ 0x01, "Regular/normal" },
|
||||
{ 0x02, "Child" },
|
||||
{ 0x04, "Youth" },
|
||||
{ 0x06, "elderly" },
|
||||
{ 0x0f, "Test" },
|
||||
{ 0xff, "Inactive" },
|
||||
)
|
||||
|
||||
// KSX6924LookupTMoneyDisRate
|
||||
MAKE_ENUM_CONST(TMoneyDisRate, uint8_t,
|
||||
{ 0x00, "No discount" },
|
||||
{ 0x00, "No discount" },
|
||||
|
||||
{ 0x10, "Disabled, basic" },
|
||||
{ 0x11, "Disabled, companion" },
|
||||
{ 0x10, "Disabled, basic" },
|
||||
{ 0x11, "Disabled, companion" },
|
||||
|
||||
{ 0x20, "Merit, basic" },
|
||||
{ 0x21, "Merit, companion" },
|
||||
)
|
||||
{ 0x20, "Merit, basic" },
|
||||
{ 0x21, "Merit, companion" },
|
||||
)
|
||||
|
||||
// KSX6924LookupTMoneyTCode
|
||||
MAKE_ENUM_CONST(TMoneyTCode, uint8_t,
|
||||
{ 0x00, "None" },
|
||||
{ 0x01, "SK Telecom" },
|
||||
{ 0x02, "Korea Telecom" },
|
||||
{ 0x03, "LG Uplus" },
|
||||
)
|
||||
{ 0x00, "None" },
|
||||
{ 0x01, "SK Telecom" },
|
||||
{ 0x02, "Korea Telecom" },
|
||||
{ 0x03, "LG Uplus" },
|
||||
)
|
||||
|
||||
// KSX6924LookupTMoneyCCode
|
||||
MAKE_ENUM_CONST(TMoneyCCode, uint8_t,
|
||||
{ 0x00, "None" },
|
||||
{ 0x01, "KB Card" },
|
||||
{ 0x02, "NH Card" },
|
||||
{ 0x03, "Lotte Card" },
|
||||
{ 0x04, "BC Card" },
|
||||
{ 0x05, "Samsung Card" },
|
||||
{ 0x06, "Shinhan Card" },
|
||||
{ 0x07, "Citibank Korea" },
|
||||
{ 0x08, "Korea Exchange Bank" },
|
||||
{ 0x09, "Woori Card" },
|
||||
{ 0x0a, "Hana SK Card" },
|
||||
{ 0x0b, "Hyundai Card" },
|
||||
)
|
||||
{ 0x00, "None" },
|
||||
{ 0x01, "KB Card" },
|
||||
{ 0x02, "NH Card" },
|
||||
{ 0x03, "Lotte Card" },
|
||||
{ 0x04, "BC Card" },
|
||||
{ 0x05, "Samsung Card" },
|
||||
{ 0x06, "Shinhan Card" },
|
||||
{ 0x07, "Citibank Korea" },
|
||||
{ 0x08, "Korea Exchange Bank" },
|
||||
{ 0x09, "Woori Card" },
|
||||
{ 0x0a, "Hana SK Card" },
|
||||
{ 0x0b, "Hyundai Card" },
|
||||
)
|
||||
|
||||
static const char *KSX6924_UNKNOWN = "Unknown";
|
||||
|
||||
|
||||
@@ -372,6 +372,7 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 0, "hf mf gsave" },
|
||||
{ 0, "hf mf gsetblk" },
|
||||
{ 0, "hf mf gview" },
|
||||
{ 0, "hf mf gchpwd" },
|
||||
{ 0, "hf mf gdmcfg" },
|
||||
{ 0, "hf mf gdmsetcfg" },
|
||||
{ 0, "hf mf gdmsetblk" },
|
||||
|
||||
+2
-2
@@ -1200,8 +1200,8 @@ char *str_ndup(const char *src, size_t len) {
|
||||
|
||||
size_t str_nlen(const char *src, size_t maxlen) {
|
||||
size_t len = 0;
|
||||
if(src) {
|
||||
for(char c = *src; (len < maxlen && c != '\0'); c = *++src) {
|
||||
if (src) {
|
||||
for (char c = *src; (len < maxlen && c != '\0'); c = *++src) {
|
||||
len++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user