Skip to content

Instantly share code, notes, and snippets.

@5ec1cff
5ec1cff / find_zip_entry.cpp
Created April 16, 2024 16:15
Find zip entry by offset
#include <cstdio>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <cstring>
#include <cerrno>
#include <string>
#include <utility>
#include <cstdlib>
#include <iostream>
#include <sys/inotify.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/unistd.h>
#define TMP_FILE "/tmp/fake.brightness"
#define HIJACK_FILE "/sys/class/backlight/intel_backlight/brightness"
@mochaaP
mochaaP / shc is not kool.md
Last active February 6, 2024 12:02
An attempt to restore the original shell scripts from KoolShare firmwares

shc is not kool

An analysis on shc-produced binaries, ARC4 encryption and the GPL-violating "KoolShare" custom firmware for ASUSWRT devices.

See prior art here: https://github.com/yanncam/UnSHc

Background

So I've got a few ASUS routers with Broadcom chips. It ships with ancient kernel (2.6.36) and a messy userland. Seemed KoolShare's members found a reliable way to run background daemons on those cursed™ devices, but they didn't want to public it and obfuscated the scripts with shc.

@vvb2060
vvb2060 / am_proc_start.cpp
Created July 19, 2022 17:12
monitor app process start
#include <unistd.h>
#include <string>
#include <cinttypes>
#include <android/log.h>
#include <sys/system_properties.h>
using namespace std;
extern "C" {
@tothi
tothi / magisk_ramdisk_patch_avd.sh
Last active July 18, 2024 06:46
Apply Magisk patches on AVD (Android Emulator) RAMDISK images for running Magisk (root) on Android Emulators
#!/bin/bash
#
# patch ramdisk.img (for installing Magisk on x64 Android emulator)
#
# x86_64 on Android 12 (API Level 32) is supported/tested currently
#
# install AVD:
#
# sudo sdkmanager 'system-images;android-32;google_apis_playstore;x86_64'
@sopanatx
sopanatx / bootloader_miui.java
Created March 3, 2022 10:00
Xiaomi Bootloader Bind API
package com.android.settings.bootloader;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.android.settings.AESUtil;
import com.android.settings.bootloader.Utils;
@agnostic-apollo
agnostic-apollo / Android-Phantom,Cached-And-Empty-Processes.md
Last active June 19, 2024 23:49
Android Phantom, Cached And Empty Processes
@FreddieOliveira
FreddieOliveira / docker.md
Last active July 25, 2024 00:50
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@vvb2060
vvb2060 / ndk.diff
Last active November 24, 2023 14:55
NDK strip static library patch
build-binary.mk | 8 ++++++++
default-build-commands.mk | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/build-binary.mk b/build-binary.mk
index 6241dcc..bdf7d20 100644
--- a/build-binary.mk
+++ b/build-binary.mk
@@ -596,11 +596,19 @@ $(LOCAL_BUILT_MODULE): PRIVATE_ABI := $(TARGET_ARCH_ABI)
$(LOCAL_BUILT_MODULE): PRIVATE_AR := $(TARGET_AR) $(ar_flags) $(TARGET_AR_FLAGS)
@RikkaW
RikkaW / gist:be3fe4178903702c54ec73b2fc1187fe
Last active March 26, 2024 14:45
show window in app_process (impossible to work from Android 14 QPR 3 or Android 15, as addView requires the calling process an Android app process)
token = new Binder();
try {
Context _context = android.app.ActivityThread.systemMain().getSystemContext();
final Context context = new ContextWrapper(_context) {
@Override
public Object getSystemService(String name) {
if (Context.WINDOW_SERVICE.equals(name)) {
WindowManager wm = (WindowManager) super.getSystemService(name);
if (wm != null) {
((android.view.WindowManagerImpl) wm).setDefaultToken(token);