Skip to content

Instantly share code, notes, and snippets.

@geekman
geekman / ida-analysis.py
Last active Oct 22, 2020
simple IDAPython script for scripting automated binary analysis
View ida-analysis.py
#
# ida-analysis.py
# a simple IDAPython binary analysis script
# 2020.05.24 darell tan
#
# invoke with:
# idat64 -c -A -S"ida-analysis.py $HOME/analysis.txt" <file.bin>
#
import sys
@geekman
geekman / qrcode.min.js
Created Oct 16, 2020
printable QR WiFi credentials generator (self-contained & offline)
View qrcode.min.js
/*! qrcode-svg v1.0.0 | https://github.com/papnkukn/qrcode-svg | MIT license */
function QR8bitByte(t){this.mode=QRMode.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e<r;e++){var o=[],n=this.data.charCodeAt(e);n>65536?(o[0]=240|(1835008&n)>>>18,o[1]=128|(258048&n)>>>12,o[2]=128|(4032&n)>>>6,o[3]=128|63&n):n>2048?(o[0]=224|(61440&n)>>>12,o[1]=128|(4032&n)>>>6,o[2]=128|63&n):n>128?(o[0]=192|(1984&n)>>>6,o[1]=128|63&n):o[0]=n,this.parsedData.push(o)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function QRCodeModel(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function QRPolynomial(t,e){if(void 0==t.length)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&0==t[r];)r++;this.num=new Array(t.length-r+e);for(var o=0;o<t.length-r;o++)this.num[o]=t[o+r]}functi
@geekman
geekman / myusbgadget
Created Jan 17, 2017
Pi Zero multiple USB gadgets minimal example
View myusbgadget
#!/bin/bash -e
modprobe libcomposite
cd /sys/kernel/config/usb_gadget/
mkdir g && cd g
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
@geekman
geekman / ax3600_led_show.sh
Created Jul 29, 2020
"runway lights" for the Xiaomi AX3600 router
View ax3600_led_show.sh
#!/bin/sh
PREV=
while :; do
for a in led_blue net_blue led_ant led_yellow net_yellow led_ant; do
[ -n "$PREV" ] && echo 0 > /sys/class/leds/$PREV/brightness
echo 1 > /sys/class/leds/$a/brightness
PREV=$a
sleep 1
done
View jffs2.py
#!/usr/bin/env python
#
# tool to parse JFFS2 images
# and more importantly, guess the erase block size
#
# 2015.10.19 darell tan
#
from struct import unpack
from argparse import ArgumentParser
@geekman
geekman / fixup-posts.py
Created Jun 10, 2020
script to fix up blog post markdown files
View fixup-posts.py
#
# rewrite blog posts front matter to fix date format and title
# 2020.05.26 darell tan
#
import re
import os
import sys
import time
View rpmdump.go
/*******************************************************************************
*
* RPM File Dumper
* Adapted to run as a self-contained binary from Holo:
* https://github.com/holocm/holo-build
*
* 2020.05.30 darell tan
*
* Copyright 2015 Stefan Majewsky <majewsky@gmx.net>
*
@geekman
geekman / dump_config.sh
Created May 14, 2020
snippet to look for effective config lines in config files
View dump_config.sh
# look for non-commented, non-empty lines
grep -v '^\s*\(#.*\)\?$' /etc/someconfig
@geekman
geekman / gen-link.sh
Created Apr 25, 2020
generate systemd network link files to avoid "s0" prefixes
View gen-link.sh
@geekman
geekman / boot.cmd
Created Jul 21, 2018
boot-time device tree overlays with U-Boot
View boot.cmd
part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait
if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
fdt addr ${fdt_addr_r}
fdt resize
setexpr fdtovaddr ${fdt_addr_r} + F000
You can’t perform that action at this time.