检测源码:
#include <windows.h>
#include <stdio.h>
BOOL gInVMWARE, gInVirtualPC;
BOOL VMWareTest()
{
BYTE PortValue1,PortValue2;
__try
{
__asm
{
pushad
pushfd
xor ebx,ebx
mov ecx,0xa
mov eax, 'VMXh' ; EAX=magic //564D5868
mov dx, 'VX' ; DX=magic
in eax, dx ; specially processed io cmd
cmp ebx, 'VMXh' ; also eax/ecx modified (maybe vmw/os ver?)
sete al;
movzx eax, al
mov gInVMWARE, eax;
popfd
popad
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
gInVMWARE=FALSE;
}
return gInVMWARE;
}
BOOL VirtualPCTest()
{
__try
{
__asm
{
pushad
mov ebx, 0 // Flag
mov eax, 1 // VPC function number
__emit 0Fh
__emit 3Fh
__emit 07h
__emit 0Bh
test ebx, ebx
sete al
movzx eax, al
mov gInVirtualPC , eax;
popad
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
gInVirtualPC=FALSE;
}
return gInVirtualPC;
}
BOOL VMTest()
{
ULONG xdt = 0 ;
ULONG InVM = 0;
__asm
{
push edx
sidt [esp-2]
pop edx
nop
mov xdt , edx
}
printf("idt = %08x\n" , xdt);
if (xdt > 0xd0000000)
{
//printf("IDT Test :running in vm!\n");
InVM = 1;
}
else
{
InVM = 0;
}
__asm
{
push edx
sgdt [esp-2]
pop edx
nop
mov xdt , edx
}
printf("gdt = %08x\n" , xdt);
if (xdt > 0xd0000000)
{
InVM += 1;
}
else
{
InVM += 0;
}
return InVM;
}
int main()
{
if (VMWareTest())
{
printf("In Vmware !!!");
}
else if (VirtualPCTest())
{
printf("In VirtualPC!!!!");
}
else if (VMTest())
{
printf("In VM !");
}
else
{
printf("In Host!");
}
getchar ();
return 1;
}
过虚拟机中Themida检测方法:
两步可以通吃很多Anti-vmware的方法
第一步是在虚拟机系统的配置文件添加
monitor_control.restrict_backdoor = "true"
关闭后门
第二步建议开起虚拟机,然后虚拟机 - 设置 - Hardware - Processors - 禁止加速二进制翻译勾起
或添加
disable_acceleration = "TRUE"
其它参考: