src/AntiDebugging/AntiDebugging.Demo/Program.cs
/// <summary>
/// Perform basic checks, method 1
/// Checks are very fast, there is no CPU overhead.
/// </summary>
Perform basic checks, method 1
Checks are very fast, there is no CPU overhead.
Perform basic checks method 1 Checks are very fast there is no CPU overhead .
public static bool PerformChecks()
        {
            var isProcessRemote = AntiDebug.CheckRemoteDebugger();
            var isManagedCodesAttached = AntiDebug.CheckDebuggerManagedPresent();
            var isUnManagedCodesAttached = AntiDebug.CheckDebuggerUnmanagedPresent();
            var checkDebugPort = AntiDebug.CheckDebugPort();
            var checkKernelDebugInformation = AntiDebug.CheckKernelDebugInformation();
            var detectEmulation = ProtectionHelper.DetectEmulation();
            var detectSandbox = ProtectionHelper.DetectSandbox();
            var detectVirtualMachine = ProtectionHelper.DetectVirtualMachine();
            var detachFromDebuggerProcess = AntiDebug.DetachFromDebuggerProcess();
            WriteBooleanResult($"{nameof(AntiDebug)}.{nameof(AntiDebug.CheckRemoteDebugger)}", isProcessRemote);
            WriteBooleanResult($"{nameof(AntiDebug)}.{nameof(AntiDebug.CheckDebuggerManagedPresent)}", isManagedCodesAttached);
            WriteBooleanResult($"{nameof(AntiDebug)}.{nameof(AntiDebug.CheckDebuggerUnmanagedPresent)}", isUnManagedCodesAttached);
            WriteBooleanResult($"{nameof(AntiDebug)}.{nameof(AntiDebug.CheckDebugPort)}", checkDebugPort);
            WriteBooleanResult($"{nameof(AntiDebug)}.{nameof(AntiDebug.CheckKernelDebugInformation)}", checkKernelDebugInformation);
            WriteBooleanResult($"{nameof(ProtectionHelper)}.{nameof(ProtectionHelper.DetectEmulation)}", detectEmulation);
            WriteBooleanResult($"{nameof(ProtectionHelper)}.{nameof(ProtectionHelper.DetectSandbox)}", detectSandbox);
            WriteBooleanResult($"{nameof(ProtectionHelper)}.{nameof(ProtectionHelper.DetectVirtualMachine)}", detectVirtualMachine);
            WriteBooleanResult($"{nameof(AntiDebug)}.{nameof(AntiDebug.DetachFromDebuggerProcess)}", detachFromDebuggerProcess);
            AntiDebug.HideOsThreads();
            Scanner.ScanAndKill();
            if (isProcessRemote || isManagedCodesAttached || 
                isUnManagedCodesAttached || checkDebugPort || 
                checkKernelDebugInformation || detectEmulation || 
                detectSandbox || detectVirtualMachine)
            {
                ProtectionHelper.FreezeMouse();
                ProtectionHelper.ShowCmd("Protector", "Active debugger found!", "C");
                return true;
            }
            return false;
        }
public static bool PerformChecks ( ) { var isProcessRemote = AntiDebug . CheckRemoteDebugger ( ) ; var isManagedCodesAttached = AntiDebug . CheckDebuggerManagedPresent ( ) ; var isUnManagedCodesAttached = AntiDebug . CheckDebuggerUnmanagedPresent ( ) ; var checkDebugPort = AntiDebug . CheckDebugPort ( ) ; var checkKernelDebugInformation = AntiDebug . CheckKernelDebugInformation ( ) ; var detectEmulation = ProtectionHelper . DetectEmulation ( ) ; var detectSandbox = ProtectionHelper . DetectSandbox ( ) ; var detectVirtualMachine = ProtectionHelper . DetectVirtualMachine ( ) ; var detachFromDebuggerProcess = AntiDebug . DetachFromDebuggerProcess ( ) ; WriteBooleanResult ( $" { nameof ( AntiDebug ) } . { nameof ( AntiDebug . CheckRemoteDebugger ) } " , isProcessRemote ) ; WriteBooleanResult ( $" { nameof ( AntiDebug ) } . { nameof ( AntiDebug . CheckDebuggerManagedPresent ) } " , isManagedCodesAttached ) ; WriteBooleanResult ( $" { nameof ( AntiDebug ) } . { nameof ( AntiDebug . CheckDebuggerUnmanagedPresent ) } " , isUnManagedCodesAttached ) ; WriteBooleanResult ( $" { nameof ( AntiDebug ) } . { nameof ( AntiDebug . CheckDebugPort ) } " , checkDebugPort ) ; WriteBooleanResult ( $" { nameof ( AntiDebug ) } . { nameof ( AntiDebug . CheckKernelDebugInformation ) } " , checkKernelDebugInformation ) ; WriteBooleanResult ( $" { nameof ( ProtectionHelper ) } . { nameof ( ProtectionHelper . DetectEmulation ) } " , detectEmulation ) ; WriteBooleanResult ( $" { nameof ( ProtectionHelper ) } . { nameof ( ProtectionHelper . DetectSandbox ) } " , detectSandbox ) ; WriteBooleanResult ( $" { nameof ( ProtectionHelper ) } . { nameof ( ProtectionHelper . DetectVirtualMachine ) } " , detectVirtualMachine ) ; WriteBooleanResult ( $" { nameof ( AntiDebug ) } . { nameof ( AntiDebug . DetachFromDebuggerProcess ) } " , detachFromDebuggerProcess ) ; AntiDebug . HideOsThreads ( ) ; Scanner . ScanAndKill ( ) ; if ( isProcessRemote || isManagedCodesAttached || isUnManagedCodesAttached || checkDebugPort || checkKernelDebugInformation || detectEmulation || detectSandbox || detectVirtualMachine ) { ProtectionHelper . FreezeMouse ( ) ; ProtectionHelper . ShowCmd ( " " , " " , " " ) ; return true ; } return false ; }
Perform basic checks, method 1
Checks are very fast, there is no CPU overhead.
Perform basic checks method 1 Checks are very fast there is no CPU overhead .