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
HarmJ0y / Get-NonstandardService.ps1
Created June 7, 2017 01:11
Get-NonstandardService
function Get-NonstandardService {
<#
.SYNOPSIS
Returns services where the associated binaries are either not signed, or are
signed by an issuer not matching 'Microsoft'.
Author: Will Schroeder (@harmj0y)
License: BSD 3-Clause
Required Dependencies: None
@HarmJ0y
HarmJ0y / powershell_talks.txt
Created February 14, 2017 13:20
PowerShell talks
BSides LV 2015 - "Building an Empire with PowerShell" - https://www.youtube.com/watch?v=Pq9t59w0mUI
BSides DC 2015 - "Bridging the Gap: Lessons in Adversarial Tradecraft" - https://www.youtube.com/watch?v=xHkRhRo3l8o
BSides DC 2015 - "** It, Do it Live (PowerShell Digital Forensics)" - https://www.youtube.com/watch?v=RcDq9GgiUB4
PowerShell Summit 2016 - "Digital Forensics with PowerShell" - https://www.youtube.com/watch?v=gm9A7FaWTkY
BSides LV 2016 - "Building an EmPyre with Python" - https://www.youtube.com/watch?v=79qzgVTP3Yc
DerbyCon 2016 - "A Year in the Empire" - https://www.youtube.com/watch?v=ngvHshHCt_8
@HarmJ0y
HarmJ0y / ConvertFrom-UserParameter.ps1
Last active January 30, 2023 11:54
ConvertFrom-UserParameter.ps1
function ConvertFrom-UserParameter {
<#
.SYNOPSIS
Converts a userparameters encoded blob into an ordered dictionary of decoded values.
Author: Will Schroeder (@harmj0y)
License: BSD 3-Clause
Required Dependencies: None
@HarmJ0y
HarmJ0y / 44con_demo.ps1
Created September 17, 2016 21:00
Demo for the 44con "Trusts You Might Have Missed" presentation
# import PowerView and Invoke-Mimikatz
Import-Module .\powerview.ps1
Import-Module .\mimikatz.ps1
# map all reachable domain trusts
Invoke-MapDomainTrust
# enumerate groups with 'foreign' users users, and convert the foreign principal SIDs to names
Find-ForeignGroup -Domain external.local
Find-ForeignGroup -Domain external.local | Select-Object -ExpandProperty UserName | Convert-SidToName
@HarmJ0y
HarmJ0y / EncryptedStoreTests.ps1
Created August 31, 2016 22:28
Encrypted Store Tests
$RSA = New-RSAKeyPair
# local tests
$ComputerName = 'localhost'
$StorePath = 'C:\Temp\temp.bin'
Write-Host "`n[$ComputerName] AES Storepath : $StorePath"
".\secret.txt" | Write-EncryptedStore -StorePath $StorePath -Key 'Password123!'
Read-EncryptedStore -StorePath $StorePath -Key 'Password123!' -List
Get-EncryptedStoreData -StorePath $StorePath | Remove-EncryptedStore
@HarmJ0y
HarmJ0y / rotate.ps1
Last active August 31, 2022 17:20
PowerShell binary rotate right/left on individual bytes
function Rotate-Byte {
<#
.SYNOPSIS
Performs left/right binary rotation on individual bytes.
Author: @harmj0y
.DESCRIPTION
Implements the logic to perform per-byte binary rotates right and left.
@HarmJ0y
HarmJ0y / KeeThief.markdown
Last active March 20, 2020 19:43
KeeThief clarification points

A few clarification points for the "KeeThief – A Case Study in Attacking KeePass Part 2" post:

  1. KeeThief doesn't require local administrator rights, only rights to access the KeePass.exe process space you're targeting.

  2. KeeThief.ps1 is fully-self self-contained (no dependencies and no files dropped to disk) and PowerShell Version 2 compliant (so it will work on Windows 7+).

  3. Secure desktop doesn't matter/come into play as a keylogger isn't used or needed.

  4. This approach is different from KeeFarce - KeeThief recovers the plaintext master password and other key material from memory instead of calling internal methods to export the database contents.

@HarmJ0y
HarmJ0y / LNKBackdoor.ps1
Created July 4, 2016 20:49
Functions to 'backdoor' .LNK files with additional functionality and enumerate all 'backdoored' .LNKs on a system.
function Set-LNKBackdoor {
<#
.SYNOPSIS
Backdoors an existing .LNK shortcut to trigger the original binary and a payload specified by
-ScriptBlock or -Command.
Author: @harmj0y
License: BSD 3-Clause
Required Dependencies: None
@HarmJ0y
HarmJ0y / Find-KeePassconfig.ps1
Created July 4, 2016 20:47
Finds and parses any KeePass.config.xml (2.X) and KeePass.ini (1.X) files.
function Find-KeePassconfig {
<#
.SYNOPSIS
Finds and parses any KeePass.config.xml (2.X) and KeePass.ini (1.X) files.
Author: @harmj0y
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None
@HarmJ0y
HarmJ0y / Restore-UserDPAPI.ps1
Last active July 7, 2023 09:05
Restore a user's stolen DPAPI master key folder and optional KeePass DPAPI data blob.
function Restore-UserDPAPI {
<#
.SYNOPSIS
Restores a user account's DPAPI master key on a new system.
Author: @harmj0y
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None