make style

This commit is contained in:
Philippe Teuwen 2023-11-09 17:30:52 +01:00
commit ba8e90edfd
11 changed files with 113 additions and 95 deletions

View file

@ -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++;
}

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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";

View file

@ -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" },

View file

@ -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++;
}
}

View file

@ -4013,7 +4013,8 @@
"hf mf autopwn",
"hf mf autopwn -s 0 -a -k FFFFFFFFFFFF -> target MFC 1K card, Sector 0 with known key A 'FFFFFFFFFFFF'",
"hf mf autopwn --1k -f mfc_default_keys -> target MFC 1K card, default dictionary",
"hf mf autopwn --1k -s 0 -a -k FFFFFFFFFFFF -f mfc_default_keys -> combo of the two above samples"
"hf mf autopwn --1k -s 0 -a -k FFFFFFFFFFFF -f mfc_default_keys -> combo of the two above samples",
"hf mf autopwn --1k -s 0 -a -k FFFFFFFFFFFF -k a0a1a2a3a4a5 -> multiple user supplied keys"
],
"offline": false,
"options": [
@ -4037,7 +4038,7 @@
"--i2 AVX2",
"--i5 AVX512"
],
"usage": "hf mf autopwn [-hablv] [-k <hex>] [-s <dec>] [-f <fn>] [--slow] [--mini] [--1k] [--2k] [--4k] [--in] [--im] [--is] [--ia] [--i2] [--i5]"
"usage": "hf mf autopwn [-hablv] [-k <hex>]... [-s <dec>] [-f <fn>] [--slow] [--mini] [--1k] [--2k] [--4k] [--in] [--im] [--is] [--ia] [--i2] [--i5]"
},
"hf mf cgetblk": {
"command": "hf mf cgetblk",
@ -4453,6 +4454,21 @@
],
"usage": "hf mf fchk [-h] [-k <hex>]... [--mini] [--1k] [--2k] [--4k] [--emu] [--dump] [--mem] [-f <fn>]"
},
"hf mf gchpwd": {
"command": "hf mf gchpwd",
"description": "Change access password for Gen4 GTU card. WARNING! If you dont KNOW the password - you CAN'T access it!!!",
"notes": [
"hf mf gchpwd --pwd 00000000 --newpwd 01020304"
],
"offline": false,
"options": [
"-h, --help This help",
"-p, --pwd <hex> password 4 bytes",
"-n, --newpwd <hex> new password 4 bytes",
"-v, --verbose verbose output"
],
"usage": "hf mf gchpwd [-hv] [-p <hex>] [-n <hex>]"
},
"hf mf gdmcfg": {
"command": "hf mf gdmcfg",
"description": "Get configuration data from magic gen4 GDM card.",
@ -7686,13 +7702,15 @@
"command": "hw status",
"description": "Show runtime status information about the connected Proxmark3",
"notes": [
"hw status"
"hw status",
"hw status --ms 1000 -> Test connection speed with 1000ms timeout"
],
"offline": false,
"options": [
"-h, --help This help"
"-h, --help This help",
"-m, --ms <ms> speed test timeout in micro seconds"
],
"usage": "hw status [-h]"
"usage": "hw status [-h] [-m <ms>]"
},
"hw tearoff": {
"command": "hw tearoff",
@ -8955,7 +8973,7 @@
"-1, --ht1 Card type Hitag 1",
"-2, --ht2 Card type Hitag 2",
"-s, --hts Card type Hitag S",
"-m, --htm Card type Hitag \u041e\u0458"
"-m, --htm Card type Hitag \u03bc"
],
"usage": "lf hitag eload [-h12sm] -f <fn>"
},
@ -12031,8 +12049,8 @@
}
},
"metadata": {
"commands_extracted": 697,
"commands_extracted": 698,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2023-11-05T22:22:55"
"extracted_on": "2023-11-09T16:29:08"
}
}

View file

@ -535,6 +535,7 @@ Check column "offline" for their availability.
|`hf mf gsave `|N |`Save dump from card into file or emulator`
|`hf mf gsetblk `|N |`Write block to card`
|`hf mf gview `|N |`View card`
|`hf mf gchpwd `|N |`Change card access password. Warning!`
|`hf mf gdmcfg `|N |`Read config block from card`
|`hf mf gdmsetcfg `|N |`Write config block to card`
|`hf mf gdmsetblk `|N |`Write block to card`

View file

@ -73,8 +73,7 @@ typedef struct {
} iso14a_mf_extdump_t;
typedef struct {
union
{
union {
iso14a_card_select_t mfc;
iso14a_card_select_ev1_t ev1;
} card;

View file

@ -38,7 +38,7 @@ import fnmatch
#
# Info:
# Will search all dump files files in given folder and all its subfolders
# With the option to save found keys to a text file.
# With the option to save found keys to a text file.
#
'''
@ -60,7 +60,7 @@ def parse_keys(line):
if not key:
return []
try:
try:
keys.add(key[0])
keys.add(key[1])
except AttributeError:
@ -116,7 +116,7 @@ def main():
found = False
for line in msg.splitlines():
if found == False:
if found == False:
key_row = line.find('000 | 003')
if key_row > -1:
found = True