Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I'm not entirely sure.

Josh kernelsmith

💭
I'm not entirely sure.
View GitHub Profile
@kernelsmith
kernelsmith / the_pentaverate.txt
Created Aug 11, 2021
The Pentaverate - So, I Married an Axe Murderer
View the_pentaverate.txt
Well it's a well-known fact sonny jim that there's a secret society of the five
wealthiest people in the world known as...The Pentaverate, who run everything in
the world, including the newspapers, and meet tri-annually at a secret country
mansion in colorado known as...The Meadows. The Queen, the Vatican, the Gettys,
the Rothchilds and Colonel Sanders before he went teats up. Oh I hated the colonel
with his wee beedy eyes and that smug look on his face `ohh you're gonna buy my
chicken ohhh`
- Dad how can you hate the colonel?
Because he puts an addictive chemical in his chicken that makes you crave it
fortnightly smart-arse!
@kernelsmith
kernelsmith / strip_harder.rb
Created Aug 5, 2021
Ruby string encoding defaults to UTF-8, but String#strip doesn't alter its definition of whitespace to match the encoding, it's always defined as: '\x00\t\n\v\f\r '. This does not include unicode whitespace no matter the string's encoding, see Ruby Regexp Character Classes for more info. It would appear that [[:space:]] does in fact include unic…
View strip_harder.rb
# This was probably encountered and overcome a long time ago, but I ran into it in my own Ruby dealings and thought maybe it could be an issue elsewhere:
# Ruby string encoding defaults to UTF-8, but String#strip doesn't alter its
# definition of whitespace to match the encoding
# https://ruby-doc.org/core-2.6.8/String.html#method-i-strip
# String#strip removes lead/trail whitespace defined as: '\x00\t\n\v\f\r '
# null, horiz tab, line feed, vert tab, form feed, carriage return, & space
# This does not include unicode whitespace no matter the string's encoding,
# see Regexp for more info
# https://ruby-doc.org/core-2.6.8/Regexp.html#class-Regexp-label-Character+Classes
@kernelsmith
kernelsmith / radamsa_sleep.md
Created Feb 27, 2019
to get radamsa to wait on stdin before generating the next case
View radamsa_sleep.md

Find main.scm and replace

(sleeper)

with

((λ () (get-block stdin 1)))
@kernelsmith
kernelsmith / windows_scans.md
Created May 10, 2018
decreasingly dumb ways of doing windows host discovery
View windows_scans.md

Old ways of scanning for windows hosts

This is from an old presentation, I just wanted to record it somewhere. I'm not saying this stuff:

a) still works b) is a good idea c) hasn't been surpassed greatly in the last 7 years d) is completely accurate

hping & TTLs

@kernelsmith
kernelsmith / key_peele_east_west_names.rb
Created Apr 13, 2018
All the names, teams, schools, and East-West episode numbers for Key & Peele's East vs West skits...in ruby
View key_peele_east_west_names.rb
names = [
["D'Marcus Williums", "1", "east", "University of Georgia"],
["T.J. Juckson", "1", "east", "Wayne State University"],
["T'varisuness King", "1", "east", "Merrimack College"],
["Tyroil Smoochie-Wallace", "1", "east", "University of Miami"],
["D'Squarius Green, Jr.", "east", "University of Notre Dame"],
["Ibrahim Moizoos", "1", "east", "University of Tennessee at Chatanooga"],
["Jackmerius Tacktheritrix", "1", "east", "Michigan State University"],
["D'Isiah T. Billings-Clyde", "1", "east", "Coastal Carolina University"],
["D'Jasper Probincrux III", "1", "east", "South Carolina State University"],
@kernelsmith
kernelsmith / follow.sh
Last active Apr 5, 2017
follow a redirect at the command line
View follow.sh
curl -s -I $url | grep \^Location: | cut -d ':' -f 2-
# I had a longer version that continued following redirects up to a limit, but
# can't find it atm
# if you'd like to do the above anonymously, you can use https://hurl.it and
# change the HTTP method from GET to HEAD and paste in your URL (assuming HEAD
# is supported by the webserver). In the response you'll see the
# Location: HTTP header w/the redirected URL (assuming nominal situation).
@kernelsmith
kernelsmith / gpgme_basic_usage.md
Last active May 10, 2016
Basic GPGME ruby gem usage
View gpgme_basic_usage.md

Basic GPGME Ruby Gem Usage

I just found this API ridiculously confusing to use, and maybe I just suck, but I don't want to figure it out again, so I'm writing it down here

Establish a gpg home dir if desired

Optional, but if you have an established gpg home dir that you want to use or you don't want it chosen for you

GPGME::Engine.home_dir = "/some/dir" # e.g. env['GNUPG_HOME']
@kernelsmith
kernelsmith / vmware_problems.md
Last active Jan 14, 2016
vmware tools problems such as mounting shares and kernel patches
View vmware_problems.md

Restart vmware tools services

  • restart the services so you can see if any fail

sudo /etc/vmware-tools/services.sh restart

  • if failure, you can optionally check which services are actually still running

sudo /etc/vmware-tools/services.sh status

  • but you'll want to rerun the vmware config script which will recompile kernel mods
@kernelsmith
kernelsmith / set_datetime_and_zone.sh
Last active Jan 14, 2016
easily set ubuntu system date/time and timezone
View set_datetime_and_zone.sh
#!/bin/sh
# change this value to suit you, see below for further guidance
DESIRED_TIME_ZONE="US/Central"
# Note, if you were to get this value from an argument etc, keep
# in mind it would be vulnerable to command injection
# get timezone values from `ls /usr/share/zoneinfo` if you need them
# for example, you can see there's a /usr/share/zoneinfo/US/Central and
# /usr/share/zoneinfo/America/Chicago etc
View easy_shell_proxy.sh
#
# Functions used to change or display the proxy state
#
# usually it's all the same host, but you could add more host vars if needed
_PROXY_HOST="proxy.company.com"
_HPROXY_PORT="8080"
_HSPROXY_PORT="8080"
_SPROXY_PORT="1080" # this is usually different than http/s
# comma separated (no spaces) list of hosts/ip ranges(cidr) to not proxy