Skip to content

Instantly share code, notes, and snippets.

@swdunlop
swdunlop / get-url-methods.py
Created April 13, 2011 02:28
A five line AndBug script that lists the methods associated with java.net.URL in an Android process (via adb forward).
from andbug.process import Process
p = Process()
p.connect(9012)
for m in p.classes(cn).methods(name='Ljava/net/URL;'):
print m.name, m.jni
@swdunlop
swdunlop / mp3collect.go
Created January 31, 2011 23:29
a simple utility to hardlink mp3 files to a hash of their non-ID3 contents
package main
import "io"
import "os"
import "fmt"
import "encoding/hex"
import "crypto/sha256"
import "path"
import "strings"
@swdunlop
swdunlop / array2d.go
Created January 8, 2011 09:03
2d array of variable size
package main
import "fmt"
func main() {
m, n := 3, 3
a := make( [][]int, m )
for i, _ := range a {
a[i] = make( []int, n )
}
@swdunlop
swdunlop / readarray.go
Created January 8, 2011 08:21
example of how to read an array in go
package main
import "fmt"
type row [3]int
type grid [3]row
func main() {
var g grid
for _, r := range g {
for i := 0; i < len( r ); i ++ {
@swdunlop
swdunlop / Makefile
Created January 8, 2011 05:48
A fuzzer for Go structures that uses reflection to identify and alter fields.
GOROOT ?= /opt/go
include $(GOROOT)/src/Make.inc
TARG=blur
GOFILES=blur.go
include $(GOROOT)/src/Make.pkg
@swdunlop
swdunlop / decode_rb.go
Created December 29, 2010 06:08
Decodes a binary blob encoded by Ruby's "marshal" module.
// Copyright (C) 2010, Scott W. Dunlop <swdunlop at gmail.com>
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
@swdunlop
swdunlop / wall.go
Created December 27, 2010 23:56
A message wall written in Go that uses Redis Publish and Subscribe to create a persistent real-time message service.
// Copyright (C) 2010, Scott W. Dunlop <swdunlop at gmail.com>
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
@swdunlop
swdunlop / fuzzex.py
Created December 21, 2010 11:08
Random string generator using regex-like expressions
#!/usr/bin/env python
# Copyright (C) 2010, Scott W. Dunlop <swdunlop at gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
@swdunlop
swdunlop / ply_clike.py
Created November 15, 2010 01:40
Example use of Python and Ply to lexically analyze C files for identifiers.
#!/usr/bin/env python
LICENSE = '''
Copyright (C) 2010, Scott W. Dunlop <swdunlop at gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
#!/usr/bin/env python
'''
Generates a cross-reference of findings in a Nessus dump, organizing them by finding and enumerating hosts. This is useful for penetration testers and other security professionals who
often need to group a number of similar hosts for remediation.
'''
import sys, lxml.etree as et
findings_by_pid = {}