/ * * gcc -wall -o checkvm checkvm.c * check linux os in vmare? * by alert7 * * / #include
#include
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;}