Skip to content

Instantly share code, notes, and snippets.

@biemster
biemster / keychain_password.py
Created September 8, 2022 09:52 — forked from pudquick/keychain_password.py
Storing and retrieving a generic password in the login.keychain in macOS via python and pyobjc
import objc
from ctypes import c_char
from Foundation import NSBundle
Security = NSBundle.bundleWithIdentifier_('com.apple.security')
S_functions = [
('SecKeychainGetTypeID', 'I'),
('SecKeychainItemGetTypeID', 'I'),
('SecKeychainAddGenericPassword', 'i^{OpaqueSecKeychainRef=}I*I*I*o^^{OpaqueSecKeychainItemRef}'),
('SecKeychainOpen', 'i*o^^{OpaqueSecKeychainRef}'),
@biemster
biemster / ec_lsag_test.py
Created September 20, 2022 09:06 — forked from jesperborgstrup/ec_lsag_test.py
Python implementation of Linkable Ring Signatures over Elliptic curves
# MIT License
#
# Copyright (C) 2014 Jesper Borgstrup
# -------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
@biemster
biemster / ESP32_blescan.py
Created January 17, 2023 12:20
simple ESP32 MicroPython Bluetooth LE scanner
import time
import bluetooth
from micropython import const
_IRQ_SCAN_RESULT = const(5)
_IRQ_SCAN_DONE = const(6)
def bt_irq(event, data):
if event == _IRQ_SCAN_RESULT:
# A single scan result.
addr_type, addr, connectable, rssi, adv_data = data
@biemster
biemster / parse_nacsig.py
Last active March 21, 2024 04:51
Initial parsing of the validation blob for IDS registration which comes out of IMDAppleServices
#!/usr/bin/env python
import apple_auth
from io import BytesIO
vd = BytesIO(bytes(apple_auth.IDS(open('idevice.json').read()).request_validation_data())) # create json with Smoothstep/apple-gen-rs
tag = vd.read(1) # always 0x02, maybe like the APNS msg for cert?
stat16b = vd.read(16) # static across machines, some versioning?
dyn16b = vd.read(16) # the actual signature from the obfuscated algorithm
len_payload = vd.read(4)
payload = BytesIO(vd.read(int.from_bytes(len_payload,"big")))