Skip to content

Instantly share code, notes, and snippets.

View cyphunk's full-sized avatar

Nathan Fain cyphunk

  • stage theatre + reverse engineering
View GitHub Profile
@cyphunk
cyphunk / dhcpserver.sh
Last active August 22, 2020 12:52
use dnsmasq to setup dhcp server or share network
#!/usr/bin/env bash
# sudo call integrity check: only root should be able to change script
l=($(ls -l `readlink -f $0`))
[ ${l[0]:2:1} != "-" ] && [ "${l[2]}" != "root" ] ||
[ ${l[0]:5:1} != "-" ] && [ "${l[3]}" != "root" ] ||
[ ${l[0]:8:1} != "-" ] && { echo -e "only root should be able to modify\n${l[@]}"; exit 1;}
#!/usr/bin/env bash
# As this script may be called from sudo, suggest safe use:
l=($(ls -l $0))
[ ${l[0]:2:1} != "-" ] && [ "${l[2]}" != "root" ] ||
[ ${l[0]:5:1} != "-" ] && [ "${l[3]}" != "root" ] ||
[ ${l[0]:8:1} != "-" ] || [ -L $0 ] || [ -L ${0%/*} ] &&
{ echo -e "no symlinks and only root should be able to modify.\n${l[@]}"; exit 1;}
@cyphunk
cyphunk / ios_security_notes.md
Last active May 28, 2018 00:58
notes from iOS security documentation that I used to write https://deadhacker.com/2016/03/25/the-terrorists-phone/

Notation iOS 9

This homebrewed notation I typically use when evaluating secure boot designs of embedded devices. It doesn't apply accurately for the iOS review, hides the key-wrapping schema for example. But it's enough to keep track of storage location of secrets and some interdependency.

pfk                  = 256bit per_file_key
@cyphunk
cyphunk / nointernet.sh
Last active June 11, 2018 13:35
prevent program from accessing internet
#!/usr/bin/env bash
# As this script may be called from sudo, suggest safe use:
l=($(ls -l $0))
[ ${l[0]:2:1} != "-" ] && [ "${l[2]}" != "root" ] ||
[ ${l[0]:5:1} != "-" ] && [ "${l[3]}" != "root" ] ||
[ ${l[0]:8:1} != "-" ] || [ -L $0 ] || [ -L ${0%/*} ] &&
{ echo -e "no symlinks and only root should be able to modify.\n${l[@]}"; exit 1;}
#!/bin/bash
# Download latest OTR and Pidgin and run vanilla configure & compile
# you'll have to run make install manually when completed.
# If you get errors on OSX you may find help at:
# https://gist.github.com/cyphunk/5048773
INSTALLPREFIX=/usr/local
SH_SOURCE=${BASH_SOURCE:-$_}
if readlink "$SH_SOURCE" >/dev/null 2>&1; then
@cyphunk
cyphunk / zipenc
Created March 9, 2016 15:21
create a password protected zip of files
#!/bin/bash
set -e #exit on any error
if [ $# -lt 1 ]; then
echo "$0 file [file ...]"
exit
fi
FILE1=$(basename "$(readlink -f "$1")")
NAME="${FILE1%.*}"
#!/usr/bin/env python
# check url for a text and send alert via nexmo.com sms api
#
# example, checking for machina ex tickets:
#
# while [ 1 ]; do
# ./checkurlthensms.py \
# http://www.hebbel-am-ufer.de/programm/spielplan/machina-ex-lessons-of-leaking/2354/ \
# ticketLink "Tickets available" \
# <nexmo_apikey> <nexmo_apisecret> \
@cyphunk
cyphunk / pcb_align.md
Last active December 8, 2015 16:41
Methods for aligning images of PCB layers from a device

Aligning PCB Layers

Reverse engineering a device can be assisted by tracing lines that are exposed on the PCB. For complex tracing I have used depcb and for more simple tracing I use gimp. First the images of the PCB layers should be aligned with each other.

@cyphunk
cyphunk / pidginotr-linux-update.sh
Last active October 15, 2015 12:07
download and build latest pidgin, pidgin-otr.
#!/usr/bin/env bash
#otr: curl https://otr.cypherpunks.ca/gpgkey.asc | gpg --import
#pidgin: gpg --keyserver pgp.mit.edu --recv-key 0xA40AB77B
INSTALLPREFIX=/usr/local
SH_SOURCE=${BASH_SOURCE:-$_}
if readlink "$SH_SOURCE" >/dev/null 2>&1; then
cd "$(dirname $(readlink $SH_SOURCE))"
else
cd "$(dirname $SH_SOURCE)"