|
发表于 2005-5-17 11:56:58
|
显示全部楼层
2. [challenge] Identifying VMWare using vmware_tools
/*
* gcc -Wall -o checkVM checkVM.c
* check linux OS in VMare ?
* by alert7
*
*/
#include <stdio.h>
#include <stdlib.h>
struct idtr {
unsigned short limit;
unsigned int base;
} __attribute__ ((packed));
unsigned int get_addr_idt() {
struct idtr idtr;
asm("sidt %0" : "=m" (idtr));
return idtr.base;
}
int main(int argc, char ** argv)
{
unsigned int ptr_idt;
ptr_idt=get_addr_idt();
printf("IDT Addr %p \n",ptr_idt);
if ( (ptr_idt>>24)==0xc0)
printf("Real Linux\n");
else printf("Maybe in VMare\n");
return 0;
} |
|