Whonix: detect version

This commit is contained in:
tobtoht 2021-01-21 02:38:21 +01:00
parent 58c9c1a006
commit 71fb639c16
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
5 changed files with 13 additions and 1 deletions

View file

@ -6,7 +6,6 @@
#include "appcontext.h" #include "appcontext.h"
#include "globals.h" #include "globals.h"
#include "utils/whonix.h"
// libwalletqt // libwalletqt
#include "libwalletqt/TransactionHistory.h" #include "libwalletqt/TransactionHistory.h"

View file

@ -10,6 +10,7 @@
#include <QTimer> #include <QTimer>
#include "utils/tails.h" #include "utils/tails.h"
#include "utils/whonix.h"
#include "utils/prices.h" #include "utils/prices.h"
#include "utils/networking.h" #include "utils/networking.h"
#include "utils/tor.h" #include "utils/tor.h"

View file

@ -64,6 +64,9 @@ void DebugInfoDialog::updateInfo() {
if (m_ctx->isTails) { if (m_ctx->isTails) {
os = QString("Tails %1").arg(TailsOS::version()); os = QString("Tails %1").arg(TailsOS::version());
} }
if (m_ctx->isWhonix) {
os = QString("Whonix %1").arg(WhonixOS::version());
}
ui->label_OS->setText(os); ui->label_OS->setText(os);
ui->label_timestamp->setText(QString::number(QDateTime::currentSecsSinceEpoch())); ui->label_timestamp->setText(QString::number(QDateTime::currentSecsSinceEpoch()));
} }

View file

@ -8,3 +8,10 @@
bool WhonixOS::detect() { bool WhonixOS::detect() {
return !QString::fromLocal8Bit(qgetenv("WHONIX")).isEmpty(); return !QString::fromLocal8Bit(qgetenv("WHONIX")).isEmpty();
} }
QString WhonixOS::version() {
if (!Utils::fileExists("/etc/whonix_version"))
return "";
return Utils::barrayToString(Utils::fileOpen("/etc/whonix_version")).trimmed();
}

View file

@ -4,9 +4,11 @@
#ifndef FEATHER_WHONIX_H #ifndef FEATHER_WHONIX_H
#define FEATHER_WHONIX_H #define FEATHER_WHONIX_H
#include <QString>
struct WhonixOS { struct WhonixOS {
static bool detect(); static bool detect();
static QString version();
}; };