Skip to content

Instantly share code, notes, and snippets.

@emonti
emonti / extract_lockdownd_services.rb
Created October 23, 2015 19:33
extract_lockdownd_services.rb
#!/usr/bin/env ruby
fname = ARGV.shift
fname || exit!
offset = nil
size = nil
`otool -l \"#{fname}\" |grep -A11 ^Section`.split(/^--$/).each do |sect_txt|
lines = sect_txt.lines.map(&:chomp)
@emonti
emonti / its_a_bash_thing.txt
Last active August 29, 2015 14:06
It's a bash thing
~ export x="() { :;}; echo vulnerable"
~ bash -c "echo hi"
vulnerable
hi
~ sh -c "echo hi"
vulnerable
hi
~ /bin/sh --version
GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)
Copyright (C) 2007 Free Software Foundation, Inc.
@emonti
emonti / keybase.md
Created June 13, 2014 21:44
Keybase Proof

Keybase proof

I hereby claim:

  • I am emonti on github.
  • I am emonti (https://keybase.io/emonti) on keybase.
  • I have a public key whose fingerprint is 9281 C1DF F521 9F9C 2C8F 1608 CB1A 656F B6F8 E778

To claim this, I am signing this object:

@emonti
emonti / extract_e7_datas.rb
Created January 10, 2014 11:38
quick/dirty tool to extract embeded gzip files out of the evasi0n7 jailbreak binary -- requires otool so probably OSX
#!/usr/bin/env ruby
fname = ARGV.shift
fname || exit!
sections = `otool -l \"#{fname}\" |grep -A11 ^Section`.split(/^--$/).map do |sect_txt|
lines = sect_txt.lines.map(&:chomp)
Hash[ lines.map{|ln| ln.strip.split(' ', 2) } ]
end.select{|sect| sect["segname"] == "__DATA" and sect["sectname"] =~ /^data_\d+$/ }
@emonti
emonti / make_xpwn_dylib.sh
Created January 10, 2014 09:51
quick/dirty build a dynamic lib from xpwn - eric monti WARNING: this was for something really specific -- YMMV... drop this in your top-level directory where you checked out planetbeing/xpwn and cross your fingers ;)
#!/bin/bash
# quick/dirty build a dynamic lib from xpwn - eric monti
# WARNING: this was for something really specific -- YMMV...
# drop this in your top-level directory where you checked out planetbeing/xpwn and cross your fingers ;)
cmake -f CMakeLists.txt
make || exit 1
rm -rf ./sharedlib
mkdir -p ./sharedlib/lib
@emonti
emonti / llvm_disassembler.rb
Last active October 13, 2015 02:08
Multi-arch bytecode disassembler using libLLVM
#!/usr/bin/env ruby
# author eric monti ~ nov 20, 2012
# license: DWTFYW
require 'rubygems'
require 'ffi'
class LLVMDisassembler
module C
extend FFI::Library
ffi_lib ['LLVM', 'LLVM-3.2svn', 'LLVM-3.1', 'LLVM-3.0']
@emonti
emonti / 1dgrid.c
Created September 28, 2012 02:52
1d grid example for malic
#include <stdio.h>
int main()
{
// Notice, there are no brackets around the rows this time.
// This is a 1-dimensional array. Even though it looks 2d in
// the code, it's one long list to the computer.
//
// Using a 1-dimensional array, we can still treat the data
// inside of it as a grid in our code, though.
@emonti
emonti / 2dgrid.c
Created September 28, 2012 02:45
2d grid example for malic
#include <stdio.h>
#define ROWS 10
#define COLUMNS 7
// This is a 2-dimensional array.
// It makes accessing the values of a
// bitmap easy by using x/y references.
int grid[ROWS][COLUMNS] = {
{0,0,0,0,0,0,0}, // 7 columns across
@emonti
emonti / dyldcache.c
Created March 8, 2012 09:14
dyldcache.c dyld_shared_cache dumper
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
@emonti
emonti / dyld_shared_cache.bt
Created March 8, 2012 09:08
dyld_shared_cache.bt 010 Editor Binary template
//--------------------------------------
//--- 010 Editor v3.2.2 Binary Template
//
// File: dyld_shared_cache.bt
// Author: Eric Monti
// Revision: 0.0.1
// Purpose: Parses Mac/iOS dyld_shared_cache format
//--------------------------------------