This commit is contained in:
iceman1001 2024-01-01 21:52:05 +01:00
commit 238572c337
14 changed files with 81 additions and 82 deletions

View file

@ -1734,7 +1734,7 @@ static void PacketReceived(PacketCommandNG *packet) {
case CMD_HF_MIFARE_CIDENT: { case CMD_HF_MIFARE_CIDENT: {
struct p { struct p {
uint8_t is_mfc; uint8_t is_mfc;
uint8_t keytype; uint8_t keytype;
uint8_t key[6]; uint8_t key[6];

View file

@ -2695,7 +2695,7 @@ int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint
uint16_t UIDbit = (resp[i / 8] >> (i % 8)) & 0x01; uint16_t UIDbit = (resp[i / 8] >> (i % 8)) & 0x01;
uid_resp[uid_resp_bits / 8] |= UIDbit << (uid_resp_bits % 8); uid_resp[uid_resp_bits / 8] |= UIDbit << (uid_resp_bits % 8);
} }
uid_resp[uid_resp_bits / 8] |= 1 << (uid_resp_bits % 8); // next time select the card(s) with a 1 in the collision position uid_resp[uid_resp_bits / 8] |= 1 << (uid_resp_bits % 8); // next time select the card(s) with a 1 in the collision position
uid_resp_bits++; uid_resp_bits++;
// construct anticollision command: // construct anticollision command:
@ -3516,7 +3516,7 @@ void ReaderMifare(bool first_try, uint8_t block, uint8_t keytype) {
*/ */
void DetectNACKbug(void) { void DetectNACKbug(void) {
uint8_t mf_auth[4] = { MIFARE_AUTH_KEYA, 0x00, 0xF5, 0x7B }; uint8_t mf_auth[4] = { MIFARE_AUTH_KEYA, 0x00, 0xF5, 0x7B };
uint8_t mf_nr_ar[8]= { 0x00 }; uint8_t mf_nr_ar[8] = { 0x00 };
uint8_t uid[10] = { 0x00 }; uint8_t uid[10] = { 0x00 };
uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE] = { 0x00 }; uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE] = { 0x00 };
uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE] = { 0x00 }; uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE] = { 0x00 };

View file

@ -2477,7 +2477,7 @@ void MifareCIdent(bool is_mfc, uint8_t keytype, uint8_t *key) {
} }
// reset card // reset card
mf_reset_card(); mf_reset_card();
res = iso14443a_select_card(uid, NULL, &cuid, true, 0, false); res = iso14443a_select_card(uid, NULL, &cuid, true, 0, false);
if (res) { if (res) {
@ -2557,7 +2557,7 @@ void MifareCIdent(bool is_mfc, uint8_t keytype, uint8_t *key) {
struct Crypto1State mpcs = {0, 0}; struct Crypto1State mpcs = {0, 0};
struct Crypto1State *pcs; struct Crypto1State *pcs;
pcs = &mpcs; pcs = &mpcs;
// CUID (with default sector 0 B key) test // CUID (with default sector 0 B key) test
// regular cards will NAK the WRITEBLOCK(0) command, while DirectWrite will ACK it // regular cards will NAK the WRITEBLOCK(0) command, while DirectWrite will ACK it
// if we do get an ACK, we immediately abort to ensure nothing is ever actually written // if we do get an ACK, we immediately abort to ensure nothing is ever actually written

View file

@ -870,7 +870,7 @@ int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveG
if (distance == -1) { if (distance == -1) {
distance = peaks[i]; distance = peaks[i];
continue; continue;
} }
if (peaks[i] < distance) { if (peaks[i] < distance) {
distance = peaks[i]; distance = peaks[i];
@ -3416,7 +3416,7 @@ static int CmdNumCon(const char *Cmd) {
continue; continue;
} }
switch(i) { switch (i) {
case 0: case 0:
// MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod(&N, &N, &base)); // MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod(&N, &N, &base));
break; break;

View file

@ -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) { static void emrtd_print_personalization_timestamp(uint8_t *data, size_t datalen) {
if (datalen < 7 ) { if (datalen < 7) {
return; return;
} }
@ -1294,13 +1294,13 @@ static void emrtd_print_personalization_timestamp(uint8_t *data, size_t datalen)
char final_date[20] = { 0x00 }; char final_date[20] = { 0x00 };
snprintf(final_date, sizeof(final_date), "%.4s-%.2s-%.2s %.2s:%.2s:%.2s" snprintf(final_date, sizeof(final_date), "%.4s-%.2s-%.2s %.2s:%.2s:%.2s"
, str_date , str_date
, str_date + 4 , str_date + 4
, str_date + 6 , str_date + 6
, str_date + 8 , str_date + 8
, str_date + 10 , str_date + 10
, str_date + 12 , str_date + 12
); );
PrintAndLogEx(SUCCESS, "Personalization at....: " _YELLOW_("%s"), final_date); 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 }; char final_date[20] = { 0x00 };
snprintf(final_date, sizeof(final_date), "%.4s-%.2s-%.2s %.2s:%.2s:%.2s" snprintf(final_date, sizeof(final_date), "%.4s-%.2s-%.2s %.2s:%.2s:%.2s"
, data , data
, data + 4 , data + 4
, data + 6 , data + 6
, data + 8 , data + 8
, data + 10 , data + 10
, data + 12 , data + 12
); );
PrintAndLogEx(SUCCESS, "Unknown timestamp 5F85: " _YELLOW_("%s"), final_date); 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."); PrintAndLogEx(HINT, "This is very likely the personalization timestamp, but it is using an undocumented tag.");

View file

@ -8965,7 +8965,7 @@ static int CmdHF14AMfInfo(const char *Cmd) {
if ( if (
(blockdata[8] == 0x03 && blockdata[15] == 0x90) || (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) (memcmp(blockdata + 8, "\x62\x63\x64\x65\x66\x67\x68\x69", 8) == 0)
) { ) {
PrintAndLogEx(SUCCESS, " Fudan tag detected"); PrintAndLogEx(SUCCESS, " Fudan tag detected");

View file

@ -1682,46 +1682,46 @@ static int CmdHFMFPDump(const char *Cmd) {
PrintAndLogEx(INFO, " To be implemented, feel free to contribute!"); PrintAndLogEx(INFO, " To be implemented, feel free to contribute!");
return PM3_ENOTIMPL; return PM3_ENOTIMPL;
/* /*
mfpSetVerboseMode(verbose); mfpSetVerboseMode(verbose);
// read card // read card
uint8_t *mem = calloc(MIFARE_4K_MAXBLOCK * MFBLOCK_SIZE, sizeof(uint8_t)); uint8_t *mem = calloc(MIFARE_4K_MAXBLOCK * MFBLOCK_SIZE, sizeof(uint8_t));
if (mem == NULL) { if (mem == NULL) {
PrintAndLogEx(ERR, "failed to allocate memory"); PrintAndLogEx(ERR, "failed to allocate memory");
return PM3_EMALLOC; return PM3_EMALLOC;
} }
// iso14a_card_select_t card ; // iso14a_card_select_t card ;
// int res = mfp_read_tag(&card, mem, key_fn); // int res = mfp_read_tag(&card, mem, key_fn);
// if (res != PM3_SUCCESS) { // if (res != PM3_SUCCESS) {
// free(mem); // free(mem);
// return res; // return res;
// } // }
// Skip saving card data to file // Skip saving card data to file
if (nosave) { if (nosave) {
PrintAndLogEx(INFO, "Called with no save option"); 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); free(mem);
return PM3_SUCCESS; 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;
*/
} }

View file

@ -1916,13 +1916,13 @@ int CmdLFfind(const char *Cmd) {
PrintAndLogEx(INFO, _CYAN_("Checking for unknown tags...") "\n"); PrintAndLogEx(INFO, _CYAN_("Checking for unknown tags...") "\n");
uint8_t ones[] = { 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 // FSK
PrintAndLogEx(INFO, "FSK clock.......... " NOLF); PrintAndLogEx(INFO, "FSK clock.......... " NOLF);
@ -1971,7 +1971,7 @@ int CmdLFfind(const char *Cmd) {
check_autocorrelate("NRZ", clock); check_autocorrelate("NRZ", clock);
found++; found++;
} else { } else {
PrintAndLogEx(INFO, "NRZ ............... " _RED_("false positive")); PrintAndLogEx(INFO, "NRZ ............... " _RED_("false positive"));
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
} }
} else { } else {

View file

@ -168,8 +168,8 @@ static int usart_bt_testcomm(uint32_t baudrate, uint8_t parity) {
if (ret == PM3_SUCCESS) { if (ret == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data); PrintAndLogEx(SUCCESS, "RX (%3zu):%.*s", len, (int)len, data);
if (str_startswith((char *)data, "hc01.comV2.0") || if (str_startswith((char *)data, "hc01.comV2.0") ||
str_startswith((char *)data, "www.hc01.com") || str_startswith((char *)data, "www.hc01.com") ||
str_startswith((char *)data, "BT SPP V4.0")) { str_startswith((char *)data, "BT SPP V4.0")) {
PrintAndLogEx(SUCCESS, "Add-on " _GREEN_("found!")); PrintAndLogEx(SUCCESS, "Add-on " _GREEN_("found!"));
@ -310,7 +310,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
memset(data, 0, sizeof(data)); memset(data, 0, sizeof(data));
len = 0; len = 0;
if (isBluetoothExtensionHC04 == true) { if (isBluetoothExtensionHC04 == true) {
string = "AT+PIN=1234"; string = "AT+PIN=1234";
} else { } else {
@ -378,7 +378,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
} else { } else {
memset(data, 0, sizeof(data)); memset(data, 0, sizeof(data));
len=0; len = 0;
string = "AT+BAUD=115200,N"; string = "AT+BAUD=115200,N";
PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string); PrintAndLogEx(SUCCESS, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);

View file

@ -362,7 +362,7 @@ void *uart_reconnect(void *targ) {
} }
if (g_session.pm3_present && (TestProxmark(g_session.current_device) != PM3_SUCCESS)) { if (g_session.pm3_present && (TestProxmark(g_session.current_device) != PM3_SUCCESS)) {
CloseProxmark(g_session.current_device); CloseProxmark(g_session.current_device);
} else { } else {
break; 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); pthread_create(&communication_thread, NULL, &uart_communication, &g_conn);
__atomic_clear(&comm_thread_dead, __ATOMIC_SEQ_CST); __atomic_clear(&comm_thread_dead, __ATOMIC_SEQ_CST);
__atomic_clear(&reconnect_ok, __ATOMIC_SEQ_CST); __atomic_clear(&reconnect_ok, __ATOMIC_SEQ_CST);
g_session.pm3_present = true; // TODO support for multiple devices g_session.pm3_present = true; // TODO support for multiple devices
fflush(stdout); fflush(stdout);

View file

@ -190,7 +190,7 @@ static int check_comm(void) {
CloseProxmark(g_session.current_device); CloseProxmark(g_session.current_device);
StartReconnectProxmark(); StartReconnectProxmark();
c_update_reconnect_prompt = true; c_update_reconnect_prompt = true;
} }
// its alive again // its alive again
if (c_update_reconnect_prompt && IsReconnectedOk() && g_session.pm3_present) { if (c_update_reconnect_prompt && IsReconnectedOk() && g_session.pm3_present) {

View file

@ -131,4 +131,4 @@ int uart_parse_address_port(char *addrPortStr, const char **addrStr, const char
} }
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -108,8 +108,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed, bool slient) {
bool isUDP = false; bool isUDP = false;
bool isBluetooth = false; bool isBluetooth = false;
bool isUnixSocket = false; bool isUnixSocket = false;
if (strlen(prefix) > 4) if (strlen(prefix) > 4) {
{
isTCP = (memcmp(prefix, "tcp:", 4) == 0); isTCP = (memcmp(prefix, "tcp:", 4) == 0);
isUDP = (memcmp(prefix, "udp:", 4) == 0); isUDP = (memcmp(prefix, "udp:", 4) == 0);
} }

View file

@ -4709,7 +4709,7 @@
}, },
"hf mf info": { "hf mf info": {
"command": "hf mf info", "command": "hf mf info",
"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", "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 command line",
"notes": [ "notes": [
"hf mf info", "hf mf info",
"hf mf info -k FFFFFFFFFFFF -n -v" "hf mf info -k FFFFFFFFFFFF -n -v"
@ -7257,7 +7257,7 @@
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-1 Use data from Graphbuffer", "-1 Use data from Graphbuffer (offline mode)",
"-v, --verbose Verbose scan and output", "-v, --verbose Verbose scan and output",
"-@ optional - continuous reader mode" "-@ optional - continuous reader mode"
], ],
@ -10105,16 +10105,16 @@
"description": "Read and search for valid known tag. For offline mode, you can `data load` first then search.", "description": "Read and search for valid known tag. For offline mode, you can `data load` first then search.",
"notes": [ "notes": [
"lf search -> try reading data from tag & search for known tag", "lf search -> try reading data from tag & search for known tag",
"lf search -1 -> use data from the GraphBuffer & search for known tag",
"lf search -u -> try reading data from tag & search for known and unknown tag", "lf search -u -> try reading data from tag & search for known and unknown tag",
"lf search -1u -> use data from the GraphBuffer & search for known and unknown tag" "lf search -1 -> use data from the GraphBuffer & search for known tag",
"lf search -1uc -> use data from the GraphBuffer & search for known and unknown tag"
], ],
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-1 Use data from Graphbuffer to search", "-1 Use data from Graphbuffer to search (offline mode)",
"-c Continue searching even after a first hit", "-c Continue searching after successful match",
"-u Search for unknown tags. If not set, reads only known tags" "-u Search for unknown tags"
], ],
"usage": "lf search [-h1cu]" "usage": "lf search [-h1cu]"
}, },
@ -12160,6 +12160,6 @@
"metadata": { "metadata": {
"commands_extracted": 703, "commands_extracted": 703,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2023-12-18T09:05:00" "extracted_on": "2024-01-01T20:49:58"
} }
} }