Skip to content

Instantly share code, notes, and snippets.


W. J. van der Laan laanwj

View GitHub Profile
laanwj / $
Last active May 21, 2021
Get TorV3 addresses from a node and check if they are connectable
View $
#!/usr/bin/env python3
import easyrpc
import socks
import sys
out = sys.stdout
log = sys.stderr
log.write(f"Getting addresses from local node…\n")
p = easyrpc.get_rpc_proxy(network='main')
laanwj / keys.txt
Last active Aug 31, 2021
keys.txt from Bitcoin Core, updated for
View keys.txt
9D3CC86A72F8494342EA5FD10A41BDC3F4FAFF1C Aaron Clauson (sipsorcery)
617C90010B3BD370B0AC7D424BB42E31C79111B8 Akira Takizawa
E944AE667CF960B1004BC32FCA662BE18B877A60 Andreas Schildbach
152812300785C96444D3334D17565732E08E5E41 Andrew Chow (achow101)
590B7292695AFFA5B672CBB2E13FC145CD3F4304 Antoine Poinsot (darosior)
0AD83877C1F0CD1EE9BD660AD7CC770B81FD22A8 Ben Carman (benthecarman)
912FD3228387123DC97E0E57D5566241A0295FA9 BtcDrak
C519EBCF3B926298946783EFF6430754120EC2F4 Christian Decker (cdecker)
18AE2F798E0D239755DA4FD24B79F986CBDF8736 Chun Kuan Le (ken2812221)
F20F56EF6A067F70E8A5C99FFF95FAA971697405 centaur
laanwj /
Last active Dec 13, 2020
Validate cryptographic signature on macos macho binary
#!/usr/bin/env python3
import io
import struct
import sys
import pprint
import macholib.MachO
from macholib.mach_o import LC_CODE_SIGNATURE
import asn1crypto.x509
from asn1crypto.cms import ContentInfo, SignedData, CMSAttributes
laanwj / test.c
Last active Nov 5, 2019
Test fixed-point number formatting
View test.c
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
void print_number_f(double x) {
double y = x;
int c = 0;
if (y < 0.0) {
y = -y;
View gist:dcc0f30d52fdeeed57689e1edf6cc7f5
laanwj /
Last active Feb 4, 2021
Alphanumeric instructions on RISC-V

Alphanumeric shellcode on RISC-V

Although common on x86, it was initially believed that it was not possible to make alphanumeric shellcode for ARM. Later it turned out it was.

Similar to that, I wondered if it was possible to make alphanumeric shell-code for RISC-V.

(Basic shellcode in RISC-V Linux provides a good introduction to shellcode for RISC-V, including how to avoid NUL bytes.)

First, I enumerated all the possible instructions that could be formed from these characters with a little Rust program and generated some statistics.

laanwj / options-including-debug.diff
Last active Oct 3, 2018
Difference between Bitcoin Core 0.16 and 0.17.0 options
View options-including-debug.diff
aurora:~/projects/bitcoin$ bitcoin-0.16/build/src/bitcoind --help --help-debug|grep "^ -" | sort > /tmp/options-0.16.txt
aurora:~/projects/bitcoin$ bitcoin-0.17/build/src/bitcoind --help --help-debug|grep "^ -" | sort > /tmp/options-0.17.txt
aurora:~/projects/bitcoin$ diff -du /tmp/options-0.16.txt /tmp/options-0.17.txt
--- /tmp/options-0.16.txt 2018-10-03 14:35:57.661688575 +0200
+++ /tmp/options-0.17.txt 2018-10-03 14:36:03.789664725 +0200
@@ -2,8 +2,10 @@
+ -addrmantest
laanwj / 99-aithra-serial.rules
Last active Jan 11, 2021
udev rules example for lots of serial devices (put in /etc/udev/rules.d)
View 99-aithra-serial.rules
# serial devices
# get attributes using: udevadm info -a -n /dev/ttyUSBn
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="Flyswatter2", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="serial/flyswatter-jtag"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="Flyswatter2", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="serial/flyswatter-tty"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="Dual RS232-HS", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="serial/unleashed-jtag"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="Dual RS232-HS", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="serial/unleashed-tty"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{product}=="Quad RS232-HS", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="serial/zodiac-jtag0"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{product}=="Quad RS232-HS", ENV{ID_USB_IN
laanwj /
Last active Sep 23, 2020
gitian buildling on debian 9.5

Some changes are needed to build on debian because of the switch of the guest OS to bionic.

lxc that comes with debian is not high enough version to support bionic (the minimum is 2.1.1), so need to build from scratch.

debootstrap that comes with debian will give the following error:

    $ bin/make-base-vm --lxc --suite bionic --arch amd64                                                                                              
    E: No such script: /usr/share/debootstrap/scripts/bionic