mirror of
https://github.com/NohamR/RMHook-Android.git
synced 2026-10-10 18:29:42 +00:00
Add auto-install flow and move scripts folder
This commit is contained in:
32
README.md
32
README.md
@@ -28,20 +28,22 @@ Only `arm64-v8a` is supported (the hook library and PLT hooks are ARM64-specific
|
||||
|
||||
## Installation and usage
|
||||
|
||||
⚠️ **For legal reasons, this repository does not include the reMarkable app.** You must provide your own APKs (see the Building section).
|
||||
⚠️ **For legal reasons, this repository does not include the reMarkable app.** However, the latest compiled `.so` files are available in the [Releases](https://github.com/NohamR/RMHook-Android/releases/latest) section.
|
||||
|
||||
### Prerequisites
|
||||
### Auto installation
|
||||
|
||||
A macOS or Linux build host with:
|
||||
Run in a terminal:
|
||||
**Requirements:** `apktool`, `adb`, Android SDK build-tools (`zipalign`, `apksigner`), and `keytool` must be installed.
|
||||
|
||||
- **Android SDK Build Tools** (`zipalign`, `apksigner`) — install via Android Studio's SDK Manager or `sdkmanager "build-tools;36.0.0"`.
|
||||
- **Android NDK** — e.g. `brew install --cask android-ndk` on macOS. Used to cross-compile `librmhook.so` for `aarch64-linux-android`.
|
||||
- **apktool** — `brew install apktool` on macOS. Used to inject the `System.loadLibrary` call into `MainActivity.smali`.
|
||||
- **Python 3** — used to install Qt via `aqtinstall`.
|
||||
- **Java** — for `keytool` (signing keystore generation).
|
||||
- The reMarkable Android **APK splits** (base + arm64 + xxhdpi).
|
||||
```bash
|
||||
bash <(curl -sL https://raw.githubusercontent.com/NohamR/RMHook-Android/refs/heads/main/scripts/auto-install.sh)
|
||||
```
|
||||
|
||||
### Pull the APK splits from your device
|
||||
This will download the pre-built libraries, pull the APK splits from your device, inject the hook, and install the patched app.
|
||||
|
||||
### Manual installation
|
||||
|
||||
#### Step 1: Pull the APK splits from your device
|
||||
|
||||
```bash
|
||||
# List the paths of the installed splits
|
||||
@@ -62,13 +64,13 @@ You should now have three files in `~/reMarkable/app/`:
|
||||
### Build
|
||||
|
||||
```bash
|
||||
./script/build.sh
|
||||
./scripts/build.sh
|
||||
```
|
||||
|
||||
### Inject & sign
|
||||
|
||||
```bash
|
||||
./script/inject.sh [apk_dir] # apk_dir defaults to ~/reMarkable/app
|
||||
./scripts/inject.sh [apk_dir] # apk_dir defaults to ~/reMarkable/app
|
||||
```
|
||||
|
||||
Patches `base.apk`'s smali to `loadLibrary("rmhook")`, bundles `librmhook.so` + `libshadowhook_nothing.so` into the arm64 split, aligns and signs everything and puts the result in `output/`.
|
||||
@@ -125,7 +127,7 @@ Ensure the following are set or auto-detected:
|
||||
### 3. Compile
|
||||
|
||||
```bash
|
||||
./script/build.sh
|
||||
./scripts/build.sh
|
||||
```
|
||||
|
||||
## Debugging
|
||||
@@ -172,8 +174,8 @@ When the app attempts to connect to reMarkable's servers (e.g., `internal.cloud.
|
||||
|
||||
- xovi-rmfakecloud: [asivery/xovi-rmfakecloud](https://github.com/asivery/xovi-rmfakecloud) - Original hooking information
|
||||
- rmfakecloud: [ddvk/rmfakecloud](https://github.com/ddvk/rmfakecloud) - Self-hosted reMarkable cloud
|
||||
- bytedance/android-inline-hook: [bytedance/android-inline-hook](https://github.com/bytedance/android-inline-hook) — ShadowHook, the inline hook library used for intercepting Qt function calls
|
||||
- Dapitch666: [Dapitch666](https://github.com/dapitch666/) — initial proof-of-concept for hooking the reMarkable Android app and redirecting to rmfakecloud
|
||||
- ShadowHook: [bytedance/android-inline-hook](https://github.com/bytedance/android-inline-hook) - Inline hook library for intercepting Qt function calls
|
||||
- Dapitch666: [dapitch666](https://github.com/dapitch666/) - Initial proof-of-concept for hooking the reMarkable Android app
|
||||
|
||||
## License
|
||||
|
||||
|
||||
94
scripts/auto-install.sh
Executable file
94
scripts/auto-install.sh
Executable file
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env bash
|
||||
REPO="NohamR/RMHook-Android"
|
||||
WORKDIR="/tmp/rmhook"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# --- Check dependencies ---
|
||||
echo "[INFO] Checking dependencies..."
|
||||
MISSING=()
|
||||
for cmd in adb apktool keytool; do
|
||||
command -v "$cmd" >/dev/null 2>&1 || MISSING+=("$cmd")
|
||||
done
|
||||
# Check Android SDK build-tools (zipalign + apksigner)
|
||||
SDK_ROOT="${ANDROID_SDK_ROOT:-$HOME/Library/Android/sdk}"
|
||||
BUILD_TOOLS="$(find "$SDK_ROOT/build-tools" -maxdepth 1 -type d 2>/dev/null | sort -V | tail -1)"
|
||||
if [ -z "$BUILD_TOOLS" ] || [ ! -d "$BUILD_TOOLS" ]; then
|
||||
MISSING+=("Android SDK build-tools (zipalign, apksigner)")
|
||||
fi
|
||||
if [ ${#MISSING[@]} -gt 0 ]; then
|
||||
echo "❌ Missing required tools:"
|
||||
for m in "${MISSING[@]}"; do echo " - $m"; done
|
||||
echo ""
|
||||
echo "Install with:"
|
||||
echo " brew install apktool android-platform-tools"
|
||||
echo " # Android SDK build-tools via Android Studio SDK Manager"
|
||||
exit 1
|
||||
fi
|
||||
export ANDROID_SDK_BUILD_TOOLS="$BUILD_TOOLS"
|
||||
|
||||
# --- Setup workspace ---
|
||||
echo "[INFO] Setting up workspace..."
|
||||
rm -rf "$WORKDIR"
|
||||
mkdir -p "$WORKDIR/build" "$WORKDIR/libs" "$WORKDIR/config" "$WORKDIR/output"
|
||||
|
||||
# --- Download .so files from releases ---
|
||||
echo "[INFO] Downloading librmhook.so..."
|
||||
curl -sL \
|
||||
-o "$WORKDIR/build/librmhook.so" \
|
||||
"https://github.com/$REPO/releases/latest/download/librmhook.so"
|
||||
|
||||
echo "[INFO] Downloading libshadowhook_nothing.so..."
|
||||
curl -sL \
|
||||
-o "$WORKDIR/libs/libshadowhook_nothing.so" \
|
||||
"https://github.com/$REPO/releases/latest/download/libshadowhook_nothing.so"
|
||||
|
||||
# --- Download inject script ---
|
||||
echo "[INFO] Downloading inject script..."
|
||||
curl -sL \
|
||||
-o "$WORKDIR/inject.sh" \
|
||||
"https://raw.githubusercontent.com/$REPO/refs/heads/main/scripts/inject.sh"
|
||||
chmod +x "$WORKDIR/inject.sh"
|
||||
|
||||
# --- Pull APK splits from device ---
|
||||
APK_DIR="$HOME/reMarkable/app"
|
||||
mkdir -p "$APK_DIR"
|
||||
|
||||
echo "[INFO] Detecting reMarkable app on device..."
|
||||
PKG_PATHS="$(adb shell pm path com.remarkable.mobile 2>/dev/null || true)"
|
||||
if [ -z "$PKG_PATHS" ]; then
|
||||
echo "❌ reMarkable app not found on device. Install it from the Play Store first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[INFO] Pulling APK splits..."
|
||||
while IFS= read -r line; do
|
||||
APK_PATH="${line#package:}"
|
||||
APK_NAME="$(basename "$APK_PATH")"
|
||||
echo " Pulling $APK_NAME..."
|
||||
adb pull "$APK_PATH" "$APK_DIR/$APK_NAME" 2>/dev/null
|
||||
done <<< "$PKG_PATHS"
|
||||
|
||||
if [ ! -f "$APK_DIR/base.apk" ]; then
|
||||
echo "❌ Failed to pull base.apk"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Run inject ---
|
||||
echo "[INFO] Running inject script..."
|
||||
"$WORKDIR/inject.sh" "$APK_DIR"
|
||||
|
||||
# --- Install ---
|
||||
echo "[INFO] Installing patched APKs..."
|
||||
adb uninstall com.remarkable.mobile 2>/dev/null || true
|
||||
adb install-multiple --no-streaming "$WORKDIR/output/base.apk" "$WORKDIR/output/split_config.arm64_v8a.apk" "$WORKDIR/output/split_config.xxhdpi.apk"
|
||||
|
||||
echo ""
|
||||
echo "✅ Done! RMHook is installed on your reMarkable."
|
||||
echo ""
|
||||
echo "📋 Next steps:"
|
||||
echo " 1. Open the reMarkable app"
|
||||
echo " 2. Configure your rmfakecloud host and port"
|
||||
echo ""
|
||||
echo "🔍 To debug:"
|
||||
echo " adb logcat -s 'RMHook:*'"
|
||||
@@ -120,5 +120,5 @@ echo "✅ Compilation successful!"
|
||||
echo "📍 Library: $BUILD_DIR/$SO_NAME ($(ls -lh "$BUILD_DIR/$SO_NAME" | awk '{print $5}'))"
|
||||
echo ""
|
||||
echo "🚀 To inject into the reMarkable application:"
|
||||
echo " ./script/inject.sh"
|
||||
echo " ./scripts/inject.sh"
|
||||
echo ""
|
||||
@@ -60,7 +60,7 @@ echo "📦 APK source: $APK_DIR"
|
||||
echo ""
|
||||
|
||||
if [ ! -f "$BUILD_DIR/librmhook.so" ]; then
|
||||
echo "❌ librmhook.so not found. Run ./script/build.sh first."
|
||||
echo "❌ librmhook.so not found. Run ./scripts/build.sh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user