Are you my Hypervisor?

I’m currently writing a script to try and detect if I’m in a guest on vmware. I was looking around and found some complicated C programs to probe memory to detect it. Then I was talking to one of my friends and we thought about using /proc/cpuinfo. It’s probably very crude, but if you want a quick way to detect if you are in a guest. Look for the hypervisor flag in cpuinfo! (this is for linux of course).

awk ‘BEGIN {virtual=”false”} /flags.*hypervisor/ {virtual=”true”} END {print virtual}’ /proc/cpuinfo

This will return you true if it is a virtual machine and false if it is a physical server.

Comments are closed.