5050 * - struct for internal cpu operations => line 621
5151 * - struct for internal memoization => line 1081
5252 * - struct for internal utility functions => line 1464
53- * - struct for internal core components => line 9189
53+ * - struct for internal core components => line 9200
5454 * - start of internal VM detection techniques => line 2941
55- * - start of public VM detection functions => line 9587
56- * - start of externally defined variables => line 10458
55+ * - start of public VM detection functions => line 9598
56+ * - start of externally defined variables => line 10469
5757 *
5858 *
5959 * ================================ EXAMPLE ==================================
@@ -9141,12 +9141,16 @@ static bool rdtsc() {
91419141#if (!LINUX)
91429142 return false ;
91439143#else
9144- if (!(util::exists (" /usr/bin/lshw" ) || util::exists (" /bin/lshw" ))) {
9144+ if (!(
9145+ (util::exists (" /usr/bin/lshw" )) ||
9146+ (util::exists (" /bin/lshw" )) ||
9147+ (util::exists (" /usr/sbin/lshw" ))
9148+ )) {
91459149 debug (" LSHW_QEMU: " , " binary doesn't exist" );
91469150 return false ;
91479151 }
9148-
9149- const std::unique_ptr<std::string> result = util::sys_result (" lshw" );
9152+
9153+ const std::unique_ptr<std::string> result = util::sys_result (" lshw 2>&1 " );
91509154
91519155 if (result == nullptr ) {
91529156 debug (" LSHW_QEMU: " , " invalid stdout output from lshw" );
@@ -9156,11 +9160,18 @@ static bool rdtsc() {
91569160 const std::string full_command = *result;
91579161
91589162 u8 score = 0 ;
9163+
9164+ auto qemu_finder = [&](const char * str) -> void {
9165+ if (util::find (full_command, str)) {
9166+ debug (" LSHW_QEMU: found " , str);
9167+ score++;
9168+ }
9169+ };
91599170
9160- if ( util::find (full_command, " QEMU PCIe Root port" )) { score++; }
9161- if ( util::find (full_command, " QEMU XHCI Host Controller" )) { score++; }
9162- if ( util::find (full_command, " QEMU DVD-ROM" )) { score++; }
9163- if ( util::find (full_command, " QEMU QEMU USB Tablet" )) { score++; }
9171+ qemu_finder ( " QEMU PCIe Root port" );
9172+ qemu_finder ( " QEMU XHCI Host Controller" );
9173+ qemu_finder ( " QEMU DVD-ROM" );
9174+ qemu_finder ( " QEMU QEMU USB Tablet" );
91649175
91659176 return (score >= 3 );
91669177#endif
@@ -10747,7 +10758,7 @@ std::pair<VM::enum_flags, VM::core::technique> VM::core::technique_list[] = {
1074710758 { VM::WMI_TEMPERATURE, { 25 , VM::wmi_temperature, false } },
1074810759 { VM::PROCESSOR_ID, { 25 , VM::processor_id, false } },
1074910760 { VM::CPU_FANS, { 35 , VM::cpu_fans, false } },
10750- { VM::VMWARE_HARDENER, { 50 , VM::vmware_hardener, false } },
10761+ { VM::VMWARE_HARDENER, { 60 , VM::vmware_hardener, false } },
1075110762 { VM::SYS_QEMU, { 70 , VM::sys_qemu_dir, false } },
1075210763 { VM::LSHW_QEMU, { 80 , VM::lshw_qemu, false } },
1075310764 // ADD NEW TECHNIQUE STRUCTURE HERE
0 commit comments