Skip to main content

Smali ByteCode info (grammar) fetch tool written in Python

Project description

smalig

Dalvik(Smali) ByteCode info (grammar) fetch tool written in Python.

Description

smalig is a tool designed to fetch information about Dalvik(Smali) bytecode instructions. It allows users to specify a target instruction and retrieve detailed information about it, either in plain text or JSON format. This tool is particularly useful for developers and reverse engineers working with Android bytecode. Although there are many tools & resources available which does same job like Dalvik Bytecode Reference, Some chinese applications like MT Manager, NP, etc. but they all are very limited or little complex to understand and some are even outdated with no new instructions added. This tool is designed to be used from command line and can be integrated with other tools. We created it for our use in RevEngi project and decided to share it in the hope that it will be useful to others.

Features

  • Fetch information for specific Dalvik(Smali) instructions.
  • Output results in plain text or JSON format.
  • Save output to a specified file or print to the console.
  • Interactive mode for prompting user input.

Installation

To install smalig, you can use pip:

pip install smalig

or you can install it from source:

pip install git+https://github.com/RevEngiSquad/smalig.git

Usage/Examples

You can use smalig from the command line. Below are some examples of how to use the tool:

smalig -t "move"  # Fetch information for the 'move' instruction.
smalig -t "invoke-virtual" -j -o output.json # Fetch and save as JSON
smalig -o my_output.txt # Prompts for instruction then saves to my_output.txt

Output:

Opcode: 01
Name: move
Format: B|A|op
Format ID: 12x
Syntax: move vA, vB
Args: A: destination register (4 bits), B: source register (4 bits)
Short Info: Move the contents of one non-object register to another.
Detailed Info: Moves the content of vB into vA. Both registers must be in the first 16 register range (0-15).
Example: 0110 - move v0, v1
  Desc: Moves the content of v1 into v0.

As shown in the above example output, we've gone ahead and provided more detailed information about the instruction. This includes the opcode, format, syntax, arguments, and examples. This information can be useful for understanding the instruction and how it is used in Dalvik bytecode even for beginners.

Command Line Options

  • -t TARGET: Specify the Smali instruction to fetch. If omitted, prompts the user for input.
  • -j: Output the result as JSON. If -o is also specified and the OUTPUT_FILE ends in .json, this flag is automatically set.
  • -o OUTPUT_FILE: Write the output to the specified file. If omitted, prints to console.

Contributing

We welcome contribution(s) to smalig! They are what makes the open-source community such an amazing place to learn, inspire, and create. Any contribution(s) you make is/are greatly appreciated.

If you have a feature request or found a bug, please create an issue on the repo. You can also simply open an issue with the tag "enhancement" or "bug" and we will look into it.

If you would like to contribute, please follow these steps:

  1. Fork the repository: Click the "Fork" button in the top right corner of the repository page to create a copy of the repository in your GitHub account.

  2. Create a new branch: Create a new branch for your feature or bug fix:

    git checkout -b my-feature-branch
    
  3. Make your changes: Implement your feature or bug fix.

  4. Commit your changes: Commit your changes with a descriptive commit message:

    git commit -m "Description of my changes"
    
  5. Push to your fork: Push your changes to your forked repository:

    git push origin my-feature-branch
    
  6. Create a pull request: Go to the original repository and create a pull request from your forked repository. Provide a clear description of your changes and any related issues.

Guidelines

  • Write clear and concise commit messages.
  • Update documentation if necessary.
  • Write tests for new features or bug fixes if applicable.

Thank you for contributing to smalig!

Don't forget to star the repository if you found it useful.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Authors

Go to top

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smalig-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smalig-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file smalig-0.1.0.tar.gz.

File metadata

  • Download URL: smalig-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for smalig-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e3a3a4b6b26fffd36a8beaecd7768cf00207b7f5d06a5cfc51bb4337909c90db
MD5 8ca7a59248cd9ee058eb82b053a8c44c
BLAKE2b-256 8fdf08854dd803d95d85796072272c864645193b0840eca1d4497605e1c8f607

See more details on using hashes here.

Provenance

The following attestation bundles were made for smalig-0.1.0.tar.gz:

Publisher: python-publish.yml on RevEngiSquad/smalig

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smalig-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: smalig-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for smalig-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31f2429f7ffa036d7b9c8ce87b27758ab52ce773cc363c8319ec6bb22c29896d
MD5 41001e4bdb10f937536bf908dcd4ab2f
BLAKE2b-256 6e51f104bb9f6807ee71317af229f129db65d303fef239b0820777bca759f4fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for smalig-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on RevEngiSquad/smalig

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page