1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Linq ;
4
+ using System . Text ;
5
+ using System . Diagnostics ;
6
+
7
+ namespace AntiCrack_DotNet
8
+ {
9
+ class Program
10
+ {
11
+ public static void DisplayCheckResult ( string Text , bool Result )
12
+ {
13
+ if ( Result == true )
14
+ {
15
+ Console . Write ( Text ) ;
16
+ Console . ForegroundColor = ConsoleColor . DarkRed ;
17
+ Console . Write ( "[Bad]" + "\n \n " ) ;
18
+ Console . ForegroundColor = ConsoleColor . White ;
19
+ }
20
+ else
21
+ {
22
+ Console . Write ( Text ) ;
23
+ Console . ForegroundColor = ConsoleColor . DarkGreen ;
24
+ Console . Write ( "[Good]" + "\n \n " ) ;
25
+ Console . ForegroundColor = ConsoleColor . White ;
26
+ }
27
+ }
28
+
29
+ public static void DisplayCheckResult ( string Text , string Result )
30
+ {
31
+ if ( Result == "[Bad]" || Result == "Failed" )
32
+ {
33
+ Console . Write ( Text ) ;
34
+ Console . ForegroundColor = ConsoleColor . DarkRed ;
35
+ Console . Write ( Result + "\n \n " ) ;
36
+ Console . ForegroundColor = ConsoleColor . White ;
37
+ }
38
+ else if ( Result == "Skipped" )
39
+ {
40
+ Console . Write ( Text ) ;
41
+ Console . ForegroundColor = ConsoleColor . DarkYellow ;
42
+ Console . Write ( $ "[{ Result } ]" + "\n \n " ) ;
43
+ Console . ForegroundColor = ConsoleColor . White ;
44
+ }
45
+ else
46
+ {
47
+ Console . Write ( Text ) ;
48
+ Console . ForegroundColor = ConsoleColor . DarkGreen ;
49
+ Console . Write ( Result + "\n \n " ) ;
50
+ Console . ForegroundColor = ConsoleColor . White ;
51
+ }
52
+ }
53
+
54
+ private static void ExecuteAntiDebuggingTricks ( )
55
+ {
56
+ Console . WriteLine ( "----------------------------------Executing Anti Debugging Tricks-------------------------------------------------------" ) ;
57
+ DisplayCheckResult ( "GetForegroundWindow (Looking For Bad Active Debugger Windows): " , AntiDebug . GetForegroundWindowAntiDebug ( ) ) ;
58
+ DisplayCheckResult ( "Debugger.IsAttached: " , AntiDebug . DebuggerIsAttached ( ) ) ;
59
+ DisplayCheckResult ( "Hide Threads From Debugger..... " , AntiDebug . HideThreadsAntiDebug ( ) ) ;
60
+ DisplayCheckResult ( "IsDebuggerPresent: " , AntiDebug . IsDebuggerPresentCheck ( ) ) ;
61
+ DisplayCheckResult ( "NtQueryInformationProcess ProcessDebugFlags: " , AntiDebug . NtQueryInformationProcessCheck_ProcessDebugFlags ( ) ) ;
62
+ DisplayCheckResult ( "NtQueryInformationProcess ProcessDebugPort: " , AntiDebug . NtQueryInformationProcessCheck_ProcessDebugPort ( ) ) ;
63
+ DisplayCheckResult ( "NtQueryInformationProcess ProcessDebugObjectHandle: " , AntiDebug . NtQueryInformationProcessCheck_ProcessDebugObjectHandle ( ) ) ;
64
+ DisplayCheckResult ( "NtClose (Invalid Handle): " , AntiDebug . NtCloseAntiDebug_InvalidHandle ( ) ) ;
65
+ DisplayCheckResult ( "NtClose (Protected Handle): " , AntiDebug . NtCloseAntiDebug_ProtectedHandle ( ) ) ;
66
+ DisplayCheckResult ( "Parent Process (Checking if the parent process are cmd.exe or explorer.exe): " , AntiDebug . ParentProcessAntiDebug ( ) ) ;
67
+ DisplayCheckResult ( "Hardware Registers Breakpoints Detection: " , AntiDebug . HardwareRegistersBreakpointsDetection ( ) ) ;
68
+ DisplayCheckResult ( "FindWindow (Looking For Bad Debugger Windows): " , AntiDebug . FindWindowAntiDebug ( ) ) ;
69
+ DisplayCheckResult ( "GetTickCount Anti Debug: " , "Skipped" ) ; //it's unreliable for real anti-debug use
70
+ DisplayCheckResult ( "OutputDebugString Anti Debug: " , "Skipped" ) ; //it's unreliable for real anti-debug use
71
+ DisplayCheckResult ( "Trying To Crash Non-Managed Debuggers with a Debugger Breakpoint..... " , "Skipped" ) ;
72
+ //AntiDebug.DebugBreakAntiDebug(); //Not that useful, easily bypassable, and delays execution.
73
+ Console . Write ( "Executing OllyDbg Format String Exploit.....\n \n " ) ;
74
+ AntiDebug . OllyDbgFormatStringExploit ( ) ;
75
+ DisplayCheckResult ( "Patching DbgUiRemoteBreakin and DbgBreakPoint To Prevent Debugger Attaching..... " , AntiDebug . AntiDebugAttach ( ) ) ;
76
+ Console . WriteLine ( "------------------------------------------------------------------------------------------------------------------------\n \n " ) ;
77
+ }
78
+
79
+ private static void ExecuteAntiVirtualizationTricks ( )
80
+ {
81
+ Console . WriteLine ( "----------------------------------Executing Anti Virtualization Tricks--------------------------------------------------" ) ;
82
+ DisplayCheckResult ( "Checking For Sandboxie Module in Current Process: " , AntiVirtualization . IsSandboxiePresent ( ) ) ;
83
+ DisplayCheckResult ( "Checking For Comodo Sandbox Module in Current Process: " , AntiVirtualization . IsComodoSandboxPresent ( ) ) ;
84
+ DisplayCheckResult ( "Checking For Cuckoo Sandbox Module in Current Process: " , AntiVirtualization . IsCuckooSandboxPresent ( ) ) ;
85
+ DisplayCheckResult ( "Checking For Qihoo360 Sandbox Module in Current Process: " , AntiVirtualization . IsQihoo360SandboxPresent ( ) ) ;
86
+ DisplayCheckResult ( "Checking If The Program are Emulated: " , AntiVirtualization . IsEmulationPresent ( ) ) ;
87
+ DisplayCheckResult ( "Checking For Blacklisted Usernames: " , AntiVirtualization . CheckForBlacklistedNames ( ) ) ;
88
+ DisplayCheckResult ( "Checking if the Program are running under wine using dll exports detection: " , AntiVirtualization . IsWinePresent ( ) ) ;
89
+ DisplayCheckResult ( "Checking For VirtualBox and VMware: " , AntiVirtualization . CheckForVMwareAndVirtualBox ( ) ) ;
90
+ DisplayCheckResult ( "Checking For KVM: " , AntiVirtualization . CheckForKVM ( ) ) ;
91
+ DisplayCheckResult ( "Checking For HyperV: " , AntiVirtualization . CheckForHyperV ( ) ) ;
92
+ DisplayCheckResult ( "Checking For Known Bad VM File Locations: " , AntiVirtualization . BadVMFilesDetection ( ) ) ;
93
+ DisplayCheckResult ( "Checking For Known Bad Process Names: " , AntiVirtualization . BadVMProcessNames ( ) ) ;
94
+ DisplayCheckResult ( "Checking For Ports (useful to detect VMs which have no ports connected): " , AntiVirtualization . PortConnectionAntiVM ( ) ) ;
95
+ Console . Write ( "Trying To Crash Sandboxie if Present......\n \n " ) ;
96
+ AntiVirtualization . CrashingSandboxie ( ) ;
97
+ Console . WriteLine ( "------------------------------------------------------------------------------------------------------------------------\n \n " ) ;
98
+ }
99
+
100
+ private static void ExecuteAntiDllInjectionTricks ( )
101
+ {
102
+ Console . WriteLine ( "----------------------------------Executing Anti Dll Injection Tricks---------------------------------------------------" ) ;
103
+ DisplayCheckResult ( "Patching LoadLibraryA To Prevent Dll Injection..... " , AntiDllInjection . PatchLoadLibraryA ( ) ) ;
104
+ DisplayCheckResult ( "Patching LoadLibraryW To Prevent Dll Injection..... " , AntiDllInjection . PatchLoadLibraryW ( ) ) ;
105
+ DisplayCheckResult ( "Taking Advantage of Binary Image Signature Mitigation Policy to Prevent Non-Microsoft Binaries From Being Injected..... " , AntiDllInjection . BinaryImageSignatureMitigationAntiDllInjection ( ) ) ;
106
+ Console . WriteLine ( "------------------------------------------------------------------------------------------------------------------------\n \n " ) ;
107
+ }
108
+
109
+ private static void ExecuteOtherDetectionTricks ( )
110
+ {
111
+ Console . WriteLine ( "----------------------------------Executing Other Detection Tricks-----------------------------------------------------\n " ) ;
112
+ DisplayCheckResult ( "Detecting if Unsigned Drivers are allowed to load: " , OtherChecks . IsUnsignedDriversAllowed ( ) ) ;
113
+ DisplayCheckResult ( "Detecting if Test-Signed Drivers are allowed to load: " , OtherChecks . IsTestSignedDriversAllowed ( ) ) ;
114
+ Console . WriteLine ( "------------------------------------------------------------------------------------------------------------------------\n \n " ) ;
115
+ }
116
+
117
+ private static void ExecuteHooksDetectionTricks ( )
118
+ {
119
+ Console . WriteLine ( "----------------------------------Executing Hooks Detection Tricks------------------------------------------------------" ) ;
120
+ DisplayCheckResult ( "Detecting Most Anti Anti-Debugging Hooking Methods on Common Anti-Debugging Functions by checking for Bad Instructions on Functions Addresses (Most Effective on x64): " , HooksDetection . DetectBadInstructionsOnCommonAntiDebuggingFunctions ( ) ) ;
121
+ Console . WriteLine ( "------------------------------------------------------------------------------------------------------------------------\n \n " ) ;
122
+ }
123
+
124
+ static void Main ( string [ ] args )
125
+ {
126
+ Console . Title = "AntiCrack DotNet" ;
127
+ for ( ; ; )
128
+ {
129
+ ExecuteAntiDebuggingTricks ( ) ;
130
+ ExecuteAntiVirtualizationTricks ( ) ;
131
+ ExecuteAntiDllInjectionTricks ( ) ;
132
+ ExecuteOtherDetectionTricks ( ) ;
133
+ ExecuteHooksDetectionTricks ( ) ;
134
+ Console . ReadLine ( ) ;
135
+ }
136
+ }
137
+ }
138
+ }
0 commit comments