Home Are you my Hypervisor?
Post
Cancel

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).

1
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.

This post is licensed under CC BY 4.0 by the author.