Skip to content

Instantly share code, notes, and snippets.

View craSH's full-sized avatar

Ian Gallagher craSH

View GitHub Profile
@craSH
craSH / pkcs12_dictionary_attack.py
Created April 16, 2014 00:42
Quick single-threaded script to perform a dictionary attack on a PKCS12/PFX password encrypted certificate bundle
#!/usr/bin/env python
"""
Copyleft 2014 Ian Gallagher <crash@neg9.org>
"""
import sys, os
import OpenSSL
def p12_load(p12_path, passwd):
# open PKCS12/PFX file, using password.
p12 = OpenSSL.crypto.load_pkcs12(file(p12_path, 'rb').read(), passwd)
###########################################################
# This srcipt will simply produce expressions to be #
# used with config.py #
# - Disclaimer - I'm not responsible for how you use this #
# this was created for personal usage and for educational #
# purposes #
# CopyLeft Jason Tsang Mui Chung (tsangtmc@gmail.com) #
###########################################################
brute_list = raw_input("Enter the string you would like to generate a expression for:")
length = len(brute_list)
@craSH
craSH / keybase.md
Last active August 29, 2015 14:02
I have updated my PGP key, and am updating my keybase proof.

Keybase proof

I hereby claim:

  • I am crash on github.
  • I am crash (https://keybase.io/crash) on keybase.
  • I have a public key whose fingerprint is F887 3E31 2041 DF5E A3E6 2D3F AFD0 1F0B 7F26 52C4

To claim this, I am signing this object:

@craSH
craSH / natstrings.py
Last active August 29, 2015 14:19
Like strings(1) but only return stuff that is probably english (or whatever locale you set)
#!/usr/bin/env python
"""
Like strings(1) but only return stuff that is probably English (or whatever locale you set)
TODO:
* Add a parameter to ignore punctuation as token counts towards the threshold.
e.g. "Foo." vs "Foo........" would both return true.
* Add conditional for not counting digit only results if alphanumeric=True in is_natlang()
* Unicode support - currently it doesn't work with unicode, quite bad for non-english input
@craSH
craSH / indexcode
Last active August 29, 2015 14:22
Index code with glimpse, ctags, and cscope. Store the indexes and such in a defined cache directory, which may live on a fast SSD
#!/usr/bin/env bash
# Original credit to tecknicaltom@neg9.org for creating this script and concept - thanks!
# Store indexes and such in a cache located on an SSD, and symlink to them
# Ensure the cache location is at the same or better security level (encrypted drive) as the data you are indexing.
cache_root="${HOME}/.indexcodecache"
cur_proj="$(basename -a ${PWD} | tr -d '\n')-$(echo ${PWD} | shasum -a 512 | cut -c 1-16)"
cache_dir="${cache_root}/${cur_proj}"
# Set umask to create files as mode 0600 (user r/w, go none)
@craSH
craSH / extract_offsets.py
Created September 3, 2015 21:17
Extract chunks between chunk sizes at a given list of offsets. Handy when combined with the output of hachoir-subfile for ELF images in a filesystem, for example.
#!/usr/bin/env python
"""
Extract chunks between chunk sizes at a given list of offsets.
Handy when combined with the output of hachoir-subfile for ELF images in a filesystem, for example.
Copyleft 2015 Ian Gallagher <crash@neg9.org>
"""
import sys
import os
import logging
@craSH
craSH / updatechromiumnightly
Created November 17, 2009 02:16
Simple script to automatically download and install the latest available Chromium nightly build for Mac OSX
#!/bin/bash
#
# Simple script to update OSX Chromium to the latest nightly build.
# Will not download if you already have the latest (call with --force
# to override this check)
#
# Copyleft 2010 Ian Gallagher <crash@neg9.org>
#
LATEST=$(curl -s "http://build.chromium.org/f/chromium/snapshots/Mac/LATEST")
@craSH
craSH / SkypeDial.scpt
Created November 17, 2009 22:08
AppleScript plugin for Address Book to add a Dial with Skype menu item to phone numbers. Place in ~/Library/Address Book Plug-Ins/
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for p with e
if label of e is equal to "Skype" then
return "Call Skype Name"
else
@craSH
craSH / backup_wordpress
Created December 21, 2009 19:12
A very simple script to save differential backups of a wordpress installation directory and it's database. Should be easy enough to adapt to other needs.
#!/bin/bash
# You must init a git repo in $backup_root for this to work
# You must also have a remote repo added per $git_remote
# It's assumed that you have your remote git host configured
# via ~/.ssh/config or something for automatic login with a key
# Local stuff
wwwroot="/var/www/your-blog/" # Trailing slash is important (for rsync)
db_name="blog_db"
db_user="blog_user"
@craSH
craSH / chowntoparent
Created January 20, 2010 20:02
Simple script that will set the ownership of a file to that of the directory in which it resides.
#!/bin/bash
#
# Simple script that will set the ownership of a file to that
# of the directory in which it resides. Useful for example,
# after copying a file from /home/user_alpha/ to /home/user_bravo/
# and you want it to have user_bravo's uid/gid so they can
# access it.
#
# This script is pretty naive, it would most certainly fail
# if a filename had a forward slash in it somehow.