X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=compile%2Fvmware-detect.c;h=c99e36ff05e67911839177a562088a1b47ad8d3f;hb=3b7f948896440f41092f14347b17ce114072c569;hp=4914c8eec38eb675cf8543595892d12d3162b7d6;hpb=9c2baa5e85d1e11be3f46e8756259663d8e070e3;p=grml-scripts.git diff --git a/compile/vmware-detect.c b/compile/vmware-detect.c index 4914c8e..c99e36f 100644 --- a/compile/vmware-detect.c +++ b/compile/vmware-detect.c @@ -1,7 +1,16 @@ +/* Filename: vmware-detect.c +* Purpose: Detect if running inside vmware +* Authors: grml-team (grml.org), (c) Michael Gebetsroither +* Bug-Reports: see http://grml.org/bugs/ +* License: This file is licensed under the GPL v2. +*******************************************************************************/ +// return 0 if running inside vmware, 1 otherwise + #include "string.h" #include "unistd.h" #include "stdio.h" #include "stdlib.h" +#include "signal.h" #define WRITE(x) write(1, x, strlen(x)) #define DWRITE(x) do{ \ @@ -12,6 +21,12 @@ #define FALSE 0 #define TRUE !FALSE +/* doc: + * vmware IO backdoor: http://chitchat.at.infoseek.co.jp/vmware/backdoor.html + * http://www.honeynet.org/papers/bots/botnet-code.html + * http://www.codegurus.be/codegurus/Programming/virtualpc&vmware_en.htm + */ + // from libowfat {{{ static inline char tohex(char c) { return c>=10?c-10+'a':c+'0'; @@ -33,26 +48,31 @@ unsigned int fmt_xlong(char *dest,unsigned long i) { void printIdtr(const unsigned char* idtr, unsigned size) { unsigned i; - for(i=0; i<=size; ++i) { + for(i=0; i