mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
style
This commit is contained in:
parent
9ebe5ae8dd
commit
20a0bc3a81
12 changed files with 56 additions and 48 deletions
|
@ -39,16 +39,16 @@
|
|||
|
||||
static struct hitagS_tag tag = {
|
||||
.pages =
|
||||
{
|
||||
// Plain mode: | Authentication mode:
|
||||
[0] = {0x88, 0xcd, 0x6d, 0xf3}, // UID | UID
|
||||
[1] = {0xca, 0x24, 0x00, 0x00}, // CON0 CON1 CON2 Reserved | CON0 CON1 CON2 PWDH0
|
||||
[2] = {0xaa, 0xaa, 0xaa, 0xaa}, // Data | PWDL0 PWDL1 KEYH0 KEYH1
|
||||
[3] = {0x55, 0x55, 0x55, 0x55}, // Data | KEYL0 KEYL1 KEYL2 KEYL3
|
||||
[4] = {0xff, 0x80, 0x00, 0x00}, // Data
|
||||
[5] = {0x00, 0x00, 0x00, 0x00}, // Data
|
||||
// up to index 63 for HITAG S2048 public data
|
||||
},
|
||||
{
|
||||
// Plain mode: | Authentication mode:
|
||||
[0] = {0x88, 0xcd, 0x6d, 0xf3}, // UID | UID
|
||||
[1] = {0xca, 0x24, 0x00, 0x00}, // CON0 CON1 CON2 Reserved | CON0 CON1 CON2 PWDH0
|
||||
[2] = {0xaa, 0xaa, 0xaa, 0xaa}, // Data | PWDL0 PWDL1 KEYH0 KEYH1
|
||||
[3] = {0x55, 0x55, 0x55, 0x55}, // Data | KEYL0 KEYL1 KEYL2 KEYL3
|
||||
[4] = {0xff, 0x80, 0x00, 0x00}, // Data
|
||||
[5] = {0x00, 0x00, 0x00, 0x00}, // Data
|
||||
// up to index 63 for HITAG S2048 public data
|
||||
},
|
||||
};
|
||||
static uint8_t page_to_be_written = 0;
|
||||
static int block_data_left = 0;
|
||||
|
|
|
@ -2400,12 +2400,12 @@ int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype) {
|
|||
ui64Key = emlGetKey(s, MF_KEY_B);
|
||||
|
||||
if (mifare_classic_auth(pcs, cuid, FirstBlockOfSector(s), MF_KEY_B, ui64Key, AUTH_FIRST)) {
|
||||
retval = PM3_EPARTIAL;
|
||||
if (g_dbglevel >= DBG_ERROR) {
|
||||
Dbprintf("Sector %2d - Auth error", s);
|
||||
retval = PM3_EPARTIAL;
|
||||
if (g_dbglevel >= DBG_ERROR) {
|
||||
Dbprintf("Sector %2d - Auth error", s);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--[[
|
||||
Simple Trace Parser library
|
||||
--[[
|
||||
Simple Trace Parser library
|
||||
|
||||
-- fair warning, this is best to just get trace data values, I didn't see any better implementation for this, so I just made one myself
|
||||
|
||||
|
|
|
@ -2264,7 +2264,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
|||
card.ats_len = resp.oldarg[0]; // note: ats_len includes CRC Bytes
|
||||
if (card.ats_len > 3) {
|
||||
select_status = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (card.ats_len >= 3) { // a valid ATS consists of at least the length byte (TL) and 2 CRC bytes
|
||||
|
|
|
@ -3646,7 +3646,7 @@ static int CmdHF14AMfSmartBrute(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(INFO, "Current cracking speed (keys/s): %lu",
|
||||
keys_checked / ((msclock() - t1) / 1000)
|
||||
);
|
||||
);
|
||||
|
||||
t1 = msclock();
|
||||
keys_checked = 0;
|
||||
|
@ -7881,8 +7881,8 @@ static int parse_gtu_cfg(uint8_t *d, size_t n) {
|
|||
PrintAndLogEx(INFO, _CYAN_("Config 2 - ATS"));
|
||||
PrintAndLogEx(INFO, "%s", sprint_hex_inrow(d + 8, 16));
|
||||
if (atslen <= 16) {
|
||||
PrintAndLogEx(INFO, "%s.............. ATS ( %d bytes )", sprint_hex_inrow(&d[8], d[7]), d[7]);
|
||||
PrintAndLogEx(INFO, "..................%s Reserved for ATS", sprint_hex_inrow(d + 8 + d[7], 16 - d[7]));
|
||||
PrintAndLogEx(INFO, "%s.............. ATS ( %d bytes )", sprint_hex_inrow(&d[8], d[7]), d[7]);
|
||||
PrintAndLogEx(INFO, "..................%s Reserved for ATS", sprint_hex_inrow(d + 8 + d[7], 16 - d[7]));
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "%s.............. %u Reserved for ATS", sprint_hex_inrow(&d[8], 16), 16);
|
||||
}
|
||||
|
@ -9631,20 +9631,20 @@ static int CmdHF14AMfInfo(const char *Cmd) {
|
|||
} else if (fKeyType == MF_KEY_BD08 || fKeyType == MF_KEY_BD08S || fKeyType == MF_KEY_BD32) {
|
||||
PrintAndLogEx(SUCCESS, _RED_("Unknown card with backdoor, please report details!"));
|
||||
} else
|
||||
// other cards
|
||||
if (card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x46", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS5005");
|
||||
} else if (card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x47", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS5006");
|
||||
} else if (card.sak == 0x09 && memcmp(blockdata + 5, "\x89\x04\x00\x47", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS2006");
|
||||
} else if (card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x48", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS5007");
|
||||
} else if (card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\xc0", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS5035");
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, "unknown");
|
||||
}
|
||||
// other cards
|
||||
if (card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x46", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS5005");
|
||||
} else if (card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x47", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS5006");
|
||||
} else if (card.sak == 0x09 && memcmp(blockdata + 5, "\x89\x04\x00\x47", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS2006");
|
||||
} else if (card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x48", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS5007");
|
||||
} else if (card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\xc0", 4) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "NXP MF1ICS5035");
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, "unknown");
|
||||
}
|
||||
|
||||
if (e_sector[1].foundKey[MF_KEY_A] && (e_sector[1].Key[MF_KEY_A] == 0x2A2C13CC242A)) {
|
||||
PrintAndLogEx(SUCCESS, "Dorma Kaba SAFLOK detected");
|
||||
|
|
|
@ -4130,7 +4130,7 @@ static int CmdHF14AMfUCSetUid(const char *Cmd) {
|
|||
SendCommandNG(CMD_HF_ISO14443A_GET_CONFIG, NULL, 0);
|
||||
if (!WaitForResponseTimeout(CMD_HF_ISO14443A_GET_CONFIG, &resp, 2000)) {
|
||||
PrintAndLogEx(WARNING, "command execution time out);
|
||||
return PM3_ETIMEOUT;
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
memcpy(&config, resp.data.asBytes, sizeof(hf14a_config));
|
||||
int8_t oldconfig_bcc = config.forcebcc;
|
||||
|
|
|
@ -792,7 +792,7 @@ static int CmdEM410xClone(const char *Cmd) {
|
|||
}
|
||||
|
||||
packet.cmd = WHTSF_82xx;
|
||||
memcpy(packet.pwd, (uint8_t[]){0xBB, 0xDD, 0x33, 0x99}, 4);
|
||||
memcpy(packet.pwd, (uint8_t[]) {0xBB, 0xDD, 0x33, 0x99}, 4);
|
||||
SendCommandNG(CMD_LF_HITAGS_WRITE, (uint8_t *)&packet, sizeof(packet));
|
||||
if (WaitForResponseTimeout(CMD_LF_HITAGS_WRITE, &resp, 4000) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||
|
|
|
@ -107,7 +107,7 @@ static int CmdLFHitagSRead(const char *Cmd) {
|
|||
use_crypto = true;
|
||||
}
|
||||
if ((key_len == 0) && use_82xx) {
|
||||
memcpy(key, (uint8_t[]){0xBB, 0xDD, 0x33, 0x99}, 4);
|
||||
memcpy(key, (uint8_t[]) {0xBB, 0xDD, 0x33, 0x99}, 4);
|
||||
key_len = 4;
|
||||
}
|
||||
if ((key_len == 0) && use_crypto) {
|
||||
|
@ -266,7 +266,7 @@ static int CmdLFHitagSWrite(const char *Cmd) {
|
|||
use_crypto = true;
|
||||
}
|
||||
if ((key_len == 0) && use_82xx) {
|
||||
memcpy(key, (uint8_t[]){0xBB, 0xDD, 0x33, 0x99}, 4);
|
||||
memcpy(key, (uint8_t[]) {0xBB, 0xDD, 0x33, 0x99}, 4);
|
||||
key_len = 4;
|
||||
}
|
||||
if ((key_len == 0) && use_crypto) {
|
||||
|
|
|
@ -301,8 +301,8 @@ static int CmdScriptRun(const char *Cmd) {
|
|||
// and be able to send in parameters into script meanwhile
|
||||
// being able to "-h" here too.
|
||||
if ((strlen(filename) == 0) ||
|
||||
(strcmp(filename, "-h") == 0) ||
|
||||
(strcmp(filename, "--help") == 0)) {
|
||||
(strcmp(filename, "-h") == 0) ||
|
||||
(strcmp(filename, "--help") == 0)) {
|
||||
ctx->argtable = argtable;
|
||||
ctx->argtableLen = arg_getsize(argtable);
|
||||
CLIParserPrintHelp(ctx);
|
||||
|
|
|
@ -448,9 +448,12 @@ static struct emv_pk *emv_pk_get_ca_pk_from_file(const char *fname,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// not used
|
||||
/*
|
||||
char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsigned char idx) {
|
||||
if (!dirname)
|
||||
if (dirname == NULL) {
|
||||
dirname = ".";//openemv_config_get_str("capk.dir", NULL);
|
||||
}
|
||||
|
||||
char *filename;
|
||||
int ret = asprintf(&filename, "%s/%02hhx%02hhx%02hhx%02hhx%02hhx_%02hhx.0",
|
||||
|
@ -462,15 +465,17 @@ char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsig
|
|||
rid[4],
|
||||
idx);
|
||||
|
||||
if (ret <= 0)
|
||||
if (ret <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid) {
|
||||
if (!dirname)
|
||||
if (dirname == NULL) {
|
||||
dirname = "."; //openemv_config_get_str("capk.dir", NULL);
|
||||
}
|
||||
|
||||
char *filename;
|
||||
int ret = asprintf(&filename, "%s/%02hhx%02hhx%02hhx%02hhx%02hhx.pks",
|
||||
|
@ -481,11 +486,13 @@ char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid) {
|
|||
rid[3],
|
||||
rid[4]);
|
||||
|
||||
if (ret <= 0)
|
||||
if (ret <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
*/
|
||||
|
||||
struct emv_pk *emv_pk_get_ca_pk(const unsigned char *rid, unsigned char idx) {
|
||||
struct emv_pk *pk = NULL;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define EMV_PK_H
|
||||
|
||||
#include "common.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
struct emv_pk {
|
||||
unsigned char rid[5];
|
||||
|
@ -46,7 +47,7 @@ void emv_pk_free(struct emv_pk *pk);
|
|||
char *emv_pk_dump_pk(const struct emv_pk *pk);
|
||||
bool emv_pk_verify(const struct emv_pk *pk);
|
||||
|
||||
char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsigned char idx);
|
||||
char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid);
|
||||
// char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsigned char idx);
|
||||
// char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid);
|
||||
struct emv_pk *emv_pk_get_ca_pk(const unsigned char *rid, unsigned char idx);
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
|||
bool first_run = true;
|
||||
|
||||
// message
|
||||
PrintAndLogEx(INFO, "Expected execution time is about 25seconds on average");
|
||||
PrintAndLogEx(INFO, "Expected execution time is about " _YELLOW_("25") " seconds on average");
|
||||
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " to abort");
|
||||
|
||||
while (true) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue