Skip to content

Instantly share code, notes, and snippets.

View todb-r7's full-sized avatar

Tod Beardsley todb-r7

View GitHub Profile
@todb-r7
todb-r7 / empty_checks.rb
Created December 27, 2011 15:31
All usages of :empty? in Metasploit: grep -r -A3 "\.empty?" .
--
./msfencode: if(ext and not ext.empty?)
./msfencode- fmt = ext
./msfencode- end
./msfencode-end
--
./plugins/nexpose.rb: if(args.length == 0 or args[0].empty? or args[0] == "-h")
./plugins/nexpose.rb- print_status("Usage: ")
./plugins/nexpose.rb- print_status(" nexpose_connect username:password@host[:port] <ssl-confirm>")
./plugins/nexpose.rb- print_status(" -OR- ")
@todb-r7
todb-r7 / .gitconfig
Created March 2, 2012 19:14
Running arbitrary commands in git aliases to list names of changed files on a pull -r
[alias]
thisbranch = !"git branch --no-color | sed -e '/^[^*]/d' -e 's/* //' "
pull-names = !"git fetch && \
echo 'Checking for diffs...' && \
git diff --name-only origin/`git thisbranch` && \
git pull -r origin `git thisbranch`"
@todb-r7
todb-r7 / metasploit-for-everyone.txt
Created March 20, 2012 02:26
Very short version of setting up a personal fork of Metasploit
This is what I did. It seems to work nicely.
This doc needs to be wikified.
Step zero: Set up your ssh config.
In ~/.ssh/config, add:
Host github_r7
Hostname github.com
User git
@todb-r7
todb-r7 / git-add-remote.sh
Created March 23, 2012 16:39
bash script to add a remote branch of Metasploit
function git-add-remote {
git remote add $1 git://github.com/$1/metasploit-framework
git fetch $1
git branch --track $1 $1/master
}
@todb-r7
todb-r7 / console-screen.txt
Created March 28, 2012 17:00
Proxy patch busts all of http
=[ metasploit v4.3.0-dev [core:4.3 api:1.0]
+ -- --=[ 819 exploits - 461 auxiliary - 144 post
+ -- --=[ 249 payloads - 27 encoders - 8 nops
msf > use auxiliary/scanner/http/crawler
msf auxiliary(crawler) > show options
Module options (auxiliary/scanner/http/crawler):
Name Current Setting Required Description
@todb-r7
todb-r7 / yaml-example.rb
Created April 15, 2012 21:26
Ruby 1.9.3 standard YAML makes me a sad panda
1.9.3p125 :004 > YAML::VERSION
=> "1.2.2"
1.9.3p125 :005 > a = "foo"
=> "foo"
1.9.3p125 :007 > a.force_encoding("BINARY")
=> "foo"
1.9.3p125 :008 > a.encoding
=> #<Encoding:ASCII-8BIT>
1.9.3p125 :009 > YAML.dump(a)
=> "--- !binary |-\n Zm9v\n"
@todb-r7
todb-r7 / all_cats_are_grey.sh
Created May 14, 2012 21:41
All cats are grey
# Stick in your .bash_aliases to uncolor your Rails logs. Note that ^[ is really (Ctrl-V) + (ESC)
function all_cats_are_grey {
cat $1 | sed 's/^[\[[0-9;]*m//g'
}
@todb-r7
todb-r7 / debug-notes.txt
Created May 17, 2012 19:29
Troubleshooting some rails memory leak
The problem: the first seven hosts of the poisoned nmap file gets you to 10.3 to 10.5% mem usage (for 8gb memory) from the sample file.
The first order of business is to get a sample file to be usable for test cases without actually crashing ruby, and to make the host info more useful for debugging (sequential IPs, fake target domain and names, basic attempts at anonymizing the real data).
top - 10:51:26 up 59 min, 7 users, load average: 0.46, 0.57, 0.47
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.8%us, 4.0%sy, 0.0%ni, 92.1%id, 0.0%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 8161728k total, 3880048k used, 4281680k free, 341184k buffers
Swap: 9535480k total, 0k used, 9535480k free, 1092928k cached
@todb-r7
todb-r7 / pulls.sh
Created May 31, 2012 19:48
How I land pull requests
git checkout master
git pull -r
git checkout $remote/$branch
git rebase master # Ensure it'll merge cleanly
git checkout -b Pull$number
git diff master # Eyeball the diff locally.
git log -1 | grep Author
git checkout master
git merge --squash Pull432 # Wrap it up into one commit.
git commit --author="$author_name_and_email" # Give author credit.
@todb-r7
todb-r7 / .bash_aliases
Created September 26, 2012 14:21
git-add-remote
function git-add-remote {
git remote add -f $1 git://github.com/$1/metasploit-framework
git branch --track $1-master $1/master
}