This commit is contained in:
iceman1001 2023-10-18 20:34:35 +02:00
commit 1f3cf80898
16 changed files with 139 additions and 107 deletions

View file

@ -19,4 +19,4 @@
#include "iclass.h" #include "iclass.h"
#include "proxmark3_arm.h" #include "proxmark3_arm.h"
#include "cmd.h" #include "cmd.h"

View file

@ -18,4 +18,4 @@
#include "common.h" #include "common.h"
#endif #endif

View file

@ -57,9 +57,9 @@ static int sam_rxtx(const uint8_t *data, uint16_t n, uint8_t *resp, uint16_t *re
uint16_t more_len = 0; uint16_t more_len = 0;
if (resp[*resplen - 2] == 0x61 || resp[*resplen - 2] == 0x9F) { if (resp[*resplen - 2] == 0x61 || resp[*resplen - 2] == 0x9F) {
more_len = resp[*resplen - 1]; more_len = resp[*resplen - 1];
} else { } else {
// we done, return // we done, return
goto out; goto out;
} }
@ -113,7 +113,8 @@ int sam_picopass_get_pacs(void) {
clear_trace(); clear_trace();
I2C_Reset_EnterMainProgram(); StopTicks(); I2C_Reset_EnterMainProgram();
StopTicks();
uint8_t *resp = BigBuf_calloc(ISO7816_MAX_FRAME); uint8_t *resp = BigBuf_calloc(ISO7816_MAX_FRAME);
@ -212,7 +213,7 @@ int sam_picopass_get_pacs(void) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// SAM comms // SAM comms
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
size_t sam_len = 0; size_t sam_len = 0;
uint8_t *sam_apdu = BigBuf_calloc(ISO7816_MAX_FRAME); uint8_t *sam_apdu = BigBuf_calloc(ISO7816_MAX_FRAME);
@ -227,7 +228,7 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("-- 1",resp, resp_len); print_dbg("-- 1", resp, resp_len);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// second // second
@ -237,9 +238,9 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("-- 2",resp, resp_len); print_dbg("-- 2", resp, resp_len);
// TAG response // TAG response
// -- 0c 05 de64 // read block 5 // -- 0c 05 de64 // read block 5
// Tag|c00a140a000000a110a10e8004 0c05de64 8102 0004 820201f4 // Tag|c00a140a000000a110a10e8004 0c05de64 8102 0004 820201f4
@ -256,7 +257,7 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("-- 3",resp, resp_len); print_dbg("-- 3", resp, resp_len);
// 88 02 -- readcheck (block2 epurse, start of auth) // 88 02 -- readcheck (block2 epurse, start of auth)
// Tag|c00a140a000000a10ea10c8002 8802 8102 0004 820201f4 9000 // Tag|c00a140a000000a10ea10c8002 8802 8102 0004 820201f4 9000
@ -272,29 +273,29 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("-- 4",resp, resp_len); print_dbg("-- 4", resp, resp_len);
uint8_t nr_mac[9] = {0}; uint8_t nr_mac[9] = {0};
memcpy(nr_mac, resp + 11, sizeof(nr_mac)); memcpy(nr_mac, resp + 11, sizeof(nr_mac));
// resp here hold the whole NR/MAC // resp here hold the whole NR/MAC
// 05 9bcd475e965ee20e // CHECK (w key) // 05 9bcd475e965ee20e // CHECK (w key)
print_dbg("NR/MAC",nr_mac, sizeof(nr_mac)); print_dbg("NR/MAC", nr_mac, sizeof(nr_mac));
// c00a140a000000a115a1138009 059bcd475e965ee20e 8102 0004 820201f4 9000 // c00a140a000000a115a1138009 059bcd475e965ee20e 8102 0004 820201f4 9000
// pre calc ourself? // pre calc ourself?
// uint8_t cc_nr[] = {0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0}; // uint8_t cc_nr[] = {0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0};
uint8_t div_key[8] = {0}; uint8_t div_key[8] = {0};
static uint8_t legacy_aa1_key[] = {0xAE, 0xA6, 0x84, 0xA6, 0xDA, 0xB2, 0x32, 0x78}; static uint8_t legacy_aa1_key[] = {0xAE, 0xA6, 0x84, 0xA6, 0xDA, 0xB2, 0x32, 0x78};
iclass_calc_div_key(hdr.csn, legacy_aa1_key, div_key, false); iclass_calc_div_key(hdr.csn, legacy_aa1_key, div_key, false);
uint8_t mac[4] = {0}; uint8_t mac[4] = {0};
if (g_dbglevel == DBG_DEBUG) { if (g_dbglevel == DBG_DEBUG) {
uint8_t wb[16] = {0}; uint8_t wb[16] = {0};
memcpy(wb, hdr.epurse, sizeof(hdr.epurse)); memcpy(wb, hdr.epurse, sizeof(hdr.epurse));
memcpy(wb + sizeof(hdr.epurse), nr_mac+1, 4); memcpy(wb + sizeof(hdr.epurse), nr_mac + 1, 4);
print_dbg("cc_nr...", wb, sizeof(wb)); print_dbg("cc_nr...", wb, sizeof(wb));
doMAC_N(wb, sizeof(wb), div_key, mac); doMAC_N(wb, sizeof(wb), div_key, mac);
print_dbg("Calc MAC...", mac, sizeof(mac)); print_dbg("Calc MAC...", mac, sizeof(mac));
} }
@ -315,8 +316,8 @@ int sam_picopass_get_pacs(void) {
goto out; goto out;
} }
// store MAC // store MAC
memcpy(mac, resp, sizeof(mac)); memcpy(mac, resp, sizeof(mac));
print_dbg("Got MAC",mac,sizeof(mac)); print_dbg("Got MAC", mac, sizeof(mac));
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// fifth send received MAC // fifth send received MAC
@ -328,7 +329,7 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("-- 5",resp, resp_len); print_dbg("-- 5", resp, resp_len);
uint8_t tmp_p1[4] = {0}; uint8_t tmp_p1[4] = {0};
uint8_t tmp_p2[4] = {0}; uint8_t tmp_p2[4] = {0};
@ -350,7 +351,7 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("-- 6",resp, resp_len); print_dbg("-- 6", resp, resp_len);
// c1 61 c1 00 00 a1 10 a1 0e 80 04 0c 06 45 56 81 02 00 04 82 02 01 f4 90 00 // c1 61 c1 00 00 a1 10 a1 0e 80 04 0c 06 45 56 81 02 00 04 82 02 01 f4 90 00
// read block 6 // read block 6
@ -364,7 +365,7 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("Block 6 from Picopass",resp, resp_len); print_dbg("Block 6 from Picopass", resp, resp_len);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// eight send block 6 config to SAM // eight send block 6 config to SAM
@ -391,7 +392,7 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("Block 6-9 from Picopass",resp, resp_len); print_dbg("Block 6-9 from Picopass", resp, resp_len);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// nine send credential blocks to SAM // nine send credential blocks to SAM
@ -403,7 +404,7 @@ int sam_picopass_get_pacs(void) {
res = PM3_ECARDEXCHANGE; res = PM3_ECARDEXCHANGE;
goto out; goto out;
} }
print_dbg("-- 8",resp, resp_len); print_dbg("-- 8", resp, resp_len);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -438,7 +439,7 @@ out:
off: off:
switch_off(); switch_off();
BigBuf_free(); BigBuf_free();
return res; return res;
} }

