Skip to content

Instantly share code, notes, and snippets.

View dweinstein's full-sized avatar

David Weinstein dweinstein

View GitHub Profile
#!/usr/bin/env python
import capstone
import binascii
import sys
class Data(object):
def __init__(self):
pass
def slurp(self):
@dweinstein
dweinstein / Bad-Dockerfile
Last active August 29, 2015 13:57
Avoid doing an `npm install` after an `ADD .` command
FROM ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y install python-software-properties git build-essential
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get -y install nodejs
WORKDIR /opt/app
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.14 (Darwin)
owGbwMvMwMW4qkN+F5u5ewLj6QPvkhiClZ2Dq5WS8lMqlayqlbJTwVRaZl56alFB
UWZeiZKVkkWiWbKhuWGyZVJyarKRsaFlSpJBUqqZUWKihYVhWlKigZmxuYm5mYGS
jlJGfjFIB9CYpMTiVL3MfKAYkBOfmQIUdXQEqndzckRSXwqWsDSztExKNE1MTbU0
sEg2NUpNMUpKMjZOMk0yT7VIMgArLE4tykvMTQWqTilPzcwrLgESSrU6SkDxsszk
VJCrofLpmSUZpUn49JRUFoAEy1OT4qHa45My81KAngbqKkstKs7Mz1OyMgSqTC7J
BOk3NLY0sTC0tDQy1lFKrSjILEqNzwSpMDU3szAAAh2lgqLUMqCRxmaGliYpZokp
JolGJkamliZpKRZAaJZmnmSabJSUamJkbpmUkpSYZmxhaGZkkJJsYmGRap5sYGqW
SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `dirname $0`/sbt-launch.jar "$@"
#!/bin/bash
#Basic set up for an Application AndroidManifest Fuzzer
#this requires a preexisting ant buildable application project to be set up! so get the SDK and ant1.8
#this file reproduces the bug mentioned here http://ibrahimbalic.com/2014/android-os-memory-corruption-bug/
#NOTE: values from 260000 and up cause SIGSEGvs to be sent to the system_server (test on KitKat 4.4.2)
#NOTE: you should probably monitor $(adb logcat)||(/system/bin/gdbserver) for responsiveness to the issue
APP_PROJ_DIR="..." #<-- PATH TO PROJ DIR
APP_PACKAGE_NAME="..." #<-- PACKAGE NAME
APP_LAUNCH_COMP="..." # <--- MAIN ACTIVITY NAME
N: ns0=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: ns0:versionCode(0x0101021b)=(type 0x10)0x5f66a185
A: ns0:versionName(0x0101021c)="15.0.1162.61541" (Raw: "15.0.1162.61541")
A: ns0:installLocation(0x010102b7)=(type 0x10)0x0
A: package="com.opera.browser" (Raw: "com.opera.browser")
E: uses-sdk (line=0)
A: ns0:minSdkVersion(0x0101020c)=(type 0x10)0xb
A: ns0:targetSdkVersion(0x01010270)=(type 0x10)0x11
E: permission (line=3)
@dweinstein
dweinstein / gist:debc10e13624cab4dcc1
Created September 4, 2014 17:08
walk a graph and generate an array of objects
function walk(obj) {
function root(key) {
return {key: key, text: key};
}
function node(parent, key, leaf) {
key = typeof key == 'number' ? String(key) : key;
parent = typeof parent == 'number' ? String(parent) : parent;
return {key: key, text: key, parent: parent, leaf: leaf};
}
@dweinstein
dweinstein / virustotal.js
Last active August 29, 2015 14:08
VirusTotal cacheing API
var restify = require('restify');
var jsonschema = require('jsonschema');
var lodash = require('lodash');
var util = require('util');
var fmt = util.format;
var Promise = require('bluebird');
var config = require('config').virustotal;
var logger = require('../logger');
@dweinstein
dweinstein / vimrc
Created November 14, 2014 15:18
cscope vim integration
" cscope options
if has("cscope")
set csprg=/usr/local/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
@dweinstein
dweinstein / procstat.js
Created December 26, 2014 16:18
procstat for android parser for adbkit
var _ = require('lodash');
var Promise = require('bluebird');
var readAll = require('adbkit').util.readAll;
var RE_COLSEP = /\ +/g;
var RE_CPU = /^cpu[0-9]*$/;
module.exports = function(client, serial) {
return client.shell(serial, "cat /proc/stat")
.then(readAll)