Skip to content

Instantly share code, notes, and snippets.

View u1735067's full-sized avatar

Alexandre L. u1735067

View GitHub Profile
@u1735067
u1735067 / bde_metadata_block_header_v1.ksy.yml
Last active November 9, 2017 07:46
BitLocker headers format in kaitai – strict copy from the headers at https://github.com/libyal/libbde/blob/master/libbde/
meta:
id: bde_metadata_block_header_v1
endian: le
doc-ref: https://github.com/libyal/libbde/blob/master/libbde/bde_metadata.h
types:
bde_metadata_block_header_v1:
seq:
- id: signature
@u1735067
u1735067 / kdbx.ksy.yml
Last active January 23, 2022 15:59
KeePass kdbx kaitai format
meta:
id: kdbx
file-extension: kdbx
endian: le
license: ISC # https://spdx.org/licenses/ISC.html
doc: |
composite_key = sha256(sha256(password) + composites)
aes = new AES(128, CBC, iv=0x0 *16, key TRANSFORMSEED
transformed_key=sha256(for i in TRANSFORMROUNDS: aes.encrypt(transformed_key)))
@u1735067
u1735067 / IDN-Convert.py
Last active March 5, 2021 23:17
IDN Converter : try to find domains (regex in a large form, doesn't try to be specific) to convert unicode name to punycode name, so tools like Aria2 can work.
#!python3
"""
Bacause idn / idn2 utils aren't able to extract domain (neither python is) on long URLs like :
echo "http://ac.cd.éf.fr/hey/This%20is%20a%20really%20long%20path%20youve%20got%20here.txt" | idn2
idn2: lookup: domain label longer than 63 characters
So find the domain / most part of the url, convert, replace
"""
import fileinput, re
@u1735067
u1735067 / dns-320lw_uart.log
Created May 28, 2017 14:35
DNS-320LW Rev. A1 firmware v1.09b06 -- trying to debug the "can't boot unless has been in the fridge" temperature / thermal sensor issue -- I now know it's due to the Weltrend WT69P3 chip ; next step : try to UART connect this shit.
** MARVELL BOARD: DB-88F6702A-BP LE
U-Boot 1.1.4 (Mar 12 2012 - 16:23:48) Marvell version: 3.6.0.DNS-320L.01
U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CFB00
Soc: 88F6702 A1 CPU running @ 1000Mhz L2 running @ 500Mhz
SysClock = 400Mhz , TClock = 166Mhz
DRAM (DDR2) CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
@u1735067
u1735067 / acd_cli_oa.py
Last active May 26, 2017 12:22
Version tensile-runway-92512 (rev1), which leaked tokens, and acd-api-oa (rev2)
#!/usr/bin/env python
import webapp2
import urllib
import urllib2
from google.appengine.api import memcache
import json
import logging
PRIVACY_HTML = ('<!DOCTYPE html><html><head><title>acd_cli_oa privacy info</title></head>'
@u1735067
u1735067 / centos7_generate_keyboard_layouts.md
Created May 18, 2017 15:02
GRUB2 on CentOS 7 -- Generate keyboard layouts

First, generate the layout in a format understood by GRUB2:

cd /boot/grub2/
mkdir layouts
cd layouts
xkb=/lib/kbd/keymaps/xkb; for layout in $(ls $xkb/); do zcat $xkb/$layout | grub2-mklayout -o ${layout/.map.gz/}.gkb; done 2>/dev/null
ls layouts
@u1735067
u1735067 / hid_u2f.yml
Last active November 9, 2017 07:37
Kaitai HID U2F format
meta:
id: hid_u2f
seq:
- id: cid
size: 4
- id: hid_cmd
type: u1
enum: hid_cmds
- id: hid_apdu_size
type: u2be
@u1735067
u1735067 / yubikey4.js
Last active December 13, 2016 23:38
Yubikeys overall overview - WIP
{
man: "https://www.yubico.com/wp-content/uploads/2015/03/YubiKeyManual_v3.4.pdf",
??: "https://www.yubico.com/why-yubico/how-yubikey-works/",
downloads: "https://www.yubico.com/support/knowledge-base/categories/downloads/",
tools: "https://developers.yubico.com/Software_Projects/YubiKey_Device_Configuration/",
// Modes can be enabled or disabled using the Yubikey NEO Manager
modes: {
/*
* https://forum.yubico.com/viewtopic.php?f=35&t=2053 :
* - If you have U2F enabled, you should see Human Interface Devices > HID-compliant device.
@u1735067
u1735067 / imagehash.py
Last active June 14, 2021 12:52
Script to hash image content, avoiding differences in metadatas and others (--[0-9A-F]+-- tag, ..) ; relies on Pillow. Hopefully, Pillow will return the same bytes when EXIF orientation changes and when ICC profile is applied.
#!/usr/bin/env python3
''' BSD 3-Clause License — but if it was useful to you, you may tell me :)
Copyright (c) 2016, Alexandre Levavasseur
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
@u1735067
u1735067 / sparse_img_to_ext4.py
Last active March 30, 2021 14:05
Python script to convert sparse ext4 Android images (like cache.img[.ext4], hidden.img[.ext4] to openable ext4 images (like with 7zip)
#! /usr/bin/env python
# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#