View file

@ -20,4 +20,4 @@
int sam_picopass_get_pacs(void); int sam_picopass_get_pacs(void);
#endif #endif

View file

@ -19,4 +19,4 @@
#include "iclass.h" #include "iclass.h"
#include "proxmark3_arm.h" #include "proxmark3_arm.h"
#include "cmd.h" #include "cmd.h"

View file

@ -18,4 +18,4 @@
#include "common.h" #include "common.h"
#endif #endif

View file

@ -4472,17 +4472,17 @@ static int CmdHFiClassSAM(const char *Cmd) {
// CSN, config, epurse, NR/MAC, AIA // CSN, config, epurse, NR/MAC, AIA
// PACS // PACS
// first byte skip // first byte skip
// second byte length // second byte length
// third padded // third padded
// fourth .. // fourth ..
uint8_t *d = resp.data.asBytes; uint8_t *d = resp.data.asBytes;
uint8_t n = d[1] - 1; // skip length byte uint8_t n = d[1] - 1; // skip length byte
uint8_t pad = d[2]; uint8_t pad = d[2];
char *binstr = (char*)calloc((n * 8) + 1 , sizeof(uint8_t)); char *binstr = (char *)calloc((n * 8) + 1, sizeof(uint8_t));
if (binstr == NULL) { if (binstr == NULL) {
return PM3_EMALLOC; return PM3_EMALLOC;
} }
byte_2_binstr(binstr, d + 3, n); byte_2_binstr(binstr, d + 3, n);
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
@ -4494,7 +4494,7 @@ static int CmdHFiClassSAM(const char *Cmd) {
size_t hexlen = 0; size_t hexlen = 0;
uint8_t hex[16] = {0}; uint8_t hex[16] = {0};
binstr_2_bytes(hex, &hexlen,binstr); binstr_2_bytes(hex, &hexlen, binstr);
PrintAndLogEx(SUCCESS, "hex.......... " _GREEN_("%s"), sprint_hex_inrow(hex, hexlen)); PrintAndLogEx(SUCCESS, "hex.......... " _GREEN_("%s"), sprint_hex_inrow(hex, hexlen));
uint32_t top = 0, mid = 0, bot = 0; uint32_t top = 0, mid = 0, bot = 0;

View file

@ -42,8 +42,9 @@ const static vocabulary_t vocabulary[] = {
{ 1, "prefs help" }, { 1, "prefs help" },
{ 1, "prefs show" }, { 1, "prefs show" },
{ 1, "prefs get barmode" }, { 1, "prefs get barmode" },
{ 1, "prefs get clientdebug" }, { 1, "prefs get client.debug" },
{ 1, "prefs get clientdelay" }, { 1, "prefs get client.delay" },
{ 1, "prefs get client.timeout" },
{ 1, "prefs get color" }, { 1, "prefs get color" },
{ 1, "prefs get savepaths" }, { 1, "prefs get savepaths" },
{ 1, "prefs get emoji" }, { 1, "prefs get emoji" },
@ -52,8 +53,9 @@ const static vocabulary_t vocabulary[] = {
{ 1, "prefs get plotsliders" }, { 1, "prefs get plotsliders" },
{ 1, "prefs set help" }, { 1, "prefs set help" },
{ 1, "prefs set barmode" }, { 1, "prefs set barmode" },
{ 1, "prefs set clientdebug" }, { 1, "prefs set client.debug" },
{ 1, "prefs set clientdelay" }, { 1, "prefs set client.delay" },
{ 1, "prefs set client.timeout" },
{ 1, "prefs set color" }, { 1, "prefs set color" },
{ 1, "prefs set emoji" }, { 1, "prefs set emoji" },
{ 1, "prefs set hints" }, { 1, "prefs set hints" },

View file

@ -852,7 +852,7 @@ static int setClientTimeout(const char *Cmd) {
uint32_t new_value = (uint32_t)arg_get_int_def(ctx, 1, 0); uint32_t new_value = (uint32_t)arg_get_int_def(ctx, 1, 0);
CLIParserFree(ctx); CLIParserFree(ctx);
// UART_USB_CLIENT_RX_TIMEOUT_MS is considered as the minimum required timeout. // UART_USB_CLIENT_RX_TIMEOUT_MS is considered as the minimum required timeout.
if (new_value < UART_USB_CLIENT_RX_TIMEOUT_MS) { if (new_value < UART_USB_CLIENT_RX_TIMEOUT_MS) {
PrintAndLogEx(WARNING, "Timeout less than %u ms might cause errors.", UART_USB_CLIENT_RX_TIMEOUT_MS); PrintAndLogEx(WARNING, "Timeout less than %u ms might cause errors.", UART_USB_CLIENT_RX_TIMEOUT_MS);
} else if (new_value > 5000) { } else if (new_value > 5000) {
@ -1268,7 +1268,7 @@ static command_t CommandTableSet[] = {
{"client.debug", setCmdDebug, AlwaysAvailable, "Set client debug level"}, {"client.debug", setCmdDebug, AlwaysAvailable, "Set client debug level"},
{"client.delay", setCmdExeDelay, AlwaysAvailable, "Set client execution delay"}, {"client.delay", setCmdExeDelay, AlwaysAvailable, "Set client execution delay"},
{"client.timeout", setClientTimeout, AlwaysAvailable, "Set client communication timeout"}, {"client.timeout", setClientTimeout, AlwaysAvailable, "Set client communication timeout"},
{"color", setCmdColor, AlwaysAvailable, "Set color support"}, {"color", setCmdColor, AlwaysAvailable, "Set color support"},
{"emoji", setCmdEmoji, AlwaysAvailable, "Set emoji display"}, {"emoji", setCmdEmoji, AlwaysAvailable, "Set emoji display"},
{"hints", setCmdHint, AlwaysAvailable, "Set hint display"}, {"hints", setCmdHint, AlwaysAvailable, "Set hint display"},

View file

@ -1,13 +1,13 @@
#include "ringbuffer.h" #include "ringbuffer.h"
#include <stdlib.h> #include <stdlib.h>
RingBuffer* RingBuf_create(int capacity) { RingBuffer *RingBuf_create(int capacity) {
RingBuffer* buffer = (RingBuffer*)malloc(sizeof(RingBuffer)); RingBuffer *buffer = (RingBuffer *)malloc(sizeof(RingBuffer));
if (!buffer) { if (!buffer) {
return NULL; return NULL;
} }
buffer->data = (uint8_t*)calloc(capacity, sizeof(uint8_t)); buffer->data = (uint8_t *)calloc(capacity, sizeof(uint8_t));
if (!buffer->data) { if (!buffer->data) {
free(buffer); free(buffer);
return NULL; return NULL;
@ -21,15 +21,15 @@ RingBuffer* RingBuf_create(int capacity) {
return buffer; return buffer;
} }
inline bool RingBuf_isFull(RingBuffer* buffer) { inline bool RingBuf_isFull(RingBuffer *buffer) {
return buffer->size == buffer->capacity; return buffer->size == buffer->capacity;
} }
inline bool RingBuf_isEmpty(RingBuffer* buffer) { inline bool RingBuf_isEmpty(RingBuffer *buffer) {
return buffer->size == 0; return buffer->size == 0;
} }
bool RingBuf_enqueue(RingBuffer* buffer, uint8_t value) { bool RingBuf_enqueue(RingBuffer *buffer, uint8_t value) {
if (RingBuf_isFull(buffer)) { if (RingBuf_isFull(buffer)) {
return false; return false;
} }
@ -40,7 +40,7 @@ bool RingBuf_enqueue(RingBuffer* buffer, uint8_t value) {
return true; return true;
} }
bool RingBuf_dequeue(RingBuffer* buffer, uint8_t* value) { bool RingBuf_dequeue(RingBuffer *buffer, uint8_t *value) {
if (RingBuf_isEmpty(buffer)) { if (RingBuf_isEmpty(buffer)) {
return false; return false;
} }
@ -51,7 +51,7 @@ bool RingBuf_dequeue(RingBuffer* buffer, uint8_t* value) {
return true; return true;
} }
int RingBuf_enqueueBatch(RingBuffer* buffer, const uint8_t* values, int count) { int RingBuf_enqueueBatch(RingBuffer *buffer, const uint8_t *values, int count) {
int processed = 0; int processed = 0;
if (RingBuf_getAvailableSize(buffer) < count) { if (RingBuf_getAvailableSize(buffer) < count) {
@ -69,7 +69,7 @@ int RingBuf_enqueueBatch(RingBuffer* buffer, const uint8_t* values, int count) {
return processed; return processed;
} }
int RingBuf_dequeueBatch(RingBuffer* buffer, uint8_t* values, int count) { int RingBuf_dequeueBatch(RingBuffer *buffer, uint8_t *values, int count) {
int processed = 0; int processed = 0;
if (buffer->size < count) { if (buffer->size < count) {
@ -87,32 +87,32 @@ int RingBuf_dequeueBatch(RingBuffer* buffer, uint8_t* values, int count) {
return processed; return processed;
} }
inline int RingBuf_getUsedSize(RingBuffer* buffer) { inline int RingBuf_getUsedSize(RingBuffer *buffer) {
return buffer->size; return buffer->size;
} }
inline int RingBuf_getAvailableSize(RingBuffer* buffer) { inline int RingBuf_getAvailableSize(RingBuffer *buffer) {
return (buffer->capacity) - (buffer->size); return (buffer->capacity) - (buffer->size);
} }
void RingBuf_destroy(RingBuffer* buffer) { void RingBuf_destroy(RingBuffer *buffer) {
if (buffer != NULL) if (buffer != NULL)
free(buffer->data); free(buffer->data);
free(buffer); free(buffer);
} }
inline int RingBuf_getContinousAvailableSize(RingBuffer* buffer) { inline int RingBuf_getContinousAvailableSize(RingBuffer *buffer) {
const int availableSize = RingBuf_getAvailableSize(buffer); const int availableSize = RingBuf_getAvailableSize(buffer);
const int continousSize = (buffer->capacity) - (buffer->rear); const int continousSize = (buffer->capacity) - (buffer->rear);
return (availableSize < continousSize) ? availableSize : continousSize; return (availableSize < continousSize) ? availableSize : continousSize;
} }
inline void RingBuf_postEnqueueBatch(RingBuffer* buffer, int count) { inline void RingBuf_postEnqueueBatch(RingBuffer *buffer, int count) {
// no check there // no check there
buffer->rear = (buffer->rear + count) % buffer->capacity; buffer->rear = (buffer->rear + count) % buffer->capacity;
buffer->size += count; buffer->size += count;
} }
inline uint8_t* RingBuf_getRearPtr(RingBuffer* buffer) { inline uint8_t *RingBuf_getRearPtr(RingBuffer *buffer) {
return buffer->data + buffer->rear; return buffer->data + buffer->rear;
} }

View file

@ -5,27 +5,27 @@
#include <stdint.h> #include <stdint.h>
typedef struct { typedef struct {
uint8_t* data; uint8_t *data;
int capacity; int capacity;
int size; int size;
int front; int front;
int rear; int rear;
} RingBuffer; } RingBuffer;
RingBuffer* RingBuf_create(int capacity); RingBuffer *RingBuf_create(int capacity);
bool RingBuf_isFull(RingBuffer* buffer); bool RingBuf_isFull(RingBuffer *buffer);
bool RingBuf_isEmpty(RingBuffer* buffer); bool RingBuf_isEmpty(RingBuffer *buffer);
bool RingBuf_enqueue(RingBuffer* buffer, uint8_t value); bool RingBuf_enqueue(RingBuffer *buffer, uint8_t value);
bool RingBuf_dequeue(RingBuffer* buffer, uint8_t* value); bool RingBuf_dequeue(RingBuffer *buffer, uint8_t *value);
int RingBuf_enqueueBatch(RingBuffer* buffer, const uint8_t* values, int count); int RingBuf_enqueueBatch(RingBuffer *buffer, const uint8_t *values, int count);
int RingBuf_dequeueBatch(RingBuffer* buffer, uint8_t* values, int count); int RingBuf_dequeueBatch(RingBuffer *buffer, uint8_t *values, int count);
int RingBuf_getUsedSize(RingBuffer* buffer); int RingBuf_getUsedSize(RingBuffer *buffer);
int RingBuf_getAvailableSize(RingBuffer* buffer); int RingBuf_getAvailableSize(RingBuffer *buffer);
void RingBuf_destroy(RingBuffer* buffer); void RingBuf_destroy(RingBuffer *buffer);
// for direct write // for direct write
int RingBuf_getContinousAvailableSize(RingBuffer* buffer); int RingBuf_getContinousAvailableSize(RingBuffer *buffer);
void RingBuf_postEnqueueBatch(RingBuffer* buffer, int count); void RingBuf_postEnqueueBatch(RingBuffer *buffer, int count);
uint8_t* RingBuf_getRearPtr(RingBuffer* buffer); uint8_t *RingBuf_getRearPtr(RingBuffer *buffer);
#endif #endif

View file

@ -56,7 +56,7 @@ typedef struct {
int fd; // Serial port file descriptor int fd; // Serial port file descriptor
term_info tiOld; // Terminal info before using the port term_info tiOld; // Terminal info before using the port
term_info tiNew; // Terminal info during the transaction term_info tiNew; // Terminal info during the transaction
RingBuffer* udpBuffer; RingBuffer *udpBuffer;
} serial_port_unix_t_t; } serial_port_unix_t_t;
// see pm3_cmd.h // see pm3_cmd.h
@ -150,7 +150,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
portstr = rColon + 1; portstr = rColon + 1;
} else { } else {
portstr = "18888"; portstr = "18888";
} }
} }
// handle the end of the address // handle the end of the address
@ -261,7 +261,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
portstr = rColon + 1; portstr = rColon + 1;
} else { } else {
portstr = "18888"; portstr = "18888";
} }
} }
// handle the end of the address // handle the end of the address
@ -519,9 +519,9 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
*pszRxLen = 0; *pszRxLen = 0;
do { do {
int res; int res;
if(spu->udpBuffer != NULL) { if (spu->udpBuffer != NULL) {
// for UDP connection, try to use the data from the buffer // for UDP connection, try to use the data from the buffer
byteCount = RingBuf_getAvailableSize(spu->udpBuffer); byteCount = RingBuf_getAvailableSize(spu->udpBuffer);
// Cap the number of bytes, so we don't overrun the buffer // Cap the number of bytes, so we don't overrun the buffer
if (pszMaxRxLen - (*pszRxLen) < byteCount) { if (pszMaxRxLen - (*pszRxLen) < byteCount) {
@ -536,7 +536,7 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
return PM3_SUCCESS; return PM3_SUCCESS;
} }
} }
// Reset file descriptor // Reset file descriptor
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(spu->fd, &rfds); FD_SET(spu->fd, &rfds);

View file

@ -38,7 +38,7 @@ typedef struct {
DCB dcb; // Device control settings DCB dcb; // Device control settings
COMMTIMEOUTS ct; // Serial port time-out configuration COMMTIMEOUTS ct; // Serial port time-out configuration
SOCKET hSocket; // Socket handle SOCKET hSocket; // Socket handle
RingBuffer* udpBuffer; // Buffer for UDP RingBuffer *udpBuffer; // Buffer for UDP
} serial_port_windows_t; } serial_port_windows_t;
// this is for TCP connection // this is for TCP connection
@ -473,7 +473,7 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
*pszRxLen = 0; *pszRxLen = 0;
do { do {
int res; int res;
if(spw->udpBuffer != NULL) { if (spw->udpBuffer != NULL) {
// for UDP connection, try to use the data from the buffer // for UDP connection, try to use the data from the buffer
byteCount = RingBuf_getAvailableSize(spw->udpBuffer); byteCount = RingBuf_getAvailableSize(spw->udpBuffer);

View file

@ -74,15 +74,15 @@ bool IsHIDSamPresent(bool verbose) {
// SAM identification // SAM identification
smart_card_atr_t supported[] = { smart_card_atr_t supported[] = {
{15, {0x3B, 0x95, 0x96, 0x80, 0xB1, 0xFE, 0x55, 0x1F, 0xC7, 0x47, 0x72, 0x61, 0x63, 0x65, 0x13}}, {15, {0x3B, 0x95, 0x96, 0x80, 0xB1, 0xFE, 0x55, 0x1F, 0xC7, 0x47, 0x72, 0x61, 0x63, 0x65, 0x13}},
{11, {0x3b, 0x90, 0x96, 0x91, 0x81, 0xb1, 0xfe, 0x55, 0x1f, 0xc7, 0xd4}}, {11, {0x3b, 0x90, 0x96, 0x91, 0x81, 0xb1, 0xfe, 0x55, 0x1f, 0xc7, 0xd4}},
}; };
bool found = false; bool found = false;
for (int i = 0; i < sizeof(supported) / sizeof(supported[0]); i++) { for (int i = 0; i < sizeof(supported) / sizeof(supported[0]); i++) {
if ((card.atr_len == supported[i].atr_len) && if ((card.atr_len == supported[i].atr_len) &&
(memcmp(card.atr, supported[i].atr, supported[i].atr_len) == 0)) { (memcmp(card.atr, supported[i].atr, supported[i].atr_len) == 0)) {
found = true; found = true;
break; break;
} }
} }
if (found == false) { if (found == false) {

View file

@ -7580,15 +7580,15 @@
"description": "Set the communication timeout on the client side", "description": "Set the communication timeout on the client side",
"notes": [ "notes": [
"hw timeout -> Show current timeout", "hw timeout -> Show current timeout",
"hw timeout -t 20 -> Set the timeout to 20ms", "hw timeout -m 20 -> Set the timeout to 20ms",
"hw timeout -t 500 -> Set the timeout to 500ms" "hw timeout --ms 500 -> Set the timeout to 500ms"
], ],
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-t, --timeout <dec> timeout in ms" "-m, --ms <ms> timeout in micro seconds"
], ],
"usage": "hw timeout [-h] [-t <dec>]" "usage": "hw timeout [-h] [-m <ms>]"
}, },
"hw tune": { "hw tune": {
"command": "hw tune", "command": "hw tune",
@ -11220,29 +11220,41 @@
], ],
"usage": "prefs get barmode [-h]" "usage": "prefs get barmode [-h]"
}, },
"prefs get clientdebug": { "prefs get client.debug": {
"command": "prefs get clientdebug", "command": "prefs get client.debug",
"description": "Get preference of using clientside debug level", "description": "Get preference of using clientside debug level",
"notes": [ "notes": [
"prefs get clientdebug" "prefs get client.debug"
], ],
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help This help" "-h, --help This help"
], ],
"usage": "prefs get clientdebug [-h]" "usage": "prefs get client.debug [-h]"
}, },
"prefs get clientdelay": { "prefs get client.delay": {
"command": "prefs get clientdelay", "command": "prefs get client.delay",
"description": "Get preference of delay time before execution of a command in the client", "description": "Get preference of delay time before execution of a command in the client",
"notes": [ "notes": [
"prefs get clientdelay" "prefs get client.delay"
], ],
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help This help" "-h, --help This help"
], ],
"usage": "prefs get clientdelay [-h]" "usage": "prefs get client.delay [-h]"
},
"prefs get client.timeout": {
"command": "prefs get client.timeout",
"description": "Get preference of delay time before execution of a command in the client",
"notes": [
"prefs get client.timeout"
],
"offline": true,
"options": [
"-h, --help This help"
],
"usage": "prefs get client.timeout [-h]"
}, },
"prefs get color": { "prefs get color": {
"command": "prefs get color", "command": "prefs get color",
@ -11331,11 +11343,11 @@
], ],
"usage": "prefs set barmode [-h] [--bar] [--mix] [--val]" "usage": "prefs set barmode [-h] [--bar] [--mix] [--val]"
}, },
"prefs set clientdebug": { "prefs set client.debug": {
"command": "prefs set clientdebug", "command": "prefs set client.debug",
"description": "Set persistent preference of using clientside debug level", "description": "Set persistent preference of using clientside debug level",
"notes": [ "notes": [
"prefs set clientdebug --simple" "prefs set client.debug --simple"
], ],
"offline": true, "offline": true,
"options": [ "options": [
@ -11344,21 +11356,36 @@
"--simple simple debug messages", "--simple simple debug messages",
"--full full debug messages" "--full full debug messages"
], ],
"usage": "prefs set clientdebug [-h] [--off] [--simple] [--full]" "usage": "prefs set client.debug [-h] [--off] [--simple] [--full]"
}, },
"prefs set clientdelay": { "prefs set client.delay": {
"command": "prefs set clientdelay", "command": "prefs set client.delay",
"description": "Set persistent preference of delay before executing a command in the client", "description": "Set persistent preference of delay before executing a command in the client",
"notes": [ "notes": [
"prefs set clientdelay --ms 0 -> unsets any delay", "prefs set client.delay --ms 0 -> unsets any delay",
"prefs set clientdelay --ms 1000 -> sets 1000ms delay" "prefs set client.delay --ms 1000 -> sets 1000ms delay"
], ],
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"--ms <ms> delay in micro seconds" "--ms <ms> delay in micro seconds"
], ],
"usage": "prefs set clientdelay [-h] [--ms <ms>]" "usage": "prefs set client.delay [-h] [--ms <ms>]"
},
"prefs set client.timeout": {
"command": "prefs set client.timeout",
"description": "Set persistent preference of client communication timeout",
"notes": [
"prefs set client.timeout --ms 0 -> unsets any timeout",
"prefs set client.timeout -m 20 -> Set the timeout to 20ms",
"prefs set client.timeout --ms 500 -> Set the timeout to 500ms"
],
"offline": true,
"options": [
"-h, --help This help",
"-m, --ms <ms> timeout in micro seconds"
],
"usage": "prefs set client.timeout [-h] [-m <ms>]"
}, },
"prefs set color": { "prefs set color": {
"command": "prefs set color", "command": "prefs set color",
@ -11854,8 +11881,8 @@
} }
}, },
"metadata": { "metadata": {
"commands_extracted": 687, "commands_extracted": 689,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2023-10-15T15:14:39" "extracted_on": "2023-10-18T18:30:58"
} }
} }

