Skip to content

Commit f101aef

Browse files
authored
Merge pull request #192 from kernelwernel/dev
Dev
2 parents 9ef94db + 95a807e commit f101aef

File tree

5 files changed

+51
-16
lines changed

5 files changed

+51
-16
lines changed

CMakeLists.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
2020
if (MSVC)
2121
set(CMAKE_CXX_FLAGS "/Wall /W4 /EHsc")
2222
else()
23+
# linux and apple
2324
set(CMAKE_CXX_FLAGS "-Wextra -Wall -Wextra -Wconversion -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion")
2425
endif()
2526

@@ -61,6 +62,15 @@ if (MSVC)
6162
MESSAGE(STATUS "Build set to release mode")
6263
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2")
6364
endif()
65+
elseif(APPLE)
66+
if(CMAKE_BUILD_TYPE MATCHES "Debug")
67+
MESSAGE(STATUS "Build set to debug mode")
68+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fsanitize=address")
69+
elseif(CMAKE_BUILD_TYPE MATCHES "Release")
70+
MESSAGE(STATUS "Build set to release mode")
71+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O2")
72+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
73+
endif()
6474
elseif(LINUX)
6575
if(CMAKE_BUILD_TYPE MATCHES "Debug")
6676
MESSAGE(STATUS "Build set to debug mode")
@@ -105,10 +115,15 @@ if (NOT MSVC)
105115
if(CMAKE_BUILD_TYPE MATCHES "Release")
106116
install(TARGETS ${TARGET} DESTINATION /usr/local/bin)
107117
install(FILES "src/vmaware.hpp" DESTINATION /usr/include)
118+
install(FILES "src/vmaware_MIT.hpp" DESTINATION /usr/include)
108119
else()
109120
install(TARGETS ${TARGET} DESTINATION ${CMAKE_SOURCE_DIR})
110121
endif()
111122
elseif(MSVC)
112-
set(CMAKE_INSTALL_PREFIX "C:\\Program Files\\YourApplication")
113-
install(TARGETS ${TARGET} DESTINATION .)
123+
set(CMAKE_INSTALL_PREFIX "C:\\Program Files\\YourApplication")
124+
install(TARGETS ${TARGET} RUNTIME DESTINATION "bin")
125+
126+
set(HEADER_INSTALL_PATH "C:\\Program Files (x86)\\YourLibrary\\include")
127+
install(FILES "src/vmaware.hpp" DESTINATION "${HEADER_INSTALL_PATH}")
128+
install(FILES "src/vmaware_MIT.hpp" DESTINATION "${HEADER_INSTALL_PATH}")
114129
endif()

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,20 @@ cmake ..
9494
sudo make install
9595
```
9696

97+
### FOR MACOS:
98+
```bash
99+
mkdir build
100+
cd build
101+
cmake ..
102+
sudo make install
103+
```
104+
97105
### FOR WINDOWS:
98106
```bash
99107
cmake -S . -B build/ -G "Visual Studio 16 2019"
100108
```
101109

110+
102111
### CMake installation
103112
```cmake
104113
# edit this

assets/demo.jpg

698 KB
Loading

src/vmaware.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
* - struct for internal cpu operations => line 611
2929
* - struct for internal memoization => line 1071
3030
* - struct for internal utility functions => line 1454
31-
* - struct for internal core components => line 9673
31+
* - struct for internal core components => line 9684
3232
* - start of internal VM detection techniques => line 2931
33-
* - start of public VM detection functions => line 10071
34-
* - start of externally defined variables => line 10952
33+
* - start of public VM detection functions => line 10082
34+
* - start of externally defined variables => line 10963
3535
*
3636
*
3737
* ================================ EXAMPLE ==================================

src/vmaware_MIT.hpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
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

Comments
 (0)