Skip to content

Commit e72322d

Browse files
committed
Check CPU vendor using cpuid lib
1 parent 787e9a8 commit e72322d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

vmdetect/linux.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package vmdetect
55
import (
66
"bufio"
77
"bytes"
8+
"github.com/klauspost/cpuid"
89
"io/ioutil"
910
"os"
1011
"time"
@@ -101,6 +102,10 @@ func checkKernelRingBuffer() bool {
101102
*/
102103
func IsRunningInVirtualMachine() (bool, string) {
103104

105+
if cpuid.CPU.VM() {
106+
return true, "CPU Vendor"
107+
}
108+
104109
if checkDMITable() {
105110
return true, "DMI Table"
106111
}

0 commit comments

Comments
 (0)