View file

@ -37,8 +37,9 @@ Check column "offline" for their availability.
|command |offline |description |command |offline |description
|------- |------- |----------- |------- |------- |-----------
|`prefs get barmode `|Y |`Get bar mode preference` |`prefs get barmode `|Y |`Get bar mode preference`
|`prefs get clientdebug `|Y |`Get client debug level preference` |`prefs get client.debug `|Y |`Get client debug level preference`
|`prefs get clientdelay `|Y |`Get client execution delay preference` |`prefs get client.delay `|Y |`Get client execution delay preference`
|`prefs get client.timeout`|Y |`Get client execution delay preference`
|`prefs get color `|Y |`Get color support preference` |`prefs get color `|Y |`Get color support preference`
|`prefs get savepaths `|Y |`Get file folder ` |`prefs get savepaths `|Y |`Get file folder `
|`prefs get emoji `|Y |`Get emoji display preference` |`prefs get emoji `|Y |`Get emoji display preference`
@ -55,8 +56,9 @@ Check column "offline" for their availability.
|------- |------- |----------- |------- |------- |-----------
|`prefs set help `|Y |`This help` |`prefs set help `|Y |`This help`
|`prefs set barmode `|Y |`Set bar mode` |`prefs set barmode `|Y |`Set bar mode`
|`prefs set clientdebug `|Y |`Set client debug level` |`prefs set client.debug `|Y |`Set client debug level`
|`prefs set clientdelay `|Y |`Set client execution delay` |`prefs set client.delay `|Y |`Set client execution delay`
|`prefs set client.timeout`|Y |`Set client communication timeout`
|`prefs set color `|Y |`Set color support` |`prefs set color `|Y |`Set color support`
|`prefs set emoji `|Y |`Set emoji display` |`prefs set emoji `|Y |`Set emoji display`
|`prefs set hints `|Y |`Set hint display` |`prefs set hints `|Y |`Set hint display`