Skip to content

Instantly share code, notes, and snippets.

View goodtune's full-sized avatar

Gary Reynolds goodtune

  • Touch Technology
  • Central Coast, Australia
View GitHub Profile
@goodtune
goodtune / google-apps-login-audit.py
Created November 18, 2015 03:00
Using an export from Google Apps Audit, perform a GeoIP lookup and extend the CSV file
#!/usr/bin/env python
import csv
import re
import sys
import requests
API = 'http://api.geoiplookup.net/?query=%s'
@goodtune
goodtune / README.md
Last active January 10, 2017 06:05
Webifier validation script

webifier

Script to test if sites are visible to users on the open internet.

If they are, the don't need to be "webified" to be sent through FirePass device.

Dependencies

The script depends on the requests library to perform HTTP tests.

@goodtune
goodtune / README.md
Last active August 29, 2015 14:25
Test LDAP asynchronous API, executing abandon on timeout

abandon.py

Test the abandon LDAP API.

Usage

The utility is controlled by command line switches.

python abandon.py -h
#!/usr/bin/env python
import httplib
import sys
headers = {
'Cookie': 'iPlanetDirectoryPro=%s' % sys.argv[1],
}
try:
@goodtune
goodtune / sslinfo
Created August 27, 2014 20:55
Read pertinent certificate information from a remote host.
#!/bin/bash
# Based on recipe obtained from
# http://www.shellhacks.com/en/HowTo-Check-SSL-Certificate-Expiration-Date-from-the-Linux-Shell
# Usage: sslinfo <host> [<port:443>]
echo | \
openssl s_client -connect ${1}:${2:-443} 2>/dev/null | \

Keybase proof

I hereby claim:

  • I am goodtune on github.
  • I am goodtune (https://keybase.io/goodtune) on keybase.
  • I have a public key whose fingerprint is E3CF CA45 A599 B83D ADCE 9D6A 4F80 AD25 CBFA 890B

To claim this, I am signing this object:

@goodtune
goodtune / spacejam.py
Last active December 26, 2015 07:59
Inspired by this blog post - http://thecodeship.com/algorithms/exercise-alien-language-pattern-matching/ - I decided to give it a go and came up with the following solution.
import string
import sys
import re
tr = string.maketrans("()", "[]")
L, D, N = map(int, re.findall('\d+', sys.stdin.readline()))
words = map(sys.stdin.readline, D * [L + 1])
tests = sys.stdin.readlines()
@goodtune
goodtune / mevi.py
Last active December 25, 2015 17:59
#!/usr/bin/env python
"""
Script to generate a bunch of bogus user creations using the
MEVI creation interface.
See documentation for fake-factory, which is doing the bulk
of the work.
https://pypi.python.org/pypi/fake-factory/0.2
"""
@goodtune
goodtune / gist:6236476
Created August 14, 2013 22:48
parse an ssl certificate distinguished name
import re
dn_re = re.compile(r'(?:/)(.+?)(?:=)([^/]+)')
DN = "/C=AU/ST=NSW/L=Avoca Beach/O=Touch Technology Pty Ltd/CN=touchtechnology.com.au/emailAddress=support@touchtechnology.com.au"
def parse_dn(dn):
return dict(dn_re.findall(dn))
print parse_dn(DN)
@goodtune
goodtune / ldif2csv.py
Created August 24, 2012 06:32
Script to convert LDIF input to CSV output - reads from stdin, writes to stdout
import csv
import ldif
import sys
def flatten(d, bar='|'):
"""
Take a regular dictionary, and flatten the value if it's a list.
"""
diff = {}