Skip to content

Instantly share code, notes, and snippets.

View jim80net's full-sized avatar

Jim Park jim80net

  • Scribd
  • San Francisco, CA
  • 11:01 (UTC -07:00)
  • X @jim80net
View GitHub Profile
@jim80net
jim80net / gist:8870533
Last active August 29, 2015 13:56
Class arbitrary instance attributes
def method_missing(sym, *args)
name = sym.to_s
if name[-1,1] == '='
instance_variable_set( "@#{name[0, name.size - 1]}", *args)
else
instance_variable_get("@#{name}")
end
end
@jim80net
jim80net / dnscheck.rb
Created February 18, 2014 16:39
Compare DNS output with a list of expected values
#!/usr/bin/env ruby
require 'awesome_print'
require 'pry'
require 'ostruct'
require 'resolv'
begin #top
puts "Reading worklist"
@jim80net
jim80net / gist:9253601
Created February 27, 2014 16:31
BINDIR for bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
from: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
@jim80net
jim80net / checksum.sh
Created February 27, 2014 16:38
BASH checksum
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CHECKSUM=`cat $DIR/.syncme.sh.md5sum | awk '{print $1}'`
MYCHECKSUM=`md5sum $DIR/syncme.sh | awk '{print $1}'`
if [[ "$CHECKSUM" != "$MYCHECKSUM" ]]
then
echo "This script was modified."
exit 2
else
@jim80net
jim80net / becareful.sh
Created March 11, 2014 06:00
dirty way to truncate deleted file handles
lsof | grep -i deleted | grep REG | grep -v txt | ruby -r 'pp' -e 'STDIN.each do |v| a = v.split(/ +/); puts `:> /proc/#{a[1]}/fd/#{a[3].chop}`; end'
@jim80net
jim80net / ssltest.py
Last active August 29, 2015 13:58 — forked from sh1n0b1/ssltest.py
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
# Based off of https://gist.github.com/sh1n0b1/10100394
import sys
import struct
import socket
import time
@jim80net
jim80net / logmein
Created June 20, 2014 19:36
expect script to login to a normal user account then elevate privileges using su with a known list of root passwords
#!/usr/bin/expect -f
# This script creates an interactive session on a remote server
# Example usage: logmein 192.168.1.11
# Arguments:
# ip_address = IP Address to connect to
# Process CL arguments - password must use lindex because lrange messes with password when special characters are escaped
set target [lindex $argv 0]
@jim80net
jim80net / reset_pass
Created June 24, 2014 17:08
Reset root passwords interactively using su -
#!/usr/bin/expect -f
# This script creates an interactive session on a remote server
# Example usage: logmein 192.168.1.11
# Arguments:
# ip_address = IP Address to connect to
# Process CL arguments - password must use lindex because lrange messes with password when special characters are escaped
set target [lindex $argv 0]
@jim80net
jim80net / gist:9c56d99c96f914871ca7
Created April 7, 2015 21:01
escape special chars
printf '%q ' $(cat temp)
@jim80net
jim80net / null.yml
Created August 12, 2015 23:36
an empty bosh release
---
name: "null"
director_uuid: 12345
releases: []
networks:
- name: default
type: dynamic