Skip to content

Instantly share code, notes, and snippets.

View joswr1ght's full-sized avatar

Joshua Wright joswr1ght

View GitHub Profile
@joswr1ght
joswr1ght / Dump-Clipboard.sh
Created January 27, 2020 13:20
Dump the clipboard contents on macOS
x=""; while true; do y=`pbpaste`; if [ "$x" != "$y" ] ; then echo $y; x=$y; fi; done
@joswr1ght
joswr1ght / linter.ps1
Created March 3, 2020 18:37
PowerShell Linter
docker run -v $PWD:/script -it mcr.microsoft.com/powershell pwsh -c "Install-Module PSScriptAnalyzer -Force; Invoke-ScriptAnalyzer -Path /script/scripts/openssh.ps1"
@joswr1ght
joswr1ght / compare-process-example.ps1
Created March 6, 2020 15:04
Comparing DLL List Before and After for a Process
# Start by changing to a temporary directory
PS C:\WINDOWS\system32> cd \temp
# Run the ps command to get a list of process information for a named process (in this case we use lsass)
# Pipe the output to Select-Object ModuleName to limit the output to just the DLLs
PS C:\temp> ps -Name lsass -Module | Select-Object ModuleName
ModuleName
----------
lsass.exe
ntdll.dll
@joswr1ght
joswr1ght / makejpg.sh
Created July 29, 2020 16:22
Convert one or more TIFF files in the current directory to resized JPGs
#!/bin/bash
if [ $? -eq 1 ] ; then
echo "Usage: $0 <save-dir> [long-edge-in-px]"
exit
fi
for image in *.tif; do
base=`echo $image | sed 's/.tif//'`
convert $image -resize "$2>" $1/$base-$1.jpg >>log 2>&1
echo -n "."
done
@joswr1ght
joswr1ght / checkhiddensvc.ps1
Last active January 11, 2025 06:49
Identify Hidden Windows Services
Compare-Object -ReferenceObject (Get-Service | Select-Object -ExpandProperty Name | % { $_ -replace "_[0-9a-f]{2,8}$" } ) -DifferenceObject (gci -path hklm:\system\currentcontrolset\services | % { $_.Name -Replace "HKEY_LOCAL_MACHINE\\","HKLM:\" } | ? { Get-ItemProperty -Path "$_" -name objectname -erroraction 'ignore' } | % { $_.substring(40) }) -PassThru | ?{$_.sideIndicator -eq "=>"}

HID/ProxCard Cheat Sheet

Joshua Wright | [email protected] | DRAFT/Work-in-Progress

Proxmark3 Iceman Edition Command Function
lf hid read Read from a nearby HID/ProxCard card
wiegand list Display a list of supported Wiegand data formats used by HID cards
lf hid sim -r 2006ec0c86 Simulate a HID/ProxCard with the Wiegand value 2006ec0c86; supply the appropriate Wiegand value for the card you wish to impersonate
lf hid sim -w H10301 --fc 118 --cn 16612 Simulate the card number 16612 with facility code 118 using the H10301 (26-bit HID) format (same as the command above but specifying the FC and CN explicitly)
@joswr1ght
joswr1ght / aws-iplist-filter-byregion.sh
Created December 22, 2020 13:23
Get AWS IP list, filtered by region
# This isn't so much of a script as it is a placeholder for something I don't want to forget
wget -qO- https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes[] | if .region == "us-east-1" then .ip_prefix else empty end' -r
@joswr1ght
joswr1ght / aws-us-east-1-iplist.sh
Created February 16, 2021 18:57
Get AWS IP Addresses for a Specified Area
wget -qO- https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes[] | if .region == "us-east-1" then .ip_prefix else empty end' -r | head -3
@joswr1ght
joswr1ght / targetnetworks.txt
Created February 18, 2021 12:12
A list of netblocks with CIDR masks (the AWS us-east-1 range as of 2/17/2021)
15.230.56.104/31
52.93.127.163/32
3.2.0.0/24
15.230.137.0/24
52.4.0.0/14
50.16.0.0/15
52.95.208.0/22
52.93.127.169/32
52.94.244.0/22
64.252.69.0/24
@joswr1ght
joswr1ght / countips.py
Last active February 9, 2024 18:23
Read a file of network + CIDR masks, one per line; count the number of IP addresses it represents
#!/usr/bin/env python
import sys
def countips(netblock):
cidr = int(netblock.split('/')[1])
return 2**(32 - cidr)
if (len(sys.argv) != 2):
print(f"Usage: {sys.argv[0]} <file with CIDR masks>")
sys.exit(0)