ClassyShark Documentation

repository·master·Indexed 27 days ago

https://github.com/google/android-classyshark

A tool for inspecting Android archives such as APKs and AABs to programmatically access internal structures including classes, methods, manifests, and string tables. It provides a Shark API for integration into builds or CI pipelines, as well as a CLI and GUI for analyzing .jar, .apk, .dex, and .class files.

Tokens
788
Snippets
1
Records
7
Agent score
93%

What's inside ClassyShark

  1. Sign a Contributor License Agreement (CLA)

    master

    Before submitting pull requests to this repository, you must sign a Contributor License Agreement (CLA). Choose the appropriate agreement based on your situation:

    • Individual: If you are an individual writing original source code and own the intellectual property, sign the individual CLA.
    • Corporate: If you work for a company that is authorizing your contribution, sign the corporate CLA.

    Once the CLA is received, your pull requests can be accepted.

  2. Submit a patch to the repository

    master

    To contribute code changes to this project, follow these steps:

    1. Submit an issue: Describe your proposed change in an issue within the relevant repository.
    2. Wait for approval: The repository owner will respond to your issue. If accepted, proceed to the next steps.
    3. Sign CLA: If you haven't already, sign the appropriate Contributor License Agreement.
    4. Fork and Develop: Fork the repository, then develop and test your changes locally.
    5. Adhere to Style Guide: Ensure your code follows the Android Code Style Guide.
    6. Add Unit Tests: Ensure your code includes an appropriate set of unit tests and that all tests pass.
    7. Submit Pull Request: Submit your changes via a pull request.
  3. Use the Shark API to inspect archives

    master

    You can use the Shark class to inspect an archive file (such as an APK or AAB) and retrieve metadata including class names, methods, manifests, and string tables.

    To get started, use Shark.with(File archiveFile) to create a new instance pointing to your target file.

  4. Retrieve class and method information using Shark

    master

    Once a Shark instance is initialized, you can query it for various components of the archive:

    • getAllClassNames(): Returns a List<String> of all class names found in the archive.
    • getGeneratedClass(String className): Returns a String representing the generated class for a specific input class name (e.g., com.bumptech.glide.request.target.BaseTarget).
    • getAllMethods(): Returns a List<String> of all methods found.
    • getManifest(): Returns the manifest content as a String.
    • getAllStrings(): Returns a List<String> containing all strings from all string tables.
  5. Run ClassyShark in GUI or CLI mode

    master

    ClassyShark can be launched via its Main entrypoint. The application determines the execution mode based on the command-line arguments provided:

    • GUI Mode: Triggered if no arguments are provided or if the first argument is -open (case-insensitive).
    • CLI Mode: Triggered if any other arguments are provided.

    When the application starts, it automatically registers an activation with Analytics.INSTANCE.