- Автор темы
- #1
Код:
from VMsensor import TestVM
if TestVM().checkVirtualMachine() == True:
/* WM твой фетиш ? */
else:
/* Работаем дальше */
как использовать понятно, забыл добавить сам класс TestVM ))
а вот и он
Код:
from _winreg import *
import os
import psutil
class TestVM(object):
def checkVirtualMachine(self):
openregisters = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
RunKey = OpenKey(openregisters, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
for i in range(20):
try:
n,v,t = EnumValue(RunKey,i)
if "vboxtray" in n.lower() or "vbox" in n.lower():
return True;
except:
pass
CloseKey(RunKey)
self.startupcheck2()
def startupcheck2(self):
try:
for x, xx, files in os.walk(r"C:\Documents and Settings"):
if len(files) != 0:
files = [x.lower() for x in files]
if "vbox" in files:
return True;
except:
pass
def regeditcheck(self):
vbox = ["VboxGuest", "VboxMouse", "VboxService", "VboxService", "VboxVideo"]
for x in vbox:
try:
openregisters = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
path = r"SYSTEM\ControlSet001\Services\%s" % x
RunKey = OpenKey(openregisters, path)
return True;
except:
pass
self.system32()
def system32(self):
try:
for files in os.listdir("C:\WINDOWS\system32"):
if "VBox" in files:
return True;
except:
pass
self.graphiccard()
def graphiccard(self):
if os.path.isdir(r"C:\Program Files\Oracle\VirtualBox Guest Additions"):
return True;
if os.path.isdir(r"C:\WINDOWS\system32\DRVSTORE"):
for folder in os.listdir(r"C:\WINDOWS\system32\DRVSTORE"):
if folder.startswith("VBox"):
return True;
self.pids()
def pids(self):
for proc in psutil.process_iter():
try:
if "VBox" in proc.name():
return True;
except:
pass
return False
from VMsensor import TestVM
if TestVM().checkVirtualMachine() == True:
/* WM твой фетиш ? */
else:
/* Работаем дальше */
как использовать понятно, забыл добавить сам класс TestVM ))
а вот и он
Код:
from _winreg import *
import os
import psutil
class TestVM(object):
def checkVirtualMachine(self):
openregisters = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
RunKey = OpenKey(openregisters, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
for i in range(20):
try:
n,v,t = EnumValue(RunKey,i)
if "vboxtray" in n.lower() or "vbox" in n.lower():
return True;
except:
pass
CloseKey(RunKey)
self.startupcheck2()
def startupcheck2(self):
try:
for x, xx, files in os.walk(r"C:\Documents and Settings"):
if len(files) != 0:
files = [x.lower() for x in files]
if "vbox" in files:
return True;
except:
pass
def regeditcheck(self):
vbox = ["VboxGuest", "VboxMouse", "VboxService", "VboxService", "VboxVideo"]
for x in vbox:
try:
openregisters = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
path = r"SYSTEM\ControlSet001\Services\%s" % x
RunKey = OpenKey(openregisters, path)
return True;
except:
pass
self.system32()
def system32(self):
try:
for files in os.listdir("C:\WINDOWS\system32"):
if "VBox" in files:
return True;
except:
pass
self.graphiccard()
def graphiccard(self):
if os.path.isdir(r"C:\Program Files\Oracle\VirtualBox Guest Additions"):
return True;
if os.path.isdir(r"C:\WINDOWS\system32\DRVSTORE"):
for folder in os.listdir(r"C:\WINDOWS\system32\DRVSTORE"):
if folder.startswith("VBox"):
return True;
self.pids()
def pids(self):
for proc in psutil.process_iter():
try:
if "VBox" in proc.name():
return True;
except:
pass
return False