Print client info also when offline

This commit is contained in:
Philippe Teuwen 2021-10-11 20:29:17 +02:00
parent 9bb66bf037
commit d240367c2a
2 changed files with 58 additions and 57 deletions

View file

@ -967,9 +967,10 @@ void pm3_version(bool verbose, bool oneliner) {
# define PM3HOSTARCH " ARCH:unknown"
#endif
char temp[PM3_CMD_DATA_SIZE - 12]; // same limit as for ARM image
if (oneliner) {
// For "proxmark3 -v", simple printf, avoid logging
char temp[PM3_CMD_DATA_SIZE - 12]; // same limit as for ARM image
FormatVersionInformation(temp, sizeof(temp), "Client: ", &g_version_information);
PrintAndLogEx(NORMAL, "%s compiled with " PM3CLIENTCOMPILER __VERSION__ PM3HOSTOS PM3HOSTARCH "\n", temp);
return;
@ -978,19 +979,20 @@ void pm3_version(bool verbose, bool oneliner) {
if (!verbose)
return;
PacketResponseNG resp;
clearCommandBuffer();
SendCommandNG(CMD_VERSION, NULL, 0);
if (WaitForResponseTimeout(CMD_VERSION, &resp, 1000)) {
char temp[PM3_CMD_DATA_SIZE - 12]; // same limit as for ARM image
PrintAndLogEx(NORMAL, "\n [ " _CYAN_("Proxmark3 RFID instrument") " ]");
PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("CLIENT") " ]");
FormatVersionInformation(temp, sizeof(temp), " client: ", &g_version_information);
PrintAndLogEx(NORMAL, "%s", temp);
PrintAndLogEx(NORMAL, " compiled with " PM3CLIENTCOMPILER __VERSION__ PM3HOSTOS PM3HOSTARCH);
if (g_session.pm3_present) {
PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("PROXMARK3") " ]");
PacketResponseNG resp;
clearCommandBuffer();
SendCommandNG(CMD_VERSION, NULL, 0);
if (WaitForResponseTimeout(CMD_VERSION, &resp, 1000)) {
if (IfPm3Rdv4Fw()) {
bool is_genuine_rdv4 = false;
@ -1036,5 +1038,6 @@ void pm3_version(bool verbose, bool oneliner) {
lookupChipID(payload->id, payload->section_size);
}
}
PrintAndLogEx(NORMAL, "");
}

View file

@ -250,13 +250,11 @@ main_loop(char *script_cmds_file, char *script_cmd, bool stayInCommandLoop) {
bool stdinOnPipe = !isatty(STDIN_FILENO);
char script_cmd_buf[256] = {0x00}; // iceman, needs lua script the same file_path_buffer as the rest
if (g_session.pm3_present) {
// cache Version information now:
if (execCommand || script_cmds_file || stdinOnPipe)
pm3_version(false, false);
else
pm3_version(true, false);
}
if (script_cmds_file) {