Skip to content

Instantly share code, notes, and snippets.

View greencm's full-sized avatar

Chris Green greencm

View GitHub Profile
@greencm
greencm / installdate.bat
Created December 26, 2013 21:02
Find windows system install date
systeminfo|find /i "original"
@greencm
greencm / nfdumpexport.py
Created November 19, 2013 16:20
nfdump exports, then exported into splunk. Let's you search for IPs with the index problems of netflow.
#!/usr/local/python2.7.2/bin/python
# $Id$
# Author: <[email protected]>
# Purpose: Run nfdump for flow exports so searches happen in splunk for atleast the IP hit
# Created: Wed Aug 28 08:50:27 CDT 2013
import sys
import unittest
import argparse
import subprocess, datetime
@greencm
greencm / googleblocks.sh
Created October 30, 2013 15:42
Display current google IPv4 Netblocks
dig -t txt _netblocks.google.com | grep spf | perl -nle 'split; for(@_) { if ($_ =~ m/^ip4/) { print substr($_,4); } }'
@greencm
greencm / ips2bpf.py
Created July 5, 2013 15:25
Take a list of IPs and turn into a BPF filter
#!/usr/bin/python
# convert a list of IPs to an OR bpf filter
import sys
if len(sys.argv) == 2 and sys.argv[1] != '-':
f = open(sys.argv[1])
else:
f = sys.stdin
ips = [s.strip() for s in f.readlines()]
bpf = "( host " + " or host ".join(ips) + ")"
@greencm
greencm / gist:5902893
Created July 1, 2013 17:36
Use nfdump in parallel to look for specific ip address
find dirname -type f | parallel 'nfdump -r {} "host $ip"' | tee /tmp/out.txt
@greencm
greencm / mbox-count.py
Created June 28, 2013 20:24
Count the number of messages in an mbox file
#!/usr/bin/env python
# $Id$
# Author: <[email protected]>
# Purpose: Count the number of mails in an mbox file
# Created: Fri Jun 28 10:39:13 CDT 2013
import sys
from mailbox import mbox
import re
@greencm
greencm / excel.sh
Created June 26, 2013 18:29
Execute excel 2010 against a cygwin page. e.g. excel.sh foo.csv &
#!/bin/bash
exec /cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Office/Office14/EXCEL.EXE `cygpath -w $1`