From ec6f468f364a02dd146be682f8c96071f203293f Mon Sep 17 00:00:00 2001 From: Niel Nielsen Date: Wed, 26 Aug 2026 12:54:56 +0200 Subject: [PATCH] Add files via upload Signed-off-by: Niel Nielsen --- client/src/comms.h | 18 ++++++------------ client/src/proxmark3.c | 6 +++++- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/client/src/comms.h b/client/src/comms.h index 67ed3fcbb..b127010cf 100644 --- a/client/src/comms.h +++ b/client/src/comms.h @@ -20,9 +20,9 @@ #define COMMS_H_ #include "common.h" -#include "pm3_cmd.h" // Packet structs -#include "util.h" // FILE_PATH_SIZE -#include "iso7816/iso7816core.h" // SetISODEPState +#include "pm3_cmd.h" +#include "util.h" +#include "iso7816/iso7816core.h" #ifdef __cplusplus extern "C" { @@ -40,7 +40,6 @@ extern "C" { } #endif -//For storing command that are received from the device #ifndef CMD_BUFFER_SIZE #define CMD_BUFFER_SIZE 100 #endif @@ -67,20 +66,16 @@ typedef enum { } CommunicationProtocol_t; typedef struct { - bool run; // If TRUE, continue running the uart_communication thread - bool block_after_ACK; // if true, block after receiving an ACK package - // Flags to tell where to add CRC on sent replies + bool run; + bool block_after_ACK; bool send_with_crc_on_usb; bool send_with_crc_on_fpc; - // "Session" flag, to tell via which interface next msgs are sent: USB or FPC USART bool send_via_fpc_usart; - // to tell if we are using TCP/UDP/TCP(IPv6)/UDP(IPv6) CommunicationProtocol_t send_via_ip; - // to tell if the target address is local address(127.0.0.1/localhost/::1) bool send_via_local_ip; - // To memorise baudrate uint32_t uart_speed; uint16_t last_command; + bool listen_for_incoming; char serial_port_name[FILE_PATH_SIZE]; } communication_arg_t; @@ -122,7 +117,6 @@ bool WaitForResponse(uint32_t cmd, PacketResponseNG *response); int SetHfFieldTimeout(uint32_t timeout_sec, bool quiet); -//bool GetFromDevice(DeviceMemType_t memtype, uint8_t *dest, uint32_t bytes, uint32_t start_index, PacketResponseNG *response, size_t ms_timeout, bool show_warning); bool GetFromDevice(DeviceMemType_t memtype, uint8_t *dest, uint32_t bytes, uint32_t start_index, uint8_t *data, uint32_t datalen, PacketResponseNG *response, size_t ms_timeout, bool show_warning); #ifdef __cplusplus diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index 395f49db0..bbc65ed4e 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -829,7 +829,8 @@ static void show_help(bool showFullHelp, char *exec_name) { PrintAndLogEx(NORMAL, " -h/--help this help"); PrintAndLogEx(NORMAL, " -v/--version print client version"); PrintAndLogEx(NORMAL, " -p/--port serial port to connect to"); - PrintAndLogEx(NORMAL, " -w/--wait 20sec waiting the serial port to appear in the OS"); + PrintAndLogEx(NORMAL, " -w/--wait 20sec waiting the serial port to appear in the OS\n" + " with a tcp: port, listen and wait for an incoming connection instead"); PrintAndLogEx(NORMAL, " -f/--flush output will be flushed after every print"); PrintAndLogEx(NORMAL, " -d/--debug <0|1|2> set debugmode"); PrintAndLogEx(NORMAL, "\nOptions in client mode:"); @@ -1530,6 +1531,9 @@ int main(int argc, char *argv[]) { // try to open USB connection to Proxmark if (port != NULL) { + // --wait on a tcp: port means "listen and accept an incoming connection" + // rather than the usual "retry connecting until the endpoint appears". + g_conn.listen_for_incoming = waitCOMPort && (strncmp(port, "tcp:", 4) == 0); OpenProxmark(&g_session.current_device, port, waitCOMPort, 20, false, speed); }