Monday 15 April 2013

Detect Running in Virtual Machine and Real Machine

Method 1 :
http://www.codeproject.com/Articles/9823/Detect-if-your-program-is-running-inside-a-Virtual
defect : +This mothod maybe crashes when I run it in a native system (Windows 7 64-bit OS)
             +can not builds x64
Method 2 : using mac address ( Careful....!!!!)
The IEEE assigns these first three bytes and the database is available online at IEEE OUI and Company_id Assignments.
Search the Public OUI/'company_id' Listing
Search for: 
"00:05:69"; //vmware1
"00:0C:29"; //vmware2
"00:50:56"; //vmware3
"00:1C:42"; //parallels1
"00:03:FF"; //microsoft virtual pc
"00:0F:4B"; //virtual iron 4
"00:16:3E"; //red hat xen , oracle vm , xen source, novell xen
"08:00:27"; //virtualbox
Method 3:Using model from  the Win32_ComputerSystem (http://projects.puppetlabs.com)
Win32_ComputerSystem.Manufacturer       Win32_ComputerSystem.Model

Microsoft Corporation                   Virtual Machine
VMware, Inc.                            VMware Virtual Platform
Red Hat                                 KVM
innotek GmbH                            VirtualBox

//==========================================================================
MAC address .
get real mac addres : pinfo->Type == MIB_IF_TYPE_ETHERNET 
                       
                      string pnp = obj["PNPDeviceID"].ToString();
                      if (pnp.Contains("PCI\\"))
//--------------------------------------------------------------------------
http://www.installsetupconfig.com/win32programming/
generating-hardware-based-computerid
http://blogs.vmware.com/teamfusion/2008/10/vmware-fusion-3-2.html

No comments:

Post a Comment