Coder Social home page Coder Social logo

snowden-aq / androiddrivesignity Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 34 KB

AndroidDriveSignity is a Python utility designed to bypass driver signature verification in Android kernel(ARMv8.3), facilitating the loading of custom drivers

Home Page: https://github.com/gmh5225/android-kernel-driver-template

License: MIT License

Python 100.00%

androiddrivesignity's Introduction

AndroidDriveSignity

AndroidDriveSignity is a Python script designed for patching Android kernel(ARMv8.3) files, enabling the loading of drivers without being subject to various verification checks, specifically signature verifications. This tool aims to facilitate the development and testing process by allowing developers to bypass the kernel's built-in security measures that prevent unofficial or modified drivers from being loaded.

Features

  • Targeted Symbol Patching: Modifies specific symbols within the kernel (check_modinfo, check_version, and module_sig_check) to circumvent driver signature verification mechanisms.
  • Intelligent Patching: Dynamically adjusts patching based on the presence of the PACIASP instruction, ensuring compatibility across different kernel configurations.
  • User-Friendly CLI: Provides a straightforward command-line interface for specifying the kernel binary, the kallsyms symbol table, and the output file paths.

Requirements

  • Rooted Android devices(ARMv8.3) with Magisk or KernelSU
  • Python 3.x
  • ADB

Usage

  1. Prepare the Necessary Files: Ensure you have the kernel binary file (kernel_file_path), the kallsyms symbol table file (kallsyms_file_path), and a destination for the patched kernel (output_file_path).

  2. Execute AndroidDriveSignity: Navigate to the script's directory in your terminal or command prompt and run:

    python AndroidDriveSignity.py <kernel_file_path> <kallsyms_file_path> <output_file_path>
    

How to get your kallsyms?

adb shell
su
echo 0 > /proc/sys/kernel/kptr_restrict
exit
exit
adb shell su -c "cat /proc/kallsyms > /data/local/tmp/kallsyms"
adb pull /data/local/tmp/kallsyms

How to extract your kernel file?

If there are two partitions, prioritize trying "boot_a":

adb shell su -c "dd if=$(readlink /dev/block/by-name/boot_a) of=/data/local/tmp/boot.img"

If there is only one partition, then it is "boot.img":

adb shell su -c "dd if=$(readlink /dev/block/by-name/boot) of=/data/local/tmp/boot.img"

Then, pull the boot image to your local machine:

adb pull /data/local/tmp/boot.img

Finally, use magiskboot to extract the kernel file from boot.img.

magiskboot --unpack boot.img

You will obtain two files: one is the kernel(your kernel file), and the other is ramdisk.cpio.

Testing on android12-5.10

python AndroidDriveSignity.py kernel kallsyms new-kernel
move/mv new-kernel kernel
magiskboot --repack boot.img
adb reboot bootloader
fastboot flash boot new-boot.img
fastboot reboot
adb push demo.ko /data/local/tmp
adb shell su -c insmod /data/local/tmp/demo.ko
adb shell su -c "lsmod |grep demo"
adb shell su -c rmmod /data/local/tmp/demo.ko

You can obtain an example of the Android driver here

Credits

  • Linux
  • Android
  • Some anonymous people

androiddrivesignity's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.