Skip to content

Instantly share code, notes, and snippets.

View bettse's full-sized avatar

Eric Betts bettse

View GitHub Profile
@bettse
bettse / commands.md
Last active March 31, 2026 17:43
Setup PIV Applet for MacOS

https://github.com/arekinath/PivApplet

Here's the full sequence for both slots:

Slot 9a (PIV Authentication):

yubico-piv-tool -r 'OMNIKEY AG Smart Card Reader USB' -a generate -s 9a --pin=123456 --key=010203040506070801020304050607080102030405060708 > pubkey-9a.pem
yubico-piv-tool -r 'OMNIKEY AG Smart Card Reader USB' -a verify-pin -a selfsign-certificate -s 9a -S '/CN=PIV/' --pin=123456 --key=010203040506070801020304050607080102030405060708 < pubkey-9a.pem > cert-9a.pem
yubico-piv-tool -r 'OMNIKEY AG Smart Card Reader USB' -a import-certificate -s 9a --key=010203040506070801020304050607080102030405060708 < cert-9a.pem
class Logger < ::ActiveSupport::Logger
def with_field(key, value)
Thread.current['lograge.data'] ||= {}
Thread.current['lograge.data'][key] = value
return self
end
def with_fields(hash)
if hash.is_a?(Hash)
Thread.current['lograge.data'] ||= {}

GlobalPlatform and Secure Channel Analysis

Date: 2026-02-21
Project: HidGlobal.UniversalEncoder.Stubs.ConfigCardProgrammer


Q: Are there any references to GP/GlobalPlatform?

Yes, there are several references:

@bettse
bettse / buffer-tools.js
Last active December 7, 2025 21:46
EAX and EAX-Prime in javascript
exports.bitShiftLeft = function (buffer) {
var shifted = Buffer.alloc(buffer.length);
var last = buffer.length - 1;
for (var index = 0; index < last; index++) {
shifted[index] = buffer[index] << 1;
if (buffer[index + 1] & 0x80) {
shifted[index] += 0x01;
}
}
shifted[last] = buffer[last] << 1;
@bettse
bettse / hwid.proto
Created June 22, 2025 17:44
HWID BLE
syntax = "proto3";
package hwid;
message PortalToApp {
uint32 timestampMs = 1;
Event event = 2;
DeviceInfo deviceInfo = 3;
CommandResponse commandResponse = 4;
bytes accessoryMessage = 5;
}
@bettse
bettse / vigik.md
Last active April 29, 2025 14:52
VIGIK

The VIGIK system is quite misunderstood overall.

In France, most people live in appartment buildings, so the letter-boxes are not on the street. As such, the post office needs some way to enter the building to deliver mail. Originally, they used a mechanical key, that was universal across the country. The key was copied heavily, which meant that anyone could (and did) get access to buildings.

This mechanical key was replaced by the VIGIK system. "Services", such as the post, power company, etc can get access to buildings using a SERVICE BADGE. The SERVICE BADGES are MIFARE 1K Classic badges.

@bettse
bettse / commands.md
Last active April 27, 2025 22:38
Siri Vision Pro

General

  • Siri make it light (set daytime environment, also works in fullscreen video)
  • Siri make it dark (set nighttime environment)
  • Siri hide environment (stop displaying your current environment)
  • Siri show environment xyz (have to use environment name)
  • Siri show environments (opens environment picker)

Video playback

  • Siri Auto dimming on/off (changes auto dimming setting for video/photos without having to tap through everything)
@bettse
bettse / ld_pwdgen.c
Created November 30, 2023 18:42
ld_pwdgen.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#if defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#if defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)