style
This commit is contained in:
1 parent
21e54ba9b1
commit
238572c337
14 files changed
+81
-82
No files matched your search
@@ -870,7 +870,7 @@ int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveG
|
||||
if (distance == -1) {
|
||||
distance = peaks[i];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (peaks[i] < distance) {
|
||||
distance = peaks[i];
|
||||
@@ -3416,7 +3416,7 @@ static int CmdNumCon(const char *Cmd) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
// MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod(&N, &N, &base));
|
||||
break;
|
||||
|
||||
+15
-15
@@ -1285,7 +1285,7 @@ static void emrtd_print_issuance(char *data, bool ascii) {
|
||||
}
|
||||
|
||||
static void emrtd_print_personalization_timestamp(uint8_t *data, size_t datalen) {
|
||||
if (datalen < 7 ) {
|
||||
if (datalen < 7) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1294,13 +1294,13 @@ static void emrtd_print_personalization_timestamp(uint8_t *data, size_t datalen)
|
||||
|
||||
char final_date[20] = { 0x00 };
|
||||
snprintf(final_date, sizeof(final_date), "%.4s-%.2s-%.2s %.2s:%.2s:%.2s"
|
||||
, str_date
|
||||
, str_date + 4
|
||||
, str_date + 6
|
||||
, str_date + 8
|
||||
, str_date + 10
|
||||
, str_date + 12
|
||||
);
|
||||
, str_date
|
||||
, str_date + 4
|
||||
, str_date + 6
|
||||
, str_date + 8
|
||||
, str_date + 10
|
||||
, str_date + 12
|
||||
);
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Personalization at....: " _YELLOW_("%s"), final_date);
|
||||
}
|
||||
@@ -1311,13 +1311,13 @@ static void emrtd_print_unknown_timestamp_5f85(uint8_t *data, size_t datalen) {
|
||||
}
|
||||
char final_date[20] = { 0x00 };
|
||||
snprintf(final_date, sizeof(final_date), "%.4s-%.2s-%.2s %.2s:%.2s:%.2s"
|
||||
, data
|
||||
, data + 4
|
||||
, data + 6
|
||||
, data + 8
|
||||
, data + 10
|
||||
, data + 12
|
||||
);
|
||||
, data
|
||||
, data + 4
|
||||
, data + 6
|
||||
, data + 8
|
||||
, data + 10
|
||||
, data + 12
|
||||
);
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Unknown timestamp 5F85: " _YELLOW_("%s"), final_date);
|
||||
PrintAndLogEx(HINT, "This is very likely the personalization timestamp, but it is using an undocumented tag.");
|
||||
|
||||
@@ -8965,7 +8965,7 @@ static int CmdHF14AMfInfo(const char *Cmd) {
|
||||
|
||||
if (
|
||||
(blockdata[8] == 0x03 && blockdata[15] == 0x90) ||
|
||||
(blockdata[9] == 0x02 && blockdata[14] == 0x1D) ||
|
||||
(blockdata[9] == 0x02 && blockdata[14] == 0x1D) ||
|
||||
(memcmp(blockdata + 8, "\x62\x63\x64\x65\x66\x67\x68\x69", 8) == 0)
|
||||
) {
|
||||
PrintAndLogEx(SUCCESS, " Fudan tag detected");
|
||||
|
||||
+33
-33
@@ -1682,46 +1682,46 @@ static int CmdHFMFPDump(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, " To be implemented, feel free to contribute!");
|
||||
return PM3_ENOTIMPL;
|
||||
|
||||
/*
|
||||
mfpSetVerboseMode(verbose);
|
||||
/*
|
||||
mfpSetVerboseMode(verbose);
|
||||
|
||||
// read card
|
||||
uint8_t *mem = calloc(MIFARE_4K_MAXBLOCK * MFBLOCK_SIZE, sizeof(uint8_t));
|
||||
if (mem == NULL) {
|
||||
PrintAndLogEx(ERR, "failed to allocate memory");
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
// read card
|
||||
uint8_t *mem = calloc(MIFARE_4K_MAXBLOCK * MFBLOCK_SIZE, sizeof(uint8_t));
|
||||
if (mem == NULL) {
|
||||
PrintAndLogEx(ERR, "failed to allocate memory");
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
|
||||
|
||||
// iso14a_card_select_t card ;
|
||||
// int res = mfp_read_tag(&card, mem, key_fn);
|
||||
// if (res != PM3_SUCCESS) {
|
||||
// free(mem);
|
||||
// return res;
|
||||
// }
|
||||
// iso14a_card_select_t card ;
|
||||
// int res = mfp_read_tag(&card, mem, key_fn);
|
||||
// if (res != PM3_SUCCESS) {
|
||||
// free(mem);
|
||||
// return res;
|
||||
// }
|
||||
|
||||
|
||||
// Skip saving card data to file
|
||||
if (nosave) {
|
||||
PrintAndLogEx(INFO, "Called with no save option");
|
||||
// Skip saving card data to file
|
||||
if (nosave) {
|
||||
PrintAndLogEx(INFO, "Called with no save option");
|
||||
free(mem);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// Save to file
|
||||
// if (strlen(data_fn) < 1) {
|
||||
// char *fptr = calloc(sizeof(char) * (strlen("hf-mfp-") + strlen("-dump")) + card.uidlen * 2 + 1, sizeof(uint8_t));
|
||||
// strcpy(fptr, "hf-mfp-");
|
||||
// FillFileNameByUID(fptr, card.uid, "-dump", card.uidlen);
|
||||
// strcpy(data_fn, fptr);
|
||||
// free(fptr);
|
||||
// }
|
||||
|
||||
// pm3_save_mf_dump(filename, dump, MIFARE_4K_MAX_BYTES, jsfCardMemory);
|
||||
|
||||
free(mem);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// Save to file
|
||||
// if (strlen(data_fn) < 1) {
|
||||
// char *fptr = calloc(sizeof(char) * (strlen("hf-mfp-") + strlen("-dump")) + card.uidlen * 2 + 1, sizeof(uint8_t));
|
||||
// strcpy(fptr, "hf-mfp-");
|
||||
// FillFileNameByUID(fptr, card.uid, "-dump", card.uidlen);
|
||||
// strcpy(data_fn, fptr);
|
||||
// free(fptr);
|
||||
// }
|
||||
|
||||
// pm3_save_mf_dump(filename, dump, MIFARE_4K_MAX_BYTES, jsfCardMemory);
|
||||
|
||||
free(mem);
|
||||
return PM3_SUCCESS;
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-8
@@ -1916,13 +1916,13 @@ int CmdLFfind(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, _CYAN_("Checking for unknown tags...") "\n");
|
||||
|
||||
uint8_t ones[] = {
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
};
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
};
|
||||
|
||||
// FSK
|
||||
PrintAndLogEx(INFO, "FSK clock.......... " NOLF);
|
||||
@@ -1971,7 +1971,7 @@ int CmdLFfind(const char *Cmd) {
|
||||
check_autocorrelate("NRZ", clock);
|
||||
found++;
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "NRZ ............... " _RED_("false positive"));
|
||||
PrintAndLogEx(INFO, "NRZ ............... " _RED_("false positive"));
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -168,8 +168,8 @@ static int usart_bt_testcomm(uint32_t baudrate, uint8_t parity) {
|
||||
if (ret == PM3_SUCCESS) {
|
||||
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
|
||||
if (str_startswith((char *)data, "hc01.comV2.0") ||
|
||||
str_startswith((char *)data, "www.hc01.com") ||
|
||||
str_startswith((char *)data, "BT SPP V4.0")) {
|
||||
str_startswith((char *)data, "www.hc01.com") ||
|
||||
str_startswith((char *)data, "BT SPP V4.0")) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Add-on " _GREEN_("found!"));
|
||||
|
||||
@@ -310,7 +310,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
len = 0;
|
||||
|
||||
|
||||
if (isBluetoothExtensionHC04 == true) {
|
||||
string = "AT+PIN=1234";
|
||||
} else {
|
||||
@@ -378,7 +378,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
|
||||
} else {
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
len=0;
|
||||
len = 0;
|
||||
string = "AT+BAUD=115200,N";
|
||||
PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);
|
||||
|
||||
|
||||
+2
-2
@@ -362,7 +362,7 @@ void *uart_reconnect(void *targ) {
|
||||
}
|
||||
|
||||
if (g_session.pm3_present && (TestProxmark(g_session.current_device) != PM3_SUCCESS)) {
|
||||
CloseProxmark(g_session.current_device);
|
||||
CloseProxmark(g_session.current_device);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -728,7 +728,7 @@ bool OpenProxmarkSilent(pm3_device_t **dev, const char *port, uint32_t speed) {
|
||||
pthread_create(&communication_thread, NULL, &uart_communication, &g_conn);
|
||||
__atomic_clear(&comm_thread_dead, __ATOMIC_SEQ_CST);
|
||||
__atomic_clear(&reconnect_ok, __ATOMIC_SEQ_CST);
|
||||
|
||||
|
||||
g_session.pm3_present = true; // TODO support for multiple devices
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
@@ -190,7 +190,7 @@ static int check_comm(void) {
|
||||
CloseProxmark(g_session.current_device);
|
||||
StartReconnectProxmark();
|
||||
c_update_reconnect_prompt = true;
|
||||
}
|
||||
}
|
||||
// its alive again
|
||||
if (c_update_reconnect_prompt && IsReconnectedOk() && g_session.pm3_present) {
|
||||
|
||||
|
||||
@@ -131,4 +131,4 @@ int uart_parse_address_port(char *addrPortStr, const char **addrStr, const char
|
||||
}
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -108,8 +108,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed, bool slient) {
|
||||
bool isUDP = false;
|
||||
bool isBluetooth = false;
|
||||
bool isUnixSocket = false;
|
||||
if (strlen(prefix) > 4)
|
||||
{
|
||||
if (strlen(prefix) > 4) {
|
||||
isTCP = (memcmp(prefix, "tcp:", 4) == 0);
|
||||
isUDP = (memcmp(prefix, "udp:", 4) == 0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user