checkvm for mac os - remote function

This commit is contained in:
AlessandroZ 2017-02-10 12:01:57 +01:00
parent a630a79435
commit b6488d42a1
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
import subprocess
import os
def checkvm():
# check existing dir
dirs = [
'~/Library/Logs/VMWare',
'~/Library/Logs/VMWare Fusion/'
]
for d in dirs:
if os.path.isdir(os.path.expanduser(d)):
return 'VMWare'
p = subprocess.Popen('system_profiler', stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
output, err = p.communicate()
if output:
if 'VMWare' in output:
return 'VMWare'
elif 'VirtualBox' in output:
return 'VirtualBox'
return None