1

Ideally, I'd like a isRunningInVirtualbox() function that returns True or False.

I'm specifically looking at getting this detection in Python. Is there a Python module or some way that can detect if the Python script is being run in Virtualbox (or ideally detect if it's being run in VMware or some other VM.)

(I'm writing a script that will warn the user if it's NOT running in a VM, so I don't really care about elaborate hacks or tricks that will try to give false positives.)

Al Sweigart
  • 11,566
  • 10
  • 64
  • 92
  • 1
    There are some techniques to detect if the current OS is executed in a VM, but it somehow the purpose of a VM that the guest OS is not able to detect if it is executed virtualized. Therefore, I think it is not possible to detect it from a Python script. As a quick [reference](http://resources.infosecinstitute.com/how-malware-detects-virtualized-environment-and-its-countermeasures-an-overview/) – PraMiD Dec 02 '17 at 23:35
  • 1
    Maybe running something like https://unix.stackexchange.com/questions/89714/easy-way-to-determine-virtualization-technology – Mate Dec 02 '17 at 23:38
  • In particular, This answer to that question: https://stackoverflow.com/a/108504/2594812; running virt-what from python should be easy – Sam Hartman Dec 03 '17 at 19:09

0 Answers0