Skip to content

Instantly share code, notes, and snippets.

@TylerOderkirk
TylerOderkirk / crackme.c
Last active August 3, 2016 16:26
A demonstration of Markus Gaasedelen's method for reversing a binary - see URL in find_password.py
#include <stdlib.h>
#include <stdio.h>
void main(int argc, char *argv[])
{
if( argv[1][0] == 'f' ) {
if( argv[1][1] == 'o' ) {
if( argv[1][2] == 'o' ) {
if( argv[1][3] == '\x00' ) {
printf( "good password\n" );
@TylerOderkirk
TylerOderkirk / carve_fw.py
Created October 8, 2014 01:38
Firmware dissector for OBi100 VoIP Telephone Adapter
#!/usr/bin/env python
import sys, binascii, struct
def main(argv=None):
for offset in [0x200, 0x10100, 0x20100, 0x30100, 0x40100, 0x50100, 0x60100, 0x70100, 0x80100, 0x90100]:
f=open(sys.argv[1], 'rb')
extract_httpd_resource_files(offset,f)
for offset in [0x95a15, 0xdd485]:
@TylerOderkirk
TylerOderkirk / dump_AT45DB041B.py
Last active December 6, 2022 17:42
A script to dump an Atmel AT45DB041B 4Mbit SPI Flash part's contents to disk using a Bus Pirate.
#!/usr/bin/env python
# dump the contents of an atmel AT45DB041B flash part to 'data.bin'
# usage: ./dump_AT45DB041B.py /dev/ttyUSB0
# tested w/ https://github.com/audiohacked/pyBusPirate ac19e00b53, Bus Pirate Hardware labelled v3.6, Firmware: "Bus Pirate v3b, Firmware v5.10 (r559), Bootloader v4.4"
# bugs: slow. as in... dozens of hours :/
@TylerOderkirk
TylerOderkirk / time_warner_channel_listings.py
Created November 1, 2014 15:23
A script to scrape the data from Time Warner Cable's channel listings
#!/usr/bin/python
import json, sys
# convert time warner cable's json channel listing to csv
# http://www.timewarnercable.com/northeast/support/clu/clu.ashx?CLUID=476&Zip=14534&Embedded=true
# 1. use chrome's "network" tab in "developer tools" to obtain a curl command line to retrieve the listing (http://www.timewarnercable.com/CustomerService/Clu/CluJson.ashx?[..])
# 2. retrieve the listing w/ curl
# 3. nuke the non-ascii bytes perl -i.bak -pe 's/[^[:ascii:]]//g' time_warner_channel_listings.json
@TylerOderkirk
TylerOderkirk / stdinout_tofrom_named_pipe.py
Last active August 29, 2015 14:23
[dirt simple comms] read bytes from stdin and write them to a named pipe. read bytes from another named pipe and write them to stdout.
#!/usr/bin/env python
import thread, sys, time
if sys.argv[1] == "other":
fifo_w = open('/tmp/south', 'wb')
fifo_r = open('/tmp/north', 'rb')
log = open('/tmp/serial_log_southbound', 'wb')
else:
fifo_r = open('/tmp/south', 'rb')
fifo_w = open('/tmp/north', 'wb')
# create a pty and attach it to python app's stdin/out
socat -ddd -ddd PTY,raw,echo=0 "EXEC:'python /home/tz/proj/dsc/stdinout_tofrom_named_pipe.py that',pty,raw,echo=0"
# create a second pty and attach it to python app's stdin/out
socat -ddd -ddd PTY,raw,echo=0 "EXEC:'python /home/tz/proj/dsc/stdinout_tofrom_named_pipe.py other',pty,raw,echo=0"
# write some binary data into the first pty (where '7' is what's printed by socat)
cat /bin/true > /dev/pts/7
# read some binary data from the second pty (where '11' is what's printed by socat)
@TylerOderkirk
TylerOderkirk / make_slip_connections
Created June 14, 2015 17:22
[dirt simple comms] make a SLIP connection over a socat-provided pty which is conected to https://gist.github.com/TylerOderkirk/c8510292cc86648074b5
#!/bin/bash
socat -ddd -ddd PTY,raw,echo=0 "EXEC:'python /home/tz/proj/dsc/stdinout_tofrom_named_pipe.py that',pty,raw,echo=0" &
SOCAT_PID1=${!}
echo
read -p 'Enter PTY number (eg "12"): ' PTY1
sudo slattach -dv -p slip /dev/pts/${PTY1} &
SLATTACH_PID1=${!}
echo
read -p 'Enter interface name (eg "sl0"): ' IFACE1
@TylerOderkirk
TylerOderkirk / panstamp_modem_softserial.ino
Created June 16, 2015 00:59
The Panstamp 'modem' sketch ported to use SoftwareSerial on an Uno
/*
* modem.pde
*
* Copyright (c) 2014 panStamp <contact@panstamp.com>
*
* This file is part of the panStamp project.
*
* panStamp is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@TylerOderkirk
TylerOderkirk / bluelog_1.1.2_stdout_flush.patch
Created July 1, 2015 01:49
bluelog.c STDOUT "-v" flush
diff -r d8638b19d99d bluelog.c
--- a/bluelog.c Tue Jun 30 21:44:06 2015 -0400
+++ b/bluelog.c Tue Jun 30 21:48:00 2015 -0400
@@ -911,7 +911,7 @@
{
if (friendlyclass)
{
- printf("[%s] %s,%s,%s,(%s)\n",\
+ printf("%s,%s,%s,%s,(%s)\n",\
dev_cache[ri].time, dev_cache[ri].addr,\
@TylerOderkirk
TylerOderkirk / bluelog_stdout_parser.py
Last active August 17, 2016 10:52
bluelog_stdout_parser.py
#!/usr/bin/env python
import subprocess, time, os, sys
#TODO: kill any already-running bluelog instances
cmd = ['./bluelog', '-m', '-t', '-f', '-a0', '-n', '-v']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
mru_macs = []