Skip to content

Instantly share code, notes, and snippets.

View joswr1ght's full-sized avatar

Joshua Wright joswr1ght

View GitHub Profile
@joswr1ght
joswr1ght / searchpackage.py
Created August 2, 2023 11:24
Search Ranges.io Package for Keyword, Display Matching Group and Short Title
View searchpackage.py
#!/usr/bin/env python3
import json
import sys
if (len(sys.argv) != 3):
sys.stderr.write('Search RIO Package for string, identify matching group'
' and short title\n')
sys.stderr.write(f'Usage: {sys.argv[0]} package_export.json "keyword"\n')
sys.exit(0)
@joswr1ght
joswr1ght / lm2ntcrack.py
Created June 8, 2023 19:55
Using a NT hash and a cracked LANMAN password, brute-force all possible capitalization permutations to find the correct NT hash password
View lm2ntcrack.py
#!/usr/bin/env python3
# Most of this code is from @clr2of8's Domain Password Audit Tool:
# https://github.com/clr2of8/DPAT
import hashlib
import os
import sys
import textwrap
def wrap(body):
@joswr1ght
joswr1ght / Copy-RemoteWindowsEventLogs.ps1
Last active May 31, 2023 02:55
PowerShell script to copy event logs from one or more remote systems to the local file system
View Copy-RemoteWindowsEventLogs.ps1
# https://chat.openai.com/share/6d96527b-288d-45a9-8eb4-e8b43d52486a
# Input parameters
param (
[Parameter(Mandatory=$true)]
[string]$inputFile,
[Parameter(Mandatory=$true)]
[System.Management.Automation.PSCredential]$Credential
)
@joswr1ght
joswr1ght / summarizelinks.js
Created April 22, 2023 18:22
summarizelinks.js - JavaScript to get a summary of links from an open webpage using the browser inspector console
View summarizelinks.js
@joswr1ght
joswr1ght / debugrequests.py
Created January 4, 2023 13:58
Add this code to Python scripts to debug HTTP requests activity and see request/response data
View debugrequests.py
import logging
import requests
import http.client
http.client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
@joswr1ght
joswr1ght / apacheanon.py
Created November 16, 2022 11:10
Consistently replace the IP addresses in the first column of a log file with a random IP
View apacheanon.py
#!/usr/bin/env python3
# Anonymize the first column (delimited by space) IPv4 address in an ASCII file with a
# consistent IP address that excludes RFC1918 and other internal network IP addresses.
# You can use this to take an Apache (or Nginx or probably other log files as well) file
# and change each of the source IP addresses to another value that is preserved consistently
# throughout the output log file.
# Changes to the log file are written to STDOUT, so run this as
# `apacheanon.py access.log > new-access.log`.
#
# 2022-11-16 Joshua Wright
@joswr1ght
joswr1ght / profile.ps1
Created November 12, 2022 12:24
Add newline to PowerShell prompt between present directory and the PS > indicator
View profile.ps1
function prompt {
"$pwd`nPS > "
}
@joswr1ght
joswr1ght / awsUserPrivs.sh
Created October 1, 2022 12:14
Enumerate AWS User/Identity Privileges with AWS CLI and Bash
View awsUserPrivs.sh
#!/bin/bash
# https://stackoverflow.com/a/69728383/5089189 CC-BY-SA 4.0
function getUserIamPermissions() {
export AWS_PAGER="";
local _user="${1}";
local outputManagedPolicies="";
local outputUserPolicies="";
local outputManagedGroupPolicies="";
@joswr1ght
joswr1ght / asciidoctor-vimrc
Created September 9, 2022 14:47
VIM settings for Asciidoctor ease-of-use and quality-of-life
View asciidoctor-vimrc
" Insert the template file for an Asciidoc listing. This file is essentially
" this text:
" .Caption
" [[listing-]]
" [subs="+quotes,+replacements"]
" ----
"
" ----
" Customize the file and the file path as needed.
function! InsertAsciidocListing()
@joswr1ght
joswr1ght / nmap-top-tcpport-commadsep-list.sh
Created July 24, 2022 12:23
Create a list of top Nmap TCP ports, converted to comma-separated format
View nmap-top-tcpport-commadsep-list.sh
grep -v '^#' /usr/local/Cellar/nmap/7.92/share/nmap/nmap-services | grep '/tcp' | sort -r -k3 | awk '{print $2}' | sed 's,/tcp,,' | head -40 | sort -n | gsed -z 's/\n/,/g;s/,$/\n/'