mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-02 21:54:10 +08:00
add: proxmark3 -v/--version - for easiness to detect version in offline mode and installs
This commit is contained in:
parent
fdcc885aa9
commit
4e627f09c0
3 changed files with 27 additions and 5 deletions
|
@ -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"));
|
||||
|
|
|
@ -15,6 +15,6 @@
|
|||
|
||||
int CmdHW(const char *Cmd);
|
||||
|
||||
void pm3_version(bool verbose);
|
||||
void pm3_version(bool verbose, bool oneliner);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 <lua script file> execute lua script.");
|
||||
PrintAndLogEx(NORMAL, " -s/--script-file <cmd_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) {
|
||||
|
|
Loading…
Reference in a new issue