Skip to content

Instantly share code, notes, and snippets.

View joostd's full-sized avatar

Joost van Dijk joostd

  • Utrecht, the Netherlands
View GitHub Profile
@kennwhite
kennwhite / nginx_1.6.x.conf
Last active August 29, 2015 14:06
CentOS, Red Hat, Amazon Linux nginx config: A+ SSL Labs rating w/ strong legacy compatibility
# Strong nginx config for SSL Labs rating A as of 3-2015
# Broad legacy compatibility including IE8, Android 2.3+, openssl 0.9.8 clients
# Blocks most bot scan IP probes.
#
# *** Assumes: _HOSTNAME_ is replaced ***
# *** Assumes: Diffie-Hellman parameters have been generated (see: dhparam below)
#
# Includes OCSP stapling, HSTS Strict Transport security,
# session resumption, legacy backwards compatibility (XP, Android 2.3-4.3)
#
@dagon666
dagon666 / Makefile
Created September 21, 2013 21:09
Pure C Arduino generic Makefile
TARGET=blink
SOURCES=blink.c
DEPS=
COBJ=$(SOURCES:.c=.o)
CC=avr-gcc
OBJC=avr-objcopy
MCU=atmega328p
CFLAGS=-I. -Wall -Os -DF_CPU=16000000UL
LDFLAGS=
@darconeous
darconeous / yubikey-apdu.md
Last active January 7, 2021 13:03
Yubikey Applet #Security

The AID of the yubikey applet on the Yubikey Neo is A000000527200101.

You can select it with the APDU 00 a4 04 00 08 A0 00 00 05 27 20 01 01.

For the YubiKey applet there are 4 commands:

  • ins 0x01 is a YubiKey API request (as used by the yubico personalization tools) with command in p1
  • ins 0x02 is a request for an OTP with slot in p1 (zero indexed)
  • ins 0x03 is a YubiKey status request
.text
.globl _start
_start:
mov %r0, $1 // file descriptor number 1 (stdout)
ldr %r1, =message
mov %r2, $message_len
mov %r7, $4 // syscall 4 (write)
swi $0
property includeSkippedSlides : false
set the defaultDestinationFolder to (path to downloads folder)
tell application "Keynote"
activate
try
if playing is true then tell the front document to stop
if not (exists document 1) then error number -128
@DinoChiesa
DinoChiesa / convert.Java
Created October 8, 2021 17:16
Java: convert between ASN.1 and P1363 Encoding of Signature
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
import java.math.BigInteger;
private static byte[] toP1363(byte[] asn1EncodedSignature) throws Exception {
ASN1Sequence seq = ASN1Sequence.getInstance(asn1EncodedSignature);
BigInteger r = ((ASN1Integer) seq.getObjectAt(0)).getValue();
BigInteger s = ((ASN1Integer) seq.getObjectAt(1)).getValue();
@woodrow
woodrow / fido_u2f_dissector.lua
Created December 16, 2019 05:14
wireshark fido/u2f dissector
-- started based on https://gist.github.com/z4yx/218116240e2759759b239d16fed787ca
cbor = Dissector.get("cbor")
iso7816 = Dissector.get("iso7816")
ctaphid_proto = Proto("CTAPHID","FIDO Client to Authenticator Protocol over USB HID")
ctaphidfield_cid = ProtoField.uint32("ctaphid.cid", "Channel ID", base.HEX)
ctaphidfield_cmd = ProtoField.uint8("ctaphid.cmd", "Command", base.HEX)
ctaphidfield_bcnt = ProtoField.uint16("ctaphid.bcnt", "Payload Length", base.DEC_HEX)
ctaphidfield_seq = ProtoField.uint8("ctaphid.seq", "Packet Sequence", base.HEX)
@dex4er
dex4er / eToken-9.sh
Last active April 16, 2025 22:00
eToken
# udev
wget https://gist.githubusercontent.com/dex4er/1354710/raw/0f9738c7439cdfb9e4446663d137f91ee153b4d8/etc_udev_rules.d_90-hid-eToken.rules
sudo cp etc_udev_rules.d_90-hid-eToken.rules /etc/udev/rules.d
sudo service udev reload
# required packages
sudo apt-get -yy install pcscd opensc
# legacy library
wget http://mirrors.kernel.org/ubuntu/pool/universe/h/hal/libhal1_0.5.14-8_amd64.deb
@rmed
rmed / configfs_test.sh
Last active May 26, 2025 20:08
RPi Zero keyboard test
#!/bin/bash
sleep 15
# Create gadget
mkdir /sys/kernel/config/usb_gadget/mykeyboard
cd /sys/kernel/config/usb_gadget/mykeyboard
# Add basic information
echo 0x0100 > bcdDevice # Version 1.0.0
@z4yx
z4yx / u2f_fido2_dissector.lua
Last active July 12, 2025 18:27
Wireshark protocol decoder for FIDO(U2F) and FIDO2(WebAuthn) over USB HID
cbor = Dissector.get("cbor")
iso7816 = Dissector.get("iso7816")
ctap_proto = Proto("ctaphid","ctap hid")
-- Field Extractor
direction_fe = Field.new("usb.endpoint_address.direction")
udp_srcport_fe = Field.new("udp.srcport")
CTAPHID_COMMAND_CODE = {
[0x03]='CTAPHID_MSG',
[0x10]='CTAPHID_CBOR',