Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am matterpreter on github.
  • I am matterpreter (https://keybase.io/matterpreter) on keybase.
  • I have a public key ASBpyi7rGq-uzLP9xeGttxt0c2ZnQh1EOkXjKv6lQm3eWgo

To claim this, I am signing this object:

@matterpreter
matterpreter / GrantTokenPrivileges.cs
Created September 14, 2019 12:43
Grant the current process token the specified privilege
using System;
using System.Runtime.InteropServices;
public static void SetTokenPrivilege(ref IntPtr hToken, string privName)
{
Console.WriteLine("[*] Adding {0} to token", privName);
LUID luid = new LUID();
if (!LookupPrivilegeValue(null, privName, ref luid))
{
Console.WriteLine("[-] LookupPrivilegeValue failed!");
@matterpreter
matterpreter / IsAdmin.cs
Last active March 15, 2022 20:52
Check if user is a member of the local admins group
public static bool IsAdmin()
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
if (!principal.IsInRole(WindowsBuiltInRole.Administrator))
{
return false;
}
else
{
@matterpreter
matterpreter / criticalProc.cs
Created June 24, 2019 18:08
Set process to be critical
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace UnkillableTest
{
class Program
{
[DllImport("ntdll.dll", SetLastError = true)]
private static extern void RtlSetProcessIsCritical(uint bNew, uint pbOld, uint bNeedScb);
@matterpreter
matterpreter / hashmash-py3.py
Last active April 19, 2019 15:43
Port of hashmash to support Python3
#!/usr/bin/env python3
import sys
def usage():
print('HashMash - decrypted password to username matcher')
print('')
print('$ python3 %s <Hash File> <OCL Hashcat Decrypted File>' % sys.argv[0])
print('')
print('User Hash File format is user:hash (or JTR NTLM)')
print('OCL Decrypted Pasword File format is, hash:password')
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Management;
namespace ComAbandonment
{
public class ComAbandonment
{
@matterpreter
matterpreter / build-tao.sh
Last active September 14, 2019 12:44
Build tao-utils to use on Ubuntu for decoding IORs
#!/bin/bash
sudo apt install -y libace-6.3.3 libc6 libgcc1 libstdc++6 libtao-2.0.1 liblzo2-2 zlib1g libssl1.0.0
mkdir debs && cd debs
#Pull all the required packages from Launchpad for Ubunutu
wget -nv http://launchpadlibrarian.net/74750902/libace-6.0.1_6.0.1-3_amd64.deb
wget -nv http://launchpadlibrarian.net/74750904/libace-ssl-6.0.1_6.0.1-3_amd64.deb
wget -nv http://launchpadlibrarian.net/74750910/libace-htbp-6.0.1_6.0.1-3_amd64.deb
wget -nv http://launchpadlibrarian.net/74750917/libacexml-6.0.1_6.0.1-3_amd64.deb
wget -nv http://launchpadlibrarian.net/74750919/libkokyu-6.0.1_6.0.1-3_amd64.deb