Sinisterly
Detect Virtual Machines - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: Detect Virtual Machines (/Thread-Detect-Virtual-Machines)



Detect Virtual Machines - M3 ™ - 09-18-2012

It's a long Way to detect if running on a Virtual Machine , not special , just for pass time

Hope enjoy


Code:
;========================================= ; Detect Virtual PC >> Vmware |VirtualBox ; Autor : M3 ;========================================= Func _DetectVirtualPC() Local $sWMI, $sFind ,$sActive , $VM , $VBox $VM = "VMwaretray.exe" $VBox = "VboxSvc.exe" $sWMI = ObjGet("winmgmts:") $sFind = $sWMI.InstancesOf("win32_process") For $sActive In $sFind Select Case $VM If $sActive.Caption = $VM Then Msgbox(0,"","Yeah I`m running on Vmware") Exit EndIf Case $VBox If $sActive.Caption = $VBox Then Msgbox(0,"","Yeah I`m Running on VirtualBox") Exit EndIf EndSelect Next Endfunc



RE: Detect Virtual Machines - H4R0015K - 09-18-2012

which language is this??

oops..i didn't saw the section, my bad..


RE: Detect Virtual Machines - M3 ™ - 09-18-2012

Lol i'ts posted on AutoIt session xD


RE: Detect Virtual Machines - 1234hotmaster - 09-19-2012

Nice code. But safer way is checking if first letter starts with V Tongue


RE: Detect Virtual Machines - spymare - 10-09-2012

here is a more secure way to do it:

Quote:$SysInfo_Read = _RunStdOutRead("SystemInfo")

Func _RunStdOutRead($sRunCmd)
Local $iPID = Run(@ComSpec & ' /c ' & $sRunCmd, @ScriptDir, @SW_HIDE, 4 + 2)
Local $sStdOutRead = ""

While ProcessExists($iPID)
$sStdOutRead &= StdoutRead($iPID)
WEnd

$location = StringInStr($sStdOutRead, "innotek", 0, 1) ; Find the 1st occurance of "innotek" - innotek is a word from virtualbox
if $location = 0 then
;do nothing
Else
MsgBox(4096, "Error", "Virtual machine is detected")
EndIf

Return $sStdOutRead
EndFunc