diff --git a/client/cmdhw.c b/client/cmdhw.c index 7fec7a40c..b6cb2bd87 100644 --- a/client/cmdhw.c +++ b/client/cmdhw.c @@ -493,7 +493,7 @@ static int CmdTune(const char *Cmd) { static int CmdVersion(const char *Cmd) { (void)Cmd; // Cmd is not used so far - pm3_version(true); + pm3_version(true, false); return PM3_SUCCESS; } @@ -617,7 +617,21 @@ int CmdHW(const char *Cmd) { return CmdsParse(CommandTable, Cmd); } -void pm3_version(bool verbose) { +void pm3_version(bool verbose, bool oneliner) { + + if (oneliner) { + char msg[70]; + memset(msg, 0x00, sizeof(msg)); + strcat(msg, "Client: RRG/Iceman compiled with "); +#if defined(__clang__) + strcat(msg + strlen(msg), _YELLOW_("Clang/LLVM "__VERSION__)); +#elif defined(__GNUC__) || defined(__GNUG__) + strcat(msg + strlen(msg), _YELLOW_("GCC "__VERSION__)); +#endif + PrintAndLogEx(NORMAL, "%s", msg); + return; + } + if (!verbose) return; @@ -635,6 +649,7 @@ void pm3_version(bool verbose) { #elif defined(__GNUC__) || defined(__GNUG__) PrintAndLogEx(NORMAL, " compiled with GCC "__VERSION__); #endif + PrintAndLogEx(NORMAL, "\n [ PROXMARK RDV4 ]"); PrintAndLogEx(NORMAL, " external flash: %s", IfPm3Flash() ? _GREEN_("present") : _YELLOW_("absent")); PrintAndLogEx(NORMAL, " smartcard reader: %s", IfPm3Smartcard() ? _GREEN_("present") : _YELLOW_("absent")); diff --git a/client/cmdhw.h b/client/cmdhw.h index 1a378e70f..bf40b70a8 100644 --- a/client/cmdhw.h +++ b/client/cmdhw.h @@ -15,6 +15,6 @@ int CmdHW(const char *Cmd); -void pm3_version(bool verbose); +void pm3_version(bool verbose, bool oneliner); #endif diff --git a/client/proxmark3.c b/client/proxmark3.c index de6fe43af..6555ac0f2 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -88,9 +88,9 @@ main_loop(char *script_cmds_file, char *script_cmd, bool stayInCommandLoop) { if (session.pm3_present) { // cache Version information now: if (execCommand || script_cmds_file || stdinOnPipe) - pm3_version(false); + pm3_version(false, false); else - pm3_version(true); + pm3_version(true, false); } if (script_cmds_file) { @@ -284,6 +284,7 @@ static void show_help(bool showFullHelp, char *exec_name) { PrintAndLogEx(NORMAL, " -l/--lua execute lua script."); PrintAndLogEx(NORMAL, " -s/--script-file script file with one Proxmark3 command per line"); PrintAndLogEx(NORMAL, " -i/--interactive enter interactive mode after executing the script or the command"); + PrintAndLogEx(NORMAL, " -v/--version print client version"); PrintAndLogEx(NORMAL, "\nsamples:"); PrintAndLogEx(NORMAL, " %s -h\n", exec_name); PrintAndLogEx(NORMAL, " %s -m\n", exec_name); @@ -378,6 +379,12 @@ int main(int argc, char *argv[]) { dumpAllHelp(1); return 0; } + // pritn client version + if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) { + pm3_version(true, true); + return 0; + } + // flush output if (strcmp(argv[i], "-f") == 0 || strcmp(argv[i], "--flush") == 0) {