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
#!/usr/bin/python3
# encoding: utf-8
# SPDX-FileCopyrightText: 2023 FC Stegerman <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later
import zipfile
import zlib
from fnmatch import fnmatch
from typing import Any, Dict
#!/usr/bin/python3
# SPDX-FileCopyrightText: 2023 FC Stegerman <[email protected]>
# SPDX-License-Identifier: AGPL-3.0-or-later
import argparse
import os
import subprocess
import tempfile
import zipfile
@obfusk
obfusk / LOG.md
Created January 11, 2023 09:24
testing proposed javascript magic

JavaScript detection

$ cd /usr/share/nodejs
$ find -name '*.js' | wc -l
16761
$ find -name '*.js' -print0 | sort -z | xargs -0 file \
  | grep -Ev ': *(symbolic link|(empty|directory)$)' \
  | sed -r 's/.*: *//; s/(with very long lines).*/\1/' \
  | sort | uniq -c
#!/bin/bash
# dexdump -a -d -f -h classes.dex > classes.dex.dump
sed -i -r 's/^[0-9a-f]{6}: [ .0-9a-f]*\|(\[[0-9a-f]{6}\]|[0-9a-f]{4})?/|/' "$@"
sed -i -r 's! // [a-z0-9_]+@[0-9a-f]+$!!' "$@"
sed -i -r '/(interfaces_off|source_file_idx|annotations_off|class_data_off|superclass_idx|class_idx|method_idx|^Class #|^Annotations on|^ *0x[0-9a-f]{4} line=[0-9]+$)/d' "$@"
@obfusk
obfusk / README.md
Last active December 27, 2024 06:54
baseline.profm not deterministic
@obfusk
obfusk / apk.magic
Last active February 5, 2023 03:40
magic(5) files for .smali & .apk files
# Android APK file (Zip archive)
0 string PK\003\004
!:strength +1
# Starts with AndroidManifest.xml (file name length = 19)
>26 uleshort 19
>>30 string AndroidManifest.xml Android package (APK), with AndroidManifest.xml
>>>-22 string PK\005\006
>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
!:mime application/vnd.android.package-archive
!:ext apk
#!/usr/bin/python3
from calendar import monthrange
from datetime import datetime, timedelta
now = datetime.now()
print(now - timedelta(days=monthrange(now.year - (now.month == 1), (now.month - 2) % 12 + 1)[1]))
@obfusk
obfusk / convert_to_requests.py
Last active December 12, 2022 14:31
-> https://github.com/obfusk/convert-to-requests | parse a curl command (e.g. from "copy as cURL") from stdin and use python requests to execute it
#!/usr/bin/python3
# SPDX-FileCopyrightText: 2022 FC Stegerman <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later
import argparse
import json
import re
import shlex
import sys
@obfusk
obfusk / not-rb-messengers.md
Last active January 7, 2023 04:24
on android "secure messengers" and reproducible builds (or lack thereof)

Reproducible Builds

According to the reproducible builds definition:

A build is reproducible if given the same source code, build environment and build instructions, any party can recreate bit-by-bit identical copies of all specified artifacts.

In the case of android apps, that means bit-by-bit identical APK files.

@obfusk
obfusk / apps.sh
Last active December 9, 2022 03:02
-> https://github.com/obfusk/fdroid-misc-scripts | find differences between the F-Droid index and fdroiddata
#!/bin/bash
set -e
jq -r '.apps[].packageName' < index-v1.json | sort > index-apps
( cd fdroiddata/metadata; ls *.yml ) | sed 's!\.yml$!!' | sort > metadata-apps
( cd fdroiddata/metadata; grep -l 'ArchivePolicy: 0' *.yml ) | sed 's!\.yml$!!' | sort > metadata-apps-archived
diff -Naur metadata-apps metadata-apps-archived | grep ^- | cut -c2- | tail -n +2 > metadata-apps-not-archived
diff -Naur index-apps metadata-apps-not-archived | grep ^- | cut -c2- | tail -n +2 > index-apps-not-in-metadata
diff -Naur index-apps metadata-apps-not-archived | grep ^+ | cut -c2- | tail -n +2 > metadata-apps-not-in-index