#HOW TO USE
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using SharpDefender;
namespace SharpDefenderExample
{
class Program
{
static void Main(string[] args)
{
// Anti-Virtualization checks
bool isVMWare = AntiVirtualization.IsVMWare();
if (isVMWare)
{
MessageBox.Show("VMware detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isKVM = AntiVirtualization.CheckForKVM();
if (isKVM)
{
MessageBox.Show("KVM detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isScreenSmall = AntiVirtualization.IsScreenSmall();
if (isScreenSmall)
{
MessageBox.Show("Small screen detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isParallels = AntiVirtualization.CheckForParallels();
if (isParallels)
{
MessageBox.Show("Parallels detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isQEMU = AntiVirtualization.CheckForQEMU();
if (isQEMU)
{
MessageBox.Show("QEMU detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool recentFileActivity = AntiVirtualization.RecentFileActivityCheck();
if (recentFileActivity)
{
MessageBox.Show("Suspicious recent file activity detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isRepetitiveProcess = AntiVirtualization.CheckRepetitiveProcess();
if (isRepetitiveProcess)
{
MessageBox.Show("Repetitive process detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isTriageCheckPassed = AntiVirtualization.TriageCheck();
if (isTriageCheckPassed)
{
MessageBox.Show("Suspicious hard disk model detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isUSBPluggedIn = AntiVirtualization.PluggedIn();
if (isUSBPluggedIn)
{
MessageBox.Show("USB device detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool areVMArtifactsDetected = AntiVirtualization.VMArtifactsDetect();
if (areVMArtifactsDetected)
{
MessageBox.Show("VM artifacts detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isGraphicsCardCheckPassed = AntiVirtualization.GraphicsCardCheck();
if (isGraphicsCardCheckPassed)
{
MessageBox.Show("VirtualBox graphics card detected! Closing the application.", "Virtualization Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
// Anti-Debug checks
bool isDebuggerPresent = AntiDebug.IsDebuggerPresent();
if (isDebuggerPresent)
{
MessageBox.Show("Debugger detected! Closing the application.", "Debugger Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isDebuggerAttached = AntiDebug.CheckForDebuggerAttached();
if (isDebuggerAttached)
{
MessageBox.Show("Debugger attached! Closing the application.", "Debugger Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isProcessRunningUnderDebugger = AntiDebug.IsProcessRunningUnderDebugger();
if (isProcessRunningUnderDebugger)
{
MessageBox.Show("Process running under debugger! Closing the application.", "Debugger Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isNtGlobalFlagDebuggerPresent = AntiDebug.CheckNtGlobalFlag();
if (isNtGlobalFlagDebuggerPresent)
{
MessageBox.Show("NtGlobalFlag Debugger detected! Closing the application.", "Debugger Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
bool isBreakPointTriggered = AntiDebug.IsBreakPointTriggered();
if (isBreakPointTriggered)
{
MessageBox.Show("Breakpoint triggered! Closing the application.", "Debugger Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
// Anti-DLL Injection checks
bool isDllInjectionDetected = AntiDllInject.CheckDllInjection();
if (isDllInjectionDetected)
{
MessageBox.Show("DLL Injection detected! Closing the application.", "DLL Injection Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Environment.Exit(0); // Exit the application after message box
}
// If no suspicious activity was detected, allow the program to continue
MessageBox.Show("No suspicious activity detected. Proceeding normally.", "No Threats Detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}