Ejemplo n.º 1
0
        static void WaitForDebugger()
        {
            var start = DateTime.Now;

            while (!AntiDebug.CheckDebuggerUnmanagedPresent() &&
                   !AntiDebug.CheckDebuggerManagedPresent() &&
                   !AntiDebug.CheckRemoteDebugger())
            {
                Console.WriteLine("Application working by self debugging...");
                if ((DateTime.Now - start).TotalMinutes > 1)
                {
                    throw new TimeoutException("Debug operation timeout.");
                }
                Thread.Sleep(1);
            }
        }
Ejemplo n.º 2
0
        internal static void PerformChecks()
        {
            if (AntiDebug.CheckRemoteDebugger())
            {
                throw new Exception(Constants.ActiveRemoteDebuggerFound);
            }

            if (AntiDebug.CheckDebuggerManagedPresent() || AntiDebug.CheckDebugPort())
            {
                throw new Exception(Constants.ActiveDebuggerFound);
            }

            if (AntiDebug.CheckDebuggerUnmanagedPresent())
            {
                throw new Exception(Constants.ActiveUnmanagedDebuggerFound);
            }

            if (AntiDebug.CheckKernelDebugInformation())
            {
                throw new Exception(Constants.ActiveKernelDebuggerFound);
            }

            if (DetectEmulation())
            {
                throw new Exception(Constants.ApplicationRunningOnEmulation);
            }

            if (DetectSandbox())
            {
                throw new Exception(Constants.ApplicationRunningOnSandbox);
            }

            if (DetectVirtualMachine())
            {
                throw new Exception(Constants.ApplicationRunningOnVirtualMachine);
            }
        }