Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am singe on github.
  • I am singe (https://keybase.io/singe) on keybase.
  • I have a public key whose fingerprint is A229 CE1E 1653 A30E 1B8F 4DDC 125C 4A18 B7D1 71CE

To claim this, I am signing this object:

@singe
singe / poodle-tls-go.patch
Last active May 17, 2016 16:37
A scanner for new POODLE (affecting TLS versions). These are mods to Adam Langley's (@agl__) work.
diff -r f60b128afd41 src/crypto/tls/common.go
--- a/src/crypto/tls/common.go Tue Nov 04 10:20:35 2014 -0800
+++ b/src/crypto/tls/common.go Mon Dec 08 14:56:25 2014 -0800
@@ -343,6 +343,8 @@
// be used.
CurvePreferences []CurveID
+ BreakCBCPadding bool
+
serverInitOnce sync.Once // guards calling (*Config).serverInit
@singe
singe / hostapd-2.6-mana.patch
Created December 12, 2016 23:37
Experimental hostapd-mana 2.6 patch
diff -ur hostapd-2.6/hostapd/config_file.c hostapd-2.6-mana/hostapd/config_file.c
--- hostapd-2.6/hostapd/config_file.c 2016-10-02 20:51:11.000000000 +0200
+++ hostapd-2.6-mana/hostapd/config_file.c 2016-12-12 23:38:37.000000000 +0200
@@ -21,6 +21,8 @@
#include "ap/ap_config.h"
#include "config_file.h"
+#include <stdlib.h>
+
@singe
singe / extract_call.py
Created January 2, 2017 16:17
Pythonista script to extract a phone number from copy pasted text, add it to your Contacts if it doesn't exist, then call it.
import re
import clipboard
import console
import webbrowser
import urllib
import contacts
import datetime
import dialogs
def extract_num(input):
@singe
singe / USaBUSe-install.sh
Last active April 30, 2017 08:36
Setting up a new binary-only USaBUSe install on a new macOS
brew install avrdude wget
pip install pyserial
git clone --recursive https://github.com/sensepost/USaBUSe
cd USaBUSe
wget --content-disposition "http://bbs.espressif.com/download/file.php?id=1046"
unzip ESP8266_NONOS_SDK_V1.5.1_16_01_08.zip
mkdir esp-vnc/firmware
@singe
singe / ping-diff-plot.sh
Last active May 28, 2017 15:29
A super crude method of checking the latency of your local connection.
#!/bin/sh
# Super crude ping viz for debugging local network jitter
upstream=$1 #The gateway of your Internet provider
router=$2 #Your local gateway. This can be a MAC address, you'll need arping though
avg=2 #How many points to average for the smooted graph
limit=100 #The maximum number of points to show in the graph
graphsize="2100,600" # width x height this works nicely on my MBP
pingdelay=1
@singe
singe / wifi-hierarchy.py
Last active October 3, 2017 13:43
Display nearby wifi network SSIDs, BSSIDs and connected clients.
#!/usr/bin/env python3
# by @singe
#
# Invoke it like you would tshark e.g.
#./wifi-hierarchy.py -r file.pcap
#./wifi-hierarchy.py -i en0
#
# Dependencies, tshark in your path and python3
from subprocess import getoutput
@singe
singe / aes-ccm-noncense.py
Created October 18, 2017 18:58
Simple demonstration of how you can recover plaintext from a stream cipher when the nonce is reused.
#!/usr/bin/env python3
from Cryptodome.Cipher import AES
from Cryptodome.Random import get_random_bytes
pairwiseTransientKey = b'pairwiseTransKey'
EAPOLheader = b'Unencrypted Frame Stuff'
plaintext1 = b'Attack at dawn'
nonce1 = get_random_bytes(11)
@singe
singe / docker-for-mac-linuxkit-build.sh
Created March 14, 2018 21:01
A simple script to rebuild the linuxkit image used in Docker for Mac.
git clone https://github.com/linuxkit/linuxkit
cd linuxkit
currdir=$(pwd)
make
export PATH=$PATH:$currdir/bin
foo=$(grep isoEfi\ $currdir/src/cmd/linuxkit/vendor/github.com/moby/tool/src/moby/output.go|cut -d\" -f2)
docker pull $foo
cd examples
linuxkit build --format iso-efi docker-for-mac.yml
mv /Applications/Docker.app/Contents/Resources/linuxkit/docker-for-mac.iso /Applications/Docker.app/Contents/Resources/linuxkit/docker-for-mac.iso.orig
@singe
singe / xe.sh
Created May 8, 2018 13:11
A super simple script to pull currency info from xe.com
#!/bin/sh
UA="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"
url="https://www.xe.com/currencyconverter/convert/"
amount="$1"
fromcur="$2"
tocur="$3"
if [ "$fromcur" == "" ]; then #Use default currencies
fromcur="ZAR"
tocur="GBP"
fi