From 40547919cec89cdee9f4de3d8eb3bc1c0701164b Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 27 Jan 2025 00:38:16 +0100 Subject: [PATCH] Remove legacy patchers --- patching-server/README.md | 7 -- patching-server/server.py | 99 ------------------- .../META-INF/com/google/android/update-binary | 33 ------- .../com/google/android/updater-script | 1 - root-module-manual/module.prop | 6 -- root-module-manual/post-data-fs.sh | 2 - 6 files changed, 148 deletions(-) delete mode 100644 patching-server/README.md delete mode 100644 patching-server/server.py delete mode 100644 root-module-manual/META-INF/com/google/android/update-binary delete mode 100644 root-module-manual/META-INF/com/google/android/updater-script delete mode 100644 root-module-manual/module.prop delete mode 100644 root-module-manual/post-data-fs.sh diff --git a/patching-server/README.md b/patching-server/README.md deleted file mode 100644 index bda87ce..0000000 --- a/patching-server/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Patcher Server - -This is the server side of the patcher. It is responsible for serving the patch files to the clients. - -# License - -Same as project license. Check [/LICENSE](/LICENSE) for more information. \ No newline at end of file diff --git a/patching-server/server.py b/patching-server/server.py deleted file mode 100644 index 2cebfc4..0000000 --- a/patching-server/server.py +++ /dev/null @@ -1,99 +0,0 @@ -from flask import Flask, request, jsonify, send_file -import os -import uuid -import logging -import re -import subprocess -import sys - -app = Flask(__name__) - -# Configure logging -class LogColors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKCYAN = '\033[96m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - UNDERLINE = '\033[4m' - -class ColoredFormatter(logging.Formatter): - def format(self, record): - log_colors = { - 'DEBUG': LogColors.OKCYAN, - 'INFO': LogColors.OKGREEN, - 'WARNING': LogColors.WARNING, - 'ERROR': LogColors.FAIL, - 'CRITICAL': LogColors.FAIL + LogColors.BOLD - } - log_color = log_colors.get(record.levelname, LogColors.ENDC) - record.msg = f"{log_color}{record.msg}{LogColors.ENDC}" - return super().format(record) - -logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') -logger = logging.getLogger() -handler = logger.handlers[0] -handler.setFormatter(ColoredFormatter('%(asctime)s - %(levelname)s - %(message)s')) - -def run_command(command): - logging.info(f"Running command: {command}") - result = subprocess.run(command, shell=True, capture_output=True, text=True) - if result.returncode != 0 and "Cannot determine entrypoint" not in result.stderr: - logging.error(f"Command failed: {command}\n{result.stderr}") - sys.exit(1) - logging.info(f"Command output: {result.stdout}") - return result.stdout - -def get_symbol_address(file_path, symbol_name): - logging.info(f"Getting address for symbol: {symbol_name}") - output = run_command(f"radare2 -q -e bin.cache=true -c 'is~{symbol_name}' -z {file_path}") - match = re.search(r'0x[0-9a-fA-F]+', output) - if match: - address = match.group(0) - logging.info(f"Found address for {symbol_name}: {address}") - return address - else: - logging.error(f"Symbol {symbol_name} not found in {file_path}") - sys.exit(1) - -def patch_address(file_path, address, patch_bytes): - logging.info(f"Patching address {address} with bytes: {patch_bytes}") - run_command(f"radare2 -q -e bin.cache=true -w -c 's {address}; wx {patch_bytes}; wci' {file_path}") - logging.info(f"Successfully patched address {address}") - -@app.route('/api', methods=['POST']) -def api(): - if 'file' not in request.files: - return jsonify({"error": "No file part"}), 400 - file = request.files['file'] - if file.filename == '': - return jsonify({"error": "No selected file"}), 400 - if not file.filename.endswith('.so'): - return jsonify({"error": "Invalid file type. Only .so files are allowed."}), 400 - - file_uuid = str(uuid.uuid4()) - file_path = os.path.join('uploads', f"{file_uuid}_{file.filename}") - file.save(file_path) - - try: - l2c_fcr_chk_chan_modes_address = get_symbol_address(file_path, "l2c_fcr_chk_chan_modes") - patch_address(file_path, l2c_fcr_chk_chan_modes_address, "20008052c0035fd6") - l2cu_send_peer_info_req_address = get_symbol_address(file_path, "l2cu_send_peer_info_req") - patch_address(file_path, l2cu_send_peer_info_req_address, "c0035fd6") - except Exception as e: - logger.error(f"Error patching file: {str(e)}") - return jsonify({"error": f"Error patching file: {str(e)}"}), 500 - - try: - return send_file(file_path, as_attachment=True, download_name=file.filename) - except Exception as e: - logger.error(f"Error sending file: {str(e)}") - return jsonify({"error": f"Error sending file: {str(e)}"}), 500 - -if not os.path.exists('uploads'): - os.makedirs('uploads') -if __name__ == '__main__': - app.run(debug=True, host='0.0.0.0', port=8080) diff --git a/root-module-manual/META-INF/com/google/android/update-binary b/root-module-manual/META-INF/com/google/android/update-binary deleted file mode 100644 index ea4889e..0000000 --- a/root-module-manual/META-INF/com/google/android/update-binary +++ /dev/null @@ -1,33 +0,0 @@ -#!/sbin/sh - -################# -# Initialization -################# - -umask 022 - -# echo before loading util_functions -ui_print() { echo "$1"; } - -require_new_magisk() { - ui_print "*******************************" - ui_print " Please install Magisk v20.4+! " - ui_print "*******************************" - exit 1 -} - -######################### -# Load util_functions.sh -######################### - -OUTFD=$2 -ZIPFILE=$3 - -mount /data 2>/dev/null - -[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk -. /data/adb/magisk/util_functions.sh -[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk - -install_module -exit 0 \ No newline at end of file diff --git a/root-module-manual/META-INF/com/google/android/updater-script b/root-module-manual/META-INF/com/google/android/updater-script deleted file mode 100644 index 11d5c96..0000000 --- a/root-module-manual/META-INF/com/google/android/updater-script +++ /dev/null @@ -1 +0,0 @@ -#MAGISK diff --git a/root-module-manual/module.prop b/root-module-manual/module.prop deleted file mode 100644 index 616d101..0000000 --- a/root-module-manual/module.prop +++ /dev/null @@ -1,6 +0,0 @@ -id=btl2capfix -name=Bluetooth L2CAP workaround for AirPods -version=v1 -versionCode=1 -author=kavishdevar -description=Fixes the Bluetooth L2CAP connection issue with AirPods \ No newline at end of file diff --git a/root-module-manual/post-data-fs.sh b/root-module-manual/post-data-fs.sh deleted file mode 100644 index ad2ab8b..0000000 --- a/root-module-manual/post-data-fs.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/system/bin/sh -mount -t overlay overlay -o lowerdir=/apex/com.android.btservices/lib64/,upperdir=/data/adb/modules/btl2capfix/apex/com.android.btservices/lib64,workdir=/data/adb/modules/btl2capfix/apex/com.android.btservices/work Zapex/com.android.btservices/lib64