From a6b39c1d4f0ee0c9d6ffae14de20188d1dedb2ea Mon Sep 17 00:00:00 2001 From: David Skoland Date: Tue, 24 Jan 2017 14:30:18 +0100 Subject: added hdid implementation for linux and did more work on courtroom --- hardware_functions.cpp | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'hardware_functions.cpp') diff --git a/hardware_functions.cpp b/hardware_functions.cpp index ce6e35a6..e755c246 100644 --- a/hardware_functions.cpp +++ b/hardware_functions.cpp @@ -1,6 +1,10 @@ #include "hardware_functions.h" +#include + #if (defined (_WIN32) || defined (_WIN64)) +#include + DWORD dwVolSerial; BOOL bIsRetrieved; @@ -11,24 +15,44 @@ QString get_hdid() if (bIsRetrieved) return QString::number(dwVolSerial, 16); else - return "invalid_windows_hd"; //what could possibly go wrong + return "gxsps32sa9fnwic92mfbs0"; //what could possibly go wrong } #elif (defined (LINUX) || defined (__linux__)) +#include +#include + QString get_hdid() { - //T0D0: add linux implementation - return "linux_os_hdid"; + QFile fstab_file("/etc/fstab"); + if (!fstab_file.open(QIODevice::ReadOnly)) + //literally a random string.... what else are we supposed to do? + return "gxcps32sa9fnwic92mfbs0"; + + QTextStream in(&fstab_file); + + while(!in.atEnd()) + { + QString line = in.readLine(); + + if (line.startsWith("UUID")) + { + QStringList line_elements = line.split("="); + + if (line_elements.size() > 1) + return line_elements.at(1).left(23).trimmed(); + } + } + + qDebug() << "wew"; + return "gxcpz32sa9fnwic92mfbs0"; } #else -QString get_hdid() -{ - //T0D0: find a sane way to handle this - return "unknown_os_hdid"; -} +//throwing compile-time errors professionally +fhasdfuifhidfhasjkfasdkfahsdj #endif -- cgit From 3e8d0610ca59700b18da97a389d45bff925f234d Mon Sep 17 00:00:00 2001 From: David Skoland Date: Tue, 24 Jan 2017 15:54:49 +0100 Subject: removed debug statement --- hardware_functions.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'hardware_functions.cpp') diff --git a/hardware_functions.cpp b/hardware_functions.cpp index e755c246..0b161c3d 100644 --- a/hardware_functions.cpp +++ b/hardware_functions.cpp @@ -46,7 +46,6 @@ QString get_hdid() } } - qDebug() << "wew"; return "gxcpz32sa9fnwic92mfbs0"; } -- cgit