Skip to content

Instantly share code, notes, and snippets.

View obfusk's full-sized avatar
🏳️‍🌈
hacking ⇒ ¬sleeping 😸

FC (Fay) Stegerman obfusk

🏳️‍🌈
hacking ⇒ ¬sleeping 😸
View GitHub Profile
@obfusk
obfusk / per-day-downloads.py
Created January 18, 2025 00:23
per-day downloads for a specific IoD app
import glob
import json
import sys
from typing import Dict
appid, = sys.argv[1:]
results: Dict[str, int] = {}
for json_file in sorted(glob.glob("apk_downloads/*/*.json")):
with open(json_file, encoding="utf-8") as fh:
@obfusk
obfusk / verify-apk.sh
Last active December 30, 2024 15:51
verify-apk.sh
#!/bin/bash
set -euo pipefail
apksigner verify -v --print-certs "$@" 2>&1 \
| ( grep -av '^WARNING: META-INF/.* not protected by signature' || true ) | cat -v
@obfusk
obfusk / zlib-ng-test.java
Last active December 17, 2024 22:52
zlib-ng stuff
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;
public class ZlibNgTest {
public static void main(String[] args) {
import java.util.Arrays;
import java.util.List;
class Test {
public static TestClassNoSuper tcns;
public static TestClassExtendsBar tceb;
public static class Foo {}
public static class Bar {
static {
System.out.println("Bar initialiser...");
if (tcns != null) {
@obfusk
obfusk / search.py
Created October 29, 2024 16:27
python script to search for specific class in r8 dumps | https://issuetracker.google.com/issues/366412380
import glob
import os
import sys
import tempfile
import zipfile
classname_str, *search_dirs = sys.argv[1:]
classname_bytes = classname_str.encode()
for search_dir in search_dirs:
@obfusk
obfusk / Test.java
Last active October 22, 2024 20:18
zip4j workaround for spanned archive marker
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
@obfusk
obfusk / cdata.py
Last active September 5, 2024 15:10
#!/usr/bin/python3
import struct
import sys
import zipfile
zfile, entry = sys.argv[1:]
with zipfile.ZipFile(zfile) as zf:
info = zf.getinfo(entry)
with open(zfile, "rb") as fh:
#!/usr/bin/python3
import json
import zipfile
from hashlib import sha1, sha256
from asn1crypto import cms # type: ignore[import-untyped]
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.primitives import serialization
#!/bin/bash
set -euo pipefail
zipentry=META-INF/version-control-info.textproto
commit_from_zip() {
unzip -p -- "$1" "$zipentry" | grep revision | grep -Eo '[0-9a-f]+' | tail -1
}
url="${1:-}"
if [ -z "$url" ]; then
read -r -p 'url> '
url="$REPLY"
public class Unicode {
public static void main(String[] args) {
String foo = "🏳️‍⚧️";
for (String x : foo.split("")) {
System.out.println(x.codePointAt(0));
}
System.out.println("---");
int n = foo.codePointCount(0, foo.length());
for (int i = 0; i < n; ++i) {
int j = foo.offsetByCodePoints(0, i);