From c1a5f93dabde58898d9c4e09776f7506ada43f40 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 8 Aug 2020 23:45:09 +0200 Subject: [PATCH] send arguments to standalone mode --- armsrc/Standalone/hf_iceclass.c | 8 +++++- armsrc/appmain.c | 2 ++ client/src/cmdhw.c | 47 +++++++++++++++++---------------- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/armsrc/Standalone/hf_iceclass.c b/armsrc/Standalone/hf_iceclass.c index 82d4c93d9..d83b86a44 100644 --- a/armsrc/Standalone/hf_iceclass.c +++ b/armsrc/Standalone/hf_iceclass.c @@ -425,13 +425,19 @@ void ModInfo(void) { void RunMod(void) { + uint8_t mode = ICE_USE; + uint8_t *bb = BigBuf_get_EM_addr(); + if (bb[0] > 0 && bb[0] < 5) { + mode = bb[0]; + } + FpgaDownloadAndGo(FPGA_BITSTREAM_HF); BigBuf_Clear(); StandAloneMode(); Dbprintf(_YELLOW_("HF iCLASS mode a.k.a iceCLASS started")); - uint8_t mode = ICE_USE; + for (;;) { diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 034c59bd8..7c0edee5f 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -2064,6 +2064,8 @@ static void PacketReceived(PacketCommandNG *packet) { break; } case CMD_STANDALONE: { + uint8_t *bb = BigBuf_get_EM_addr(); + bb[0] = packet->data.asBytes[0]; RunMod(); break; } diff --git a/client/src/cmdhw.c b/client/src/cmdhw.c index f19eff1a7..6b83bd0cc 100644 --- a/client/src/cmdhw.c +++ b/client/src/cmdhw.c @@ -36,7 +36,7 @@ static int usage_dbg(void) { PrintAndLogEx(NORMAL, " 4 - print even debug messages in timing critical functions"); PrintAndLogEx(NORMAL, " Note: this option therefore may cause malfunction itself"); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " hw dbg 3"); + PrintAndLogEx(NORMAL, _YELLOW_(" hw dbg 3")); return 0; } @@ -50,7 +50,7 @@ static int usage_hw_detectreader(void) { PrintAndLogEx(NORMAL, " L = 125/134 kHz, H = 13.56 MHz"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " hw detectreader L"); + PrintAndLogEx(NORMAL, _YELLOW_(" hw detectreader L")); return PM3_SUCCESS; } @@ -63,7 +63,7 @@ static int usage_hw_setmux(void) { PrintAndLogEx(NORMAL, " Low peak, Low raw, Hi peak, Hi raw"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " hw setmux lopkd"); + PrintAndLogEx(NORMAL, _YELLOW_(" hw setmux lopkd")); return PM3_SUCCESS; } @@ -78,8 +78,8 @@ static int usage_hw_connect(void) { PrintAndLogEx(NORMAL, " b Baudrate"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " hw connect p "SERIAL_PORT_EXAMPLE_H); - PrintAndLogEx(NORMAL, " hw connect p "SERIAL_PORT_EXAMPLE_H" b 115200"); + PrintAndLogEx(NORMAL, _YELLOW_(" hw connect p "SERIAL_PORT_EXAMPLE_H)); + PrintAndLogEx(NORMAL, _YELLOW_(" hw connect p "SERIAL_PORT_EXAMPLE_H" b 115200")); return PM3_SUCCESS; } @@ -486,9 +486,10 @@ static int CmdSetMux(const char *Cmd) { } static int CmdStandalone(const char *Cmd) { - (void)Cmd; // Cmd is not used so far +// (void)Cmd; // Cmd is not used so far + uint8_t arg = param_get8ex(Cmd, 0, 0, 10); clearCommandBuffer(); - SendCommandNG(CMD_STANDALONE, NULL, 0); + SendCommandNG(CMD_STANDALONE, (uint8_t *)&arg, sizeof(arg)); return PM3_SUCCESS; } @@ -606,23 +607,23 @@ static int CmdConnect(const char *Cmd) { } static command_t CommandTable[] = { - {"help", CmdHelp, AlwaysAvailable, "This help"}, - {"connect", CmdConnect, AlwaysAvailable, "connect Proxmark3 to serial port"}, - {"dbg", CmdDbg, IfPm3Present, "Set Proxmark3 debug level"}, + {"help", CmdHelp, AlwaysAvailable, "This help"}, + {"connect", CmdConnect, AlwaysAvailable, "connect Proxmark3 to serial port"}, + {"dbg", CmdDbg, IfPm3Present, "Set Proxmark3 debug level"}, {"detectreader", CmdDetectReader, IfPm3Present, "['l'|'h'] -- Detect external reader field (option 'l' or 'h' to limit to LF or HF)"}, - {"fpgaoff", CmdFPGAOff, IfPm3Present, "Set FPGA off"}, - {"lcd", CmdLCD, IfPm3Lcd, " -- Send command/data to LCD"}, - {"lcdreset", CmdLCDReset, IfPm3Lcd, "Hardware reset LCD"}, - {"ping", CmdPing, IfPm3Present, "Test if the Proxmark3 is responsive"}, - {"readmem", CmdReadmem, IfPm3Present, "[address] -- Read memory at decimal address from flash"}, - {"reset", CmdReset, IfPm3Present, "Reset the Proxmark3"}, - {"setlfdivisor", CmdSetDivisor, IfPm3Present, "<19 - 255> -- Drive LF antenna at 12MHz/(divisor+1)"}, - {"setmux", CmdSetMux, IfPm3Present, "Set the ADC mux to a specific value"}, - {"standalone", CmdStandalone, IfPm3Present, "Jump to the standalone mode"}, - {"status", CmdStatus, IfPm3Present, "Show runtime status information about the connected Proxmark3"}, - {"tia", CmdTia, IfPm3Present, "Trigger a Timing Interval Acquisition to re-adjust the RealTimeCounter divider"}, - {"tune", CmdTune, IfPm3Present, "Measure antenna tuning"}, - {"version", CmdVersion, IfPm3Present, "Show version information about the connected Proxmark3"}, + {"fpgaoff", CmdFPGAOff, IfPm3Present, "Set FPGA off"}, + {"lcd", CmdLCD, IfPm3Lcd, " -- Send command/data to LCD"}, + {"lcdreset", CmdLCDReset, IfPm3Lcd, "Hardware reset LCD"}, + {"ping", CmdPing, IfPm3Present, "Test if the Proxmark3 is responsive"}, + {"readmem", CmdReadmem, IfPm3Present, "[address] -- Read memory at decimal address from flash"}, + {"reset", CmdReset, IfPm3Present, "Reset the Proxmark3"}, + {"setlfdivisor", CmdSetDivisor, IfPm3Present, "<19 - 255> -- Drive LF antenna at 12MHz/(divisor+1)"}, + {"setmux", CmdSetMux, IfPm3Present, "Set the ADC mux to a specific value"}, + {"standalone", CmdStandalone, IfPm3Present, "Jump to the standalone mode"}, + {"status", CmdStatus, IfPm3Present, "Show runtime status information about the connected Proxmark3"}, + {"tia", CmdTia, IfPm3Present, "Trigger a Timing Interval Acquisition to re-adjust the RealTimeCounter divider"}, + {"tune", CmdTune, IfPm3Present, "Measure antenna tuning"}, + {"version", CmdVersion, IfPm3Present, "Show version information about the connected Proxmark3"}, {NULL, NULL, NULL, NULL} };