Git Product home page Git Product logo

droid-scripts's Introduction

Droid Scripts

中文版:https://github.com/izgzhen/droid-scripts/blob/master/README_Chinese.md

Executable scripts for helping with Android related work.

Most of them are either wrappers of existing third-party tool's released jars or Android SDK tools' executables e.g. adb (inside path/to/sdk/platform-tools), aapt (inside path/to/sdk/build-tools/<version>).

NOTE: Install build tools path/to/sdk/tools/bin/sdkmanager 'build-tools;29.0.3'

Launch app on connected device

Depends on python3 and msbase package.

./launch-apk.py launch path/to/apk

NOTE: this python script also supports printing the application label and package of an apk:

./launch-apk.py label path/to/apk
./launch-apk.py package path/to/apk

Make an APK debuggable

  • python debug-sign.py <input-apk-path> <output-apk-path>

Decompile APK to Smali code

baksmali d path/to/apk -o path/to/output/dir

Version: 2.4.0, from https://github.com/JesusFreke/smali/ (also include smali)

Decompile APK to Smali and other resources

apktool d path/to/apk -o path/to/output/dir

Version: 2.4.1, from https://ibotpeaches.github.io/Apktool/

Dump classes list and basic stats of top-level namespace

pkg-classes path/to/apk path/to/txt

Check the view hierarchy of APK dynamically

  1. Make a debuggable copy of it using debug-sign.apk
  2. (Option 1) Use Android Studio to debug/profile it
  • Tools -> Layout Inspector
    • Choose the corresponding Activity
  1. (Option 2) Use scripts:
  • adb-uidump path/to/output/xml
  • adb-uidump-compressed path/to/output/xml

Dump metadata about APK

  • aapt dump badging path/to/apk
    • application-label:: show package label
    • package: name: show package name
  • aapt dump permissions path/to/apk: show permission

Copy back APK installed on phone

adb shell pm list packages # find the package name from the output
adb shell pm path <package-name> # outputs <target-apk-path>
adb pull <target-apk-path> <apk-output>

Install APK to phone via CLI

adb install path/to/apk

Retargeting Dex to Java Classes

NOTE: Build the Docker image with make first

Make sure your APK file (not symbolic link) is under apks in this directory.

./dare.py apks/example.apk <sha256sum>

Then you can find (Java classes) outputs in output/dare/

Inter-Component Communication (ICC) analysis

NOTE: this depends on "Dare" introduced above. Also, you should set env var ANDROID_SDK to the Android SDK directory, such that the tool can find $ANDROID_SDK/platforms/android-23/android.jar.

path/to/ic3.py path/to/example.apk <sha256sum> <apk-package-name> path/to/dare/classes path/to/output.txt

Then you can find (text-format Protobuf) output at path/to/output.txt

Getting name of current activity

adb shell dumpsys activity

Related work

droid-scripts's People

Contributors

izgzhen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.