From dfc7104799e9c32b6ee1e42a32ffc1adb7394499 Mon Sep 17 00:00:00 2001 From: Grayson Martin Date: Tue, 11 Jul 2023 15:26:50 -0500 Subject: [PATCH] add additional info to smart relay cmd help text --- client/src/cmdsmartcard.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/cmdsmartcard.c b/client/src/cmdsmartcard.c index d3c843f48..f1cdaff6a 100644 --- a/client/src/cmdsmartcard.c +++ b/client/src/cmdsmartcard.c @@ -1193,8 +1193,8 @@ static void atsToEmulatedAtr(uint8_t *ats, uint8_t *atr, int *atrLen) { static int CmdRelay(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "smart relay", - "Turn pm3 into pcsc reader and relay to host OS via vpcd", - "smart relay" + "Make pm3 available to host OS smartcard driver via vpcd to enable use with other software such as GlobalPlatform Pro", + "Requires the virtual smartcard daemon to be installed and running, see https://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html" ); void *argtable[] = { @@ -1242,7 +1242,7 @@ static int CmdRelay(const char *Cmd) { } if (bytesRead > 0) { - if (cmdbuf[2] == 0x04) { // vpcd GET ATR + if (cmdbuf[1] == 0x01 && cmdbuf[2] == 0x04) { // vpcd GET ATR uint8_t atr[20] = {0}; int atrLen = 0; atsToEmulatedAtr(selectedCard.ats, atr, &atrLen); @@ -1281,7 +1281,10 @@ static int CmdRelay(const char *Cmd) { } else { if (SelectCard14443A_4(false, false, &selectedCard) == PM3_SUCCESS) { if (mbedtls_net_connect(&netCtx, (char *) host, (char *) port, MBEDTLS_NET_PROTO_TCP)) { - PrintAndLogEx(FAILED, "Failed to connect to vpcd socket"); + PrintAndLogEx(FAILED, "Failed to connect to vpcd socket. Ensure you have vpcd installed and running"); + mbedtls_net_close(&netCtx); + mbedtls_net_free(&netCtx); + DropField(); return PM3_EINVARG; }