Skip to content

Instantly share code, notes, and snippets.

View craSH's full-sized avatar

Ian Gallagher craSH

View GitHub Profile
@craSH
craSH / splitm3u.py
Last active December 14, 2015 15:49
Add support for creating pls format playlists in addition to m3u
#!/usr/bin/env python
"""
Tiny script to split M3U playlist entries from stdin out to multiple playlists.
Handy for iTunes, because it's stupid in how it imports playlists.
Copyleft 2011 Ian Gallagher <[email protected]>
"""
import sys, os
def do_stdin():
pls = False
@craSH
craSH / aes_ctr-chosen_plaintext.py
Created June 22, 2012 01:18
Simple chosen-plaintext attack on AES-CTR given NONCE and IV re-use for multiple ciphertexts. Basically just a OTP chosen-plaintext attack implementation.
#!/usr/bin/env python
"""
Simple chosen-plaintext attack on AES-CTR given NONCE and IV re-use for
multiple ciphertexts
Copyleft 2011 Ian Gallagher <[email protected]>
"""
import sys
def decrypt(keystream, ciphertext):
@craSH
craSH / pbkdf2.java
Created June 15, 2012 19:35
Java PBKDF2 method + string wrapper, relies on some external methods for converting to hex strings.
public String hashPassword(String password, String salt) throws Exception
/*
* Wrap pbkdf2 method to return password hash as a hex string
*/
{
// Bail if password or salt are null/0 length
if ((null == password || 0 == password.length()) || (null == salt || 0 == salt.length()))
throw new Exception("Failed to create PBKDF2 Hash for password, password or salt can not be empty");
// Result string
@craSH
craSH / gpg_bruteforce.py
Created May 24, 2011 20:09
Determine password for a PGP private key based on a wordlist.
#!/usr/bin/env python
"""
Determine password for a PGP private key based on a wordlist.
Also performs permutations on passwords in the case of l33tsp3ak, etc.
Requires python-gnupg (easy_install/pip install python-gnupg)
To quiet down some of the exceptions during signing attempts, the following
"patch" is needed within gnupg.py:
@craSH
craSH / har_response_urls.py
Created March 29, 2011 14:49
Parse a HAR (HTTP Archive) and return URLs which resulted in a given HTTP response code
#!/usr/bin/env python
"""
Parse a HAR (HTTP Archive) and return URLs which resulted in a given HTTP response code
HAR Spec: http://groups.google.com/group/http-archive-specification/web/har-1-2-spec
Copyleft 2010 Ian Gallagher <[email protected]>
Example usage: ./har_response_urls.py foo.har 404
"""
import json
@craSH
craSH / threaded_urlretrieve.py
Created March 19, 2011 10:11
A few functions that serve to download files in a threaded manner. Uses Python's multiprocessing module.
#!/usr/bin/env python
"""
A few functions that serve to download files in a threaded manner.
Essentially a map() which is threadded, with a URL fetching function
Copyleft 2010 Ian Gallagher <[email protected]>
"""
import os, sys, urllib
import socket
@craSH
craSH / gpg.conf
Created October 19, 2010 02:47
gnupg "strong" configuration
personal-digest-preferences SHA512 SHA384 SHA256 SHA224 SHA1 RIPEMD160 MD5
personal-cipher-preferences AES256 TWOFISH BLOWFISH AES192 AES CAMELLIA256 CAMELLIA192 CAMELLIA128 3DES CAST5
keyserver hkp://subkeys.pgp.net
keyserver hkp://pgp.mit.edu
keyserver-options auto-key-retrieve
use-agent
# .gitignore for .NET projects
# Thanks to Derick Bailey
# http://www.lostechies.com/blogs/derickbailey/archive/2009/05/18/a-net-c-developer-s-gitignore-file.aspx
# Additional Thanks to
# - Alexey Abramov
# Standard VS.NET and ReSharper Foo
obj
bin
*.csproj.user
#!/usr/bin/env python
## Attempts to get a domain transfer from the nameservers for the given domain
## Requires dnspython http://www.dnspython.org/
import sys, socket
from dns import resolver, rdatatype, query
import dns.exception
def do_axfr(nameserver, domain):
print "Querying %s" % (nameserver,)
@craSH
craSH / ssl_info
Created June 30, 2010 21:46
Fingerprint and list supported SSL Ciphersuites on a given host/port
#!/bin/bash
#
# Check a given host/port for supported SSL/TLS cipher suites.
# If nmap is available, do a service fingerprint on it as well
#
# This requires that you have "sslciphercheck", available here:
# http://www.pvv.ntnu.no/~josteitv/papers/ssl_vuln_code.tar.gz
#
# Usage: ssl_info <host> <port>
#