-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMainModule.cs
73 lines (63 loc) · 2.02 KB
/
MainModule.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
namespace Nokae.DebugProtector
{
internal static class MainModule
{
[DllImport("kernel32", EntryPoint = "SetProcessWorkingSetSize")]
private static extern int OneWayAttribute([In] IntPtr obj0, [In] int obj1, [In] int obj2);
internal static bool IsSandboxie()
{
return Sandboxie.IsSandboxie();
}
internal static bool IsVM()
{
return CommonAcl.SecurityDocumentElement();
}
internal static bool IsDebugger()
{
return DebuggerAcl.Run();
}
internal static bool IsdnSpyRun()
{
return DnSpy.ValueType();
}
internal static bool IsEmulation()
{
var millisecondsTimeout = new Random().Next(3000, 10000);
var now = DateTime.Now;
Thread.Sleep(millisecondsTimeout);
if ((DateTime.Now - now).TotalMilliseconds >= millisecondsTimeout)
return false;
return true;
}
internal static void SelfDelete()
{
Process.Start(new ProcessStartInfo("cmd.exe",
"/C ping 1.1.1.1 -n 1 -w 3000 > Nul & Del \"" +
Assembly.GetExecutingAssembly().Location + "\"")
{
WindowStyle = ProcessWindowStyle.Hidden
})
?.Dispose();
Process.GetCurrentProcess().Kill();
}
private static void WellKnownSidType()
{
var handle = Process.GetCurrentProcess().Handle;
while (true)
{
do
{
Thread.Sleep(16384);
GC.Collect();
GC.WaitForPendingFinalizers();
} while (Environment.OSVersion.Platform != PlatformID.Win32NT);
OneWayAttribute(handle, -1, -1);
}
}
}
}