mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
style
This commit is contained in:
parent
7fa09a556a
commit
f8f135a3b7
17 changed files with 240 additions and 226 deletions
|
@ -151,20 +151,20 @@ void ModInfo(void) {
|
|||
}
|
||||
|
||||
void RunMod(void) {
|
||||
char *protocols[]=HF_UNISNIFF_PROTOCOLS;
|
||||
char *protocols[] = HF_UNISNIFF_PROTOCOLS;
|
||||
uint8_t sniff_protocol, default_sniff_protocol;
|
||||
StandAloneMode();
|
||||
|
||||
Dbprintf(_YELLOW_("HF UNISNIFF started"));
|
||||
for (sniff_protocol=0; sniff_protocol<HF_UNISNIFF_NUM_PROTOCOLS; sniff_protocol++) {
|
||||
for (sniff_protocol = 0; sniff_protocol < HF_UNISNIFF_NUM_PROTOCOLS; sniff_protocol++) {
|
||||
if (!strcmp(protocols[sniff_protocol], HF_UNISNIFF_PROTOCOL)) break;
|
||||
}
|
||||
default_sniff_protocol=sniff_protocol;
|
||||
default_sniff_protocol = sniff_protocol;
|
||||
#ifdef HF_UNISNIFF_VERBOSE_DEBUG
|
||||
Dbprintf("Compile-time configured protocol: %d", sniff_protocol);
|
||||
#endif
|
||||
#ifdef WITH_FLASH
|
||||
uint8_t save_mode=HF_UNISNIFF_SAVE_MODE;
|
||||
uint8_t save_mode = HF_UNISNIFF_SAVE_MODE;
|
||||
rdv40_spiffs_lazy_mount();
|
||||
// Allocate memory now for buffer for filename to save to. Who knows what'll be
|
||||
// available after filling the trace buffer.
|
||||
|
@ -197,10 +197,10 @@ void RunMod(void) {
|
|||
char *tag = strtok(config_buffer, "=");
|
||||
char *value = strtok(NULL, "\n");
|
||||
if (tag != NULL && value != NULL) {
|
||||
if (!strcmp(tag,"protocol")) {
|
||||
if (!strcmp(tag, "protocol")) {
|
||||
// If we got a selection here, override compile-time selection
|
||||
uint8_t conf_protocol;
|
||||
for (conf_protocol=0; conf_protocol<HF_UNISNIFF_NUM_PROTOCOLS; conf_protocol++) {
|
||||
for (conf_protocol = 0; conf_protocol < HF_UNISNIFF_NUM_PROTOCOLS; conf_protocol++) {
|
||||
if (!strcmp(protocols[conf_protocol], value)) {
|
||||
sniff_protocol = conf_protocol;
|
||||
break;
|
||||
|
@ -209,8 +209,8 @@ void RunMod(void) {
|
|||
#ifdef HF_UNISNIFF_VERBOSE_DEBUG
|
||||
Dbprintf("Run-time configured protocol: %d", conf_protocol);
|
||||
#endif
|
||||
} else if (!strcmp(tag,"save")) {
|
||||
if (!strcmp(value,"append")) save_mode = HF_UNISNIFF_SAVE_MODE_APPEND;
|
||||
} else if (!strcmp(tag, "save")) {
|
||||
if (!strcmp(value, "append")) save_mode = HF_UNISNIFF_SAVE_MODE_APPEND;
|
||||
else if (!strcmp(value, "none")) save_mode = HF_UNISNIFF_SAVE_MODE_NONE;
|
||||
else save_mode = HF_UNISNIFF_SAVE_MODE_NEW;
|
||||
#ifdef HF_UNISNIFF_VERBOSE_DEBUG
|
||||
|
@ -243,13 +243,13 @@ void RunMod(void) {
|
|||
int button_pressed = BUTTON_HELD(1000);
|
||||
if (button_pressed == BUTTON_SINGLE_CLICK) {
|
||||
sniff_protocol++;
|
||||
if (sniff_protocol >= HF_UNISNIFF_PROTO_USER) sniff_protocol=0;
|
||||
if (sniff_protocol >= HF_UNISNIFF_PROTO_USER) sniff_protocol = 0;
|
||||
SpinDelay(100);
|
||||
Dbprintf("Selected protocol: '%s'", protocols[sniff_protocol]);
|
||||
} else if (button_pressed == BUTTON_HOLD) {
|
||||
Dbprintf("Executing protocol %s", protocols[sniff_protocol]);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
LED(15,0);
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
LED(15, 0);
|
||||
SpinDelay(100);
|
||||
LEDsoff();
|
||||
SpinDelay(100);
|
||||
|
@ -262,7 +262,7 @@ void RunMod(void) {
|
|||
}
|
||||
}
|
||||
|
||||
switch(sniff_protocol) {
|
||||
switch (sniff_protocol) {
|
||||
case HF_UNISNIFF_PROTO_14a:
|
||||
SniffIso14443a(0);
|
||||
break;
|
||||
|
@ -300,7 +300,7 @@ void RunMod(void) {
|
|||
|
||||
sprintf(filename, "%s_%s%s", HF_UNISNIFF_LOGFILE, protocols[sniff_protocol], HF_UNISNIFF_LOGEXT);
|
||||
if (save_mode == HF_UNISNIFF_SAVE_MODE_NEW) {
|
||||
uint16_t file_index=0;
|
||||
uint16_t file_index = 0;
|
||||
while (exists_in_spiffs(filename)) {
|
||||
if (file_index++ == 1000) break;
|
||||
sprintf(filename, "%s_%s-%03d%s", HF_UNISNIFF_LOGFILE, protocols[sniff_protocol],
|
||||
|
|
|
@ -970,8 +970,8 @@ static int CmdAnalyseFreq(const char *Cmd) {
|
|||
PrintAndLogEx(INFO, " 13.56 mHz has %f m, rf range %f m", len_1356, rf_range_1356);
|
||||
|
||||
PrintAndLogEx(INFO, "Antenna lengths");
|
||||
PrintAndLogEx(INFO, " 125 kHz 1/2 = %f m, 1/4 = %f m", (len_125 / 2), (len_125 / 4) );
|
||||
PrintAndLogEx(INFO, " 134 kHz 1/2 = %f m, 1/4 = %f m", (len_134 / 2), (len_134 / 4) );
|
||||
PrintAndLogEx(INFO, " 125 kHz 1/2 = %f m, 1/4 = %f m", (len_125 / 2), (len_125 / 4));
|
||||
PrintAndLogEx(INFO, " 134 kHz 1/2 = %f m, 1/4 = %f m", (len_134 / 2), (len_134 / 4));
|
||||
PrintAndLogEx(INFO, " 13.56 mHz 1/2 = %f m, 1/4 = %f m", (len_1356 / 2), (len_1356 / 4));
|
||||
|
||||
|
||||
|
|
|
@ -922,7 +922,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
|||
uint8_t data[PM3_CMD_DATA_SIZE] = { 0x0a | gs_frames_num, 0x00};
|
||||
gs_frames_num ^= 1;
|
||||
|
||||
int min = MIN( (PM3_CMD_DATA_SIZE - 2), (datainlen & 0x1FF));
|
||||
int min = MIN((PM3_CMD_DATA_SIZE - 2), (datainlen & 0x1FF));
|
||||
memcpy(&data[2], datain, min);
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_APPEND_CRC | cmdc, (datainlen & 0xFFFF) + 2, 0, data, min + 2);
|
||||
|
||||
|
|
|
@ -1332,52 +1332,52 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|||
if (data_size > 1) {
|
||||
// key : uint16_t uKeyNum = 0x4000 + sectorNum * 2 + (keyB ? 1 : 0);
|
||||
uint16_t uKeyNum = MemLeToUint2byte(data);
|
||||
switch (uKeyNum & 0xf000){
|
||||
const char* stringdata;
|
||||
switch (uKeyNum & 0xf000) {
|
||||
const char *stringdata;
|
||||
default:
|
||||
stringdata = "FIRST AUTH (Keynr 0x%04X: Key not identified)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
case 0x4000:
|
||||
snprintf(exp, size, "FIRST AUTH (Keynr 0x%04X: %c sector %d)", uKeyNum, uKeyNum & 0x0001 ? 'B' : 'A', (uKeyNum - 0x4000) / 2);
|
||||
break;
|
||||
case 0xA000: // There are virtual card encryption and MACing keys, but this is NOT their place!
|
||||
stringdata = "FIRST AUTH(Keynr 0x%04X: Proximity Check Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
case 0x9000:
|
||||
switch (uKeyNum & 0xf){
|
||||
switch (uKeyNum & 0xf) {
|
||||
case 0x0:
|
||||
stringdata = "FIRST AUTH (Keynr 0x%04X: Card Master Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
case 0x1:
|
||||
stringdata = "FIRST AUTH (Keynr 0x%04X: Card Configuration Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
case 0x2:
|
||||
stringdata = "FIRST AUTH(Keynr 0x%04X: SL2 Switch Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
case 0x3:
|
||||
stringdata = "FIRST AUTH(Keynr 0x%04X: SL3 Switch Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
case 0x4:
|
||||
stringdata = "FIRST AUTH(Keynr 0x%04X: SL1 Additional Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
case 0x6:
|
||||
stringdata = "FIRST AUTH(Keynr 0x%04X: SL3 Sector Switch Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
case 0x7:
|
||||
stringdata = "FIRST AUTH(Keynr 0x%04X: SL1SL3Mix Sector Switch Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
default:
|
||||
stringdata = "FIRST AUTH(Keynr 0x%04X: Management Key not identified)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uKeyNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uKeyNum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1430,8 +1430,8 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|||
|
||||
if (data_size > 1) {
|
||||
uint16_t uBlockNum = MemLeToUint2byte(data);
|
||||
switch (uBlockNum & 0xF000){
|
||||
const char* stringdata;
|
||||
switch (uBlockNum & 0xF000) {
|
||||
const char *stringdata;
|
||||
default:
|
||||
stringdata = "WRITE %s(%u) %s";
|
||||
snprintf(exp, size, stringdata, encrypted, uBlockNum, responseMaced);
|
||||
|
@ -1441,66 +1441,66 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|||
break;
|
||||
case 0xA000: // There are virtual card encryption and MACing keys, but this is NOT their place!
|
||||
stringdata = "WRITE(Keynr 0x%04X: Proximity Check Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0xB000:
|
||||
case 0x9000:
|
||||
if ((uBlockNum & 0x2000) == 0x2000){
|
||||
switch (uBlockNum & 0xf){
|
||||
if ((uBlockNum & 0x2000) == 0x2000) {
|
||||
switch (uBlockNum & 0xf) {
|
||||
default:
|
||||
stringdata = "WRITE(Config %04X: Unidentified)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x0:
|
||||
stringdata = "WRITE(Config %04X: Config)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x1:
|
||||
stringdata = "WRITE(Config %04X: Virtual Card Installation ID)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x2:
|
||||
stringdata = "WRITE(Config %04X: ATS)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x3:
|
||||
stringdata = "WRITE(Config %04X: Field configuration)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (uBlockNum & 0xf){
|
||||
switch (uBlockNum & 0xf) {
|
||||
default:
|
||||
stringdata = "WRITE(Keynr 0x%04X: Management Key not identified)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x0:
|
||||
stringdata = "WRITE(Keynr 0x%04X: Card Master Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x1:
|
||||
stringdata = "WRITE(Keynr 0x%04X: Card Configuration Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x2:
|
||||
stringdata = "WRITE(Keynr 0x%04X: SL2 Switch Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x3:
|
||||
stringdata = "WRITE(Keynr 0x%04X: SL3 Switch Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x4:
|
||||
stringdata = "WRITE(Keynr 0x%04X: SL1 Additional Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x6:
|
||||
stringdata = "WRITE(Keynr 0x%04X: SL3 Sector Switch Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
case 0x7:
|
||||
stringdata = "WRITE(Keynr 0x%04X: SL1SL3Mix Sector Switch Key)";
|
||||
snprintf(exp, strlen(stringdata)+1, stringdata, uBlockNum);
|
||||
snprintf(exp, strlen(stringdata) + 1, stringdata, uBlockNum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -681,23 +681,23 @@ static int CmdHFMFPAuth(const char *Cmd) {
|
|||
|
||||
return MifareAuth4(NULL, keyn, key, true, false, true, verbose, false);
|
||||
}
|
||||
static int data_crypt(mf4Session_t *mf4session, uint8_t *dati, uint8_t *dato, bool rev){
|
||||
uint8_t kenc[16];
|
||||
static int data_crypt(mf4Session_t *mf4session, uint8_t *dati, uint8_t *dato, bool rev) {
|
||||
uint8_t kenc[16];
|
||||
memcpy(kenc, mf4session->Kenc, 16);
|
||||
uint8_t ti[4];
|
||||
memcpy(ti, mf4session->TI, 4);
|
||||
uint8_t ctr[1];
|
||||
uint8_t IV[16] ={0,0,0x00,0x00,0x00,0,0x00,0x00,0x00,0};
|
||||
if (rev){
|
||||
uint8_t IV[16] = {0, 0, 0x00, 0x00, 0x00, 0, 0x00, 0x00, 0x00, 0};
|
||||
if (rev) {
|
||||
ctr[0] = (uint8_t)(mf4session->R_Ctr & 0xff);
|
||||
for (int i = 0; i<9; i+=4){memcpy(&IV[i], ctr, 1);}
|
||||
for (int i = 0; i < 9; i += 4) {memcpy(&IV[i], ctr, 1);}
|
||||
memcpy(&IV[12], ti, 4); // For reads TI is LS
|
||||
} else {
|
||||
ctr[0] = (uint8_t)(mf4session->W_Ctr & 0xff);
|
||||
for (int i = 3; i<16; i+=4){memcpy(&IV[i], ctr, 1);}
|
||||
for (int i = 3; i < 16; i += 4) {memcpy(&IV[i], ctr, 1);}
|
||||
memcpy(&IV[0], ti, 4); // For writes TI is MS
|
||||
}
|
||||
if (rev){
|
||||
if (rev) {
|
||||
aes_decode(IV, kenc, dati, dato, 16);
|
||||
} else {
|
||||
aes_encode(IV, kenc, dati, dato, 16);
|
||||
|
@ -905,7 +905,7 @@ static int CmdHFMFPRdsc(const char *Cmd) {
|
|||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
if (datalen != 1 + MFBLOCK_SIZE + (nomacres? 0 : 8) + 2) {
|
||||
if (datalen != 1 + MFBLOCK_SIZE + (nomacres ? 0 : 8) + 2) {
|
||||
PrintAndLogEx(ERR, "Error return length:%d", datalen);
|
||||
DropField();
|
||||
return PM3_ESOFT;
|
||||
|
@ -1097,14 +1097,14 @@ static int CmdHFMFPChKey(const char *Cmd) {
|
|||
}
|
||||
mf4Session_t mf4session;
|
||||
keyn[0] = ki[0];
|
||||
if (ki[0] == 0x40){ // Only if we are working with sector keys
|
||||
if (usekeyb){
|
||||
keyn[1] = (ki[1] % 2 ==0) ? ki[1] + 1 : ki[1]; // If we change using key B, check if KI is key A
|
||||
if (ki[0] == 0x40) { // Only if we are working with sector keys
|
||||
if (usekeyb) {
|
||||
keyn[1] = (ki[1] % 2 == 0) ? ki[1] + 1 : ki[1]; // If we change using key B, check if KI is key A
|
||||
} else {
|
||||
keyn[1] = (ki[1] % 2 ==0) ? ki[1] : ki[1] -1; // If we change using key A, check if KI is key A
|
||||
keyn[1] = (ki[1] % 2 == 0) ? ki[1] : ki[1] - 1; // If we change using key A, check if KI is key A
|
||||
}
|
||||
} else {keyn[1] = ki[1];}
|
||||
if (verbose){
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "--key index:", sprint_hex(keyn, 2));
|
||||
}
|
||||
int res = MifareAuth4(&mf4session, keyn, key, true, true, true, verbose, false);
|
||||
|
@ -1216,7 +1216,7 @@ static int CmdHFMFPChConf(const char *Cmd) {
|
|||
mf4Session_t mf4session;
|
||||
keyn[0] = 0x90;
|
||||
keyn[1] = usecck ? 0x01 : 0x00;
|
||||
if (verbose){
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "--key index:", sprint_hex(keyn, 2));
|
||||
}
|
||||
int res = MifareAuth4(&mf4session, keyn, key, true, true, true, verbose, false);
|
||||
|
|
|
@ -1293,7 +1293,7 @@ int CmdTraceList(const char *Cmd) {
|
|||
|
||||
if (use_buffer == false) {
|
||||
download_trace();
|
||||
} else if (gs_traceLen == 0 || gs_trace ==NULL) {
|
||||
} else if (gs_traceLen == 0 || gs_trace == NULL) {
|
||||
PrintAndLogEx(FAILED, "You requested a trace list in offline mode but there is no trace.");
|
||||
PrintAndLogEx(FAILED, "Consider using " _YELLOW_("`trace load`") " or removing parameter " _YELLOW_("`-1`"));
|
||||
return PM3_EINVARG;
|
||||
|
|
|
@ -258,7 +258,7 @@ int MifareAuth4(mf4Session_t *mf4session, uint8_t *keyn, uint8_t *key, bool acti
|
|||
memmove(&raw[16], &RndB[1], 16);
|
||||
|
||||
aes_encode(NULL, key, raw, &cmd2[1], 32);
|
||||
if (verbose){
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, ">phase2: %s", sprint_hex(cmd2, 33));
|
||||
}
|
||||
res = ExchangeRAW14a(cmd2, sizeof(cmd2), false, true, data, sizeof(data), &datalen, silentMode);
|
||||
|
@ -374,16 +374,16 @@ int MFPCommitPerso(bool activateField, bool leaveSignalON, uint8_t *dataout, int
|
|||
|
||||
int MFPReadBlock(mf4Session_t *mf4session, bool plain, bool nomaccmd, bool nomacres, uint8_t blockNum, uint8_t blockCount, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, uint8_t *mac) {
|
||||
int cmdb = 0x31;
|
||||
if (nomacres){cmdb = cmdb ^ 0x01;} // If we do not want MAC in reply, remove 0x01
|
||||
if (plain){cmdb = cmdb ^ 0x02;} // If we do not need an encrypted transmission, add 0x02
|
||||
if (nomaccmd){cmdb = cmdb ^ 0x04;} // If we do not want to send a MAC, remove 0x04
|
||||
if (nomacres) {cmdb = cmdb ^ 0x01;} // If we do not want MAC in reply, remove 0x01
|
||||
if (plain) {cmdb = cmdb ^ 0x02;} // If we do not need an encrypted transmission, add 0x02
|
||||
if (nomaccmd) {cmdb = cmdb ^ 0x04;} // If we do not want to send a MAC, remove 0x04
|
||||
uint8_t rcmd1[4] = {cmdb, blockNum, 0x00, blockCount};
|
||||
uint8_t maccmddat[8] = {0};
|
||||
uint8_t rcmd[nomaccmd ? 4 : 12];
|
||||
if (!nomaccmd && mf4session)
|
||||
CalculateMAC(mf4session, mtypReadCmd, blockNum, blockCount, rcmd1, 4, &maccmddat[0], g_verbose_mode);
|
||||
memmove(rcmd, rcmd1, 4);
|
||||
if (!nomaccmd){memmove(&rcmd[4], maccmddat, 8);}
|
||||
if (!nomaccmd) {memmove(&rcmd[4], maccmddat, 8);}
|
||||
int res = intExchangeRAW14aPlus(rcmd, sizeof(rcmd), activateField, leaveSignalON, dataout, maxdataoutlen, dataoutlen);
|
||||
if (res)
|
||||
return res;
|
||||
|
@ -397,8 +397,8 @@ int MFPReadBlock(mf4Session_t *mf4session, bool plain, bool nomaccmd, bool nomac
|
|||
|
||||
int MFPWriteBlock(mf4Session_t *mf4session, bool plain, bool nomacres, uint8_t blockNum, uint8_t blockHdr, uint8_t *data, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, uint8_t *mac) {
|
||||
int cmdb = 0xA1;
|
||||
if (nomacres){cmdb = cmdb ^ 0x01;} // If we do not want MAC in reply, remove 0x01
|
||||
if (plain){cmdb = cmdb ^ 0x02;} // If we do not need an encrypted transmission, add 0x02
|
||||
if (nomacres) {cmdb = cmdb ^ 0x01;} // If we do not want MAC in reply, remove 0x01
|
||||
if (plain) {cmdb = cmdb ^ 0x02;} // If we do not need an encrypted transmission, add 0x02
|
||||
uint8_t rcmd[1 + 2 + 16 + 8] = {cmdb, blockNum, blockHdr};
|
||||
memmove(&rcmd[3], data, 16);
|
||||
if (mf4session)
|
||||
|
|
|
@ -509,6 +509,7 @@ const static vocabulary_t vocabulary[] = {
|
|||
{ 0, "hf xerox dump" },
|
||||
{ 1, "hw help" },
|
||||
{ 0, "hw break" },
|
||||
{ 0, "hw bootloader" },
|
||||
{ 1, "hw connect" },
|
||||
{ 0, "hw dbg" },
|
||||
{ 0, "hw detectreader" },
|
||||
|
|
|
@ -762,7 +762,7 @@ static int setCmdDeviceDebug (const char *Cmd)
|
|||
}
|
||||
*/
|
||||
|
||||
int getDeviceDebugLevel (uint8_t *debug_level) {
|
||||
int getDeviceDebugLevel(uint8_t *debug_level) {
|
||||
if (!g_session.pm3_present)
|
||||
return PM3_EFAILED;
|
||||
|
||||
|
@ -780,19 +780,19 @@ int getDeviceDebugLevel (uint8_t *debug_level) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int setDeviceDebugLevel (uint8_t debug_level, bool verbose) {
|
||||
int setDeviceDebugLevel(uint8_t debug_level, bool verbose) {
|
||||
if (!g_session.pm3_present)
|
||||
return PM3_EFAILED;
|
||||
|
||||
if (verbose)
|
||||
PrintAndLogEx (INFO,"setting device debug loglevel to %u", debug_level);
|
||||
PrintAndLogEx(INFO, "setting device debug loglevel to %u", debug_level);
|
||||
|
||||
uint8_t cdata[] = {debug_level, verbose};
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_SET_DBGMODE, cdata, sizeof(cdata));
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_SET_DBGMODE, &resp, 2000) == false) {
|
||||
PrintAndLogEx (WARNING,"failed to set device debug loglevel");
|
||||
PrintAndLogEx(WARNING, "failed to set device debug loglevel");
|
||||
return PM3_EFAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ int preferences_save(void);
|
|||
void preferences_save_callback(json_t *root);
|
||||
void preferences_load_callback(json_t *root);
|
||||
|
||||
int getDeviceDebugLevel (uint8_t *debug_level);
|
||||
int setDeviceDebugLevel (uint8_t debug_level, bool verbose);
|
||||
int getDeviceDebugLevel(uint8_t *debug_level);
|
||||
int setDeviceDebugLevel(uint8_t debug_level, bool verbose);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1233,7 +1233,7 @@ size_t str_nlen(const char *src, size_t maxlen) {
|
|||
}
|
||||
|
||||
void str_reverse(char *buf, size_t len) {
|
||||
for (size_t i = 0; i < (len>>1); i++) {
|
||||
for (size_t i = 0; i < (len >> 1); i++) {
|
||||
char tmp = buf[i];
|
||||
buf[i] = buf[len - i - 1];
|
||||
buf[len - i - 1] = tmp;
|
||||
|
@ -1252,7 +1252,7 @@ void str_inverse_bin(char *buf, size_t len) {
|
|||
char c = buf[i];
|
||||
if (c == '1')
|
||||
buf[i] = '0';
|
||||
else if ( c == '0')
|
||||
else if (c == '0')
|
||||
buf[i] = '1';
|
||||
else
|
||||
buf[i] = '.';
|
||||
|
|
|
@ -330,7 +330,7 @@ int mfc_algo_saflok_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t
|
|||
if (keytype == 0 && sector == 2) {
|
||||
*key = 0xFFFFFFFFFFFF;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (keytype == 0 && sector == 1) {
|
||||
*key = 0x2a2c13cc242a;
|
||||
|
|
|
@ -2320,13 +2320,13 @@
|
|||
"notes": [
|
||||
"hf emrtd dump",
|
||||
"hf emrtd dump --dir ../dump",
|
||||
"hf emrtd dump -n 123456789 -d 19890101 -e 20250401"
|
||||
"hf emrtd dump -n 123456789 -d 890101 -e 250401"
|
||||
],
|
||||
"offline": false,
|
||||
"options": [
|
||||
"-h, --help This help",
|
||||
"-n, --documentnumber <alphanum> document number, up to 9 chars",
|
||||
"-d, --dateofbirth <YYMMDD> date of birth in YYMMDD format",
|
||||
"-n, --doc <alphanum> document number, up to 9 chars",
|
||||
"-d, --date <YYMMDD> date of birth in YYMMDD format",
|
||||
"-e, --expiry <YYMMDD> expiry in YYMMDD format",
|
||||
"-m, --mrz <[0-9A-Z<]> 2nd line of MRZ, 44 chars",
|
||||
"--dir <str> save dump to the given dirpath"
|
||||
|
@ -2339,14 +2339,14 @@
|
|||
"notes": [
|
||||
"hf emrtd info",
|
||||
"hf emrtd info --dir ../dumps",
|
||||
"hf emrtd info -n 123456789 -d 19890101 -e 20250401",
|
||||
"hf emrtd info -n 123456789 -d 19890101 -e 20250401 -i"
|
||||
"hf emrtd info -n 123456789 -d 890101 -e 250401",
|
||||
"hf emrtd info -n 123456789 -d 890101 -e 250401 -i"
|
||||
],
|
||||
"offline": true,
|
||||
"options": [
|
||||
"-h, --help This help",
|
||||
"-n, --documentnumber <alphanum> document number, up to 9 chars",
|
||||
"-d, --dateofbirth <YYMMDD> date of birth in YYMMDD format",
|
||||
"-n, --doc <alphanum> document number, up to 9 chars",
|
||||
"-d, --date <YYMMDD> date of birth in YYMMDD format",
|
||||
"-e, --expiry <YYMMDD> expiry in YYMMDD format",
|
||||
"-m, --mrz <[0-9A-Z<]> 2nd line of MRZ, 44 chars (passports only)",
|
||||
"--dir <str> display info from offline dump stored in dirpath",
|
||||
|
@ -4712,7 +4712,7 @@
|
|||
"description": "Information and check vulnerabilities in a MIFARE Classic card Some cards in order to extract information you need to specify key and/or specific keys in the copmmand line",
|
||||
"notes": [
|
||||
"hf mf info",
|
||||
"hf mf info -k ffffffff -n -v"
|
||||
"hf mf info -k FFFFFFFFFFFF -n -v"
|
||||
],
|
||||
"offline": false,
|
||||
"options": [
|
||||
|
@ -7601,6 +7601,18 @@
|
|||
],
|
||||
"usage": "hints [-h10]"
|
||||
},
|
||||
"hw bootloader": {
|
||||
"command": "hw bootloader",
|
||||
"description": "Reboot Proxmark3 into bootloader mode",
|
||||
"notes": [
|
||||
"hw bootloader"
|
||||
],
|
||||
"offline": false,
|
||||
"options": [
|
||||
"-h, --help This help"
|
||||
],
|
||||
"usage": "hw bootloader [-h]"
|
||||
},
|
||||
"hw break": {
|
||||
"command": "hw break",
|
||||
"description": "send break loop package",
|
||||
|
@ -9055,7 +9067,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>"
|
||||
},
|
||||
|
@ -12146,8 +12158,8 @@
|
|||
}
|
||||
},
|
||||
"metadata": {
|
||||
"commands_extracted": 702,
|
||||
"commands_extracted": 703,
|
||||
"extracted_by": "PM3Help2JSON v1.00",
|
||||
"extracted_on": "2023-12-11T23:10:13"
|
||||
"extracted_on": "2023-12-18T09:05:00"
|
||||
}
|
||||
}
|
|
@ -784,6 +784,7 @@ Check column "offline" for their availability.
|
|||
|------- |------- |-----------
|
||||
|`hw help `|Y |`This help`
|
||||
|`hw break `|N |`Send break loop usb command`
|
||||
|`hw bootloader `|N |`Reboot Proxmark3 into bootloader mode`
|
||||
|`hw connect `|Y |`Connect Proxmark3 to serial port`
|
||||
|`hw dbg `|N |`Set Proxmark3 debug level`
|
||||
|`hw detectreader `|N |`Detect external reader field`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue