Name | smalig JSON |
Version |
0.1.6
JSON |
| download |
home_page | None |
Summary | Smali ByteCode info (grammar) fetch tool written in Python |
upload_time | 2024-12-19 23:36:44 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2024 RevEngi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
smali
grammar
parser
android
reverse-engineering
|
VCS |
|
bugtrack_url |
|
requirements |
PyYAML
jsbeautifier
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<a name="readme-top"></a>
# 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](https://source.android.com/devices/tech/dalvik/dalvik-bytecode), 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`:
```sh
pip install smalig
```
or you can install it from source:
```sh
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:
```sh
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
smalig -t "move" -m # Enable fuzzy matching
```
**Output:**
Normal output:
```plaintext
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.
```
With Fuzzy matching:
```plaintext
Result 1:
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.
Result 2:
Opcode: 02
Name: move/from16
Format: AA|op BBBB
Format ID: 22x
Syntax: move/from16 vAA, vBBBB
Args: A: destination register (8 bits), B: source register (16 bits)
Short Info: Move the contents of one non-object register to another.
Detailed Info: Moves the content of vB into vA. vB must be in the 64k register range (0-65535) while vA is one of the first 256 registers (0-255).
Example: 0200 1900 - move/from16 v0, v25
Desc: Moves the content of v25 into v0.
....(Redacted for brevity)
```
JSON output:
```json
{
"opcode": "01",
"name": "move",
"format": "B|A|op",
"format_id": "12x",
"syntax": "move vA, vB",
"args_info": "A: destination register (4 bits), B: source register (4 bits)",
"short_desc": "Move the contents of one non-object register to another.",
"long_desc": "Moves the content of vB into vA. Both registers must be in the first 16 register range (0-15).",
"note": "",
"example": "0110 - move v0, v1",
"example_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.
- `-m`: Enable fuzzy matching for the target instruction. This allows for partial matches.
- `-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:
```sh
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:
```sh
git commit -m "Description of my changes"
```
5. **Push to your fork**: Push your changes to your forked repository:
```sh
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](LICENSE) file for details.
<p align="right"><a href="#readme-top">Go to top</a></p>
Raw data
{
"_id": null,
"home_page": null,
"name": "smalig",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "smali, grammar, parser, android, reverse-engineering",
"author": null,
"author_email": "AbhiTheModder <allinoneallinone00@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/27/de/541a3bd234b0453489e95c313702ecbefcb4ec12132898761d668dc16f70/smalig-0.1.6.tar.gz",
"platform": null,
"description": "<a name=\"readme-top\"></a>\n# smalig\n\nDalvik(Smali) ByteCode info (grammar) fetch tool written in Python.\n\n## Description\n\n`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](https://source.android.com/devices/tech/dalvik/dalvik-bytecode), 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.\n\n## Features\n\n- Fetch information for specific Dalvik(Smali) instructions.\n- Output results in plain text or JSON format.\n- Save output to a specified file or print to the console.\n- Interactive mode for prompting user input.\n\n\n## Installation\n\nTo install `smalig`, you can use `pip`:\n\n```sh\npip install smalig\n```\n\nor you can install it from source:\n\n```sh\npip install git+https://github.com/RevEngiSquad/smalig.git\n```\n\n## Usage/Examples\n\nYou can use `smalig` from the command line. Below are some examples of how to use the tool:\n\n```sh\nsmalig -t \"move\" # Fetch information for the 'move' instruction.\nsmalig -t \"invoke-virtual\" -j -o output.json # Fetch and save as JSON\nsmalig -o my_output.txt # Prompts for instruction then saves to my_output.txt\nsmalig -t \"move\" -m # Enable fuzzy matching\n```\n\n**Output:**\nNormal output:\n```plaintext\nOpcode: 01\nName: move\nFormat: B|A|op\nFormat ID: 12x\nSyntax: move vA, vB\nArgs: A: destination register (4 bits), B: source register (4 bits)\nShort Info: Move the contents of one non-object register to another.\nDetailed Info: Moves the content of vB into vA. Both registers must be in the first 16 register range (0-15).\nExample: 0110 - move v0, v1\n Desc: Moves the content of v1 into v0.\n```\n\nWith Fuzzy matching:\n```plaintext\nResult 1:\nOpcode: 01\nName: move\nFormat: B|A|op\nFormat ID: 12x\nSyntax: move vA, vB\nArgs: A: destination register (4 bits), B: source register (4 bits)\nShort Info: Move the contents of one non-object register to another.\nDetailed Info: Moves the content of vB into vA. Both registers must be in the first 16 register range (0-15).\nExample: 0110 - move v0, v1\n Desc: Moves the content of v1 into v0.\n\nResult 2:\nOpcode: 02\nName: move/from16\nFormat: AA|op BBBB\nFormat ID: 22x\nSyntax: move/from16 vAA, vBBBB\nArgs: A: destination register (8 bits), B: source register (16 bits)\nShort Info: Move the contents of one non-object register to another.\nDetailed Info: Moves the content of vB into vA. vB must be in the 64k register range (0-65535) while vA is one of the first 256 registers (0-255).\nExample: 0200 1900 - move/from16 v0, v25\n Desc: Moves the content of v25 into v0.\n\n....(Redacted for brevity)\n```\n\nJSON output:\n```json\n{\n \"opcode\": \"01\",\n \"name\": \"move\",\n \"format\": \"B|A|op\",\n \"format_id\": \"12x\",\n \"syntax\": \"move vA, vB\",\n \"args_info\": \"A: destination register (4 bits), B: source register (4 bits)\",\n \"short_desc\": \"Move the contents of one non-object register to another.\",\n \"long_desc\": \"Moves the content of vB into vA. Both registers must be in the first 16 register range (0-15).\",\n \"note\": \"\",\n \"example\": \"0110 - move v0, v1\",\n \"example_desc\": \"Moves the content of v1 into v0.\"\n}\n```\n\nAs 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.\n\n### Command Line Options\n\n- `-t TARGET`: Specify the Smali instruction to fetch. If omitted, prompts the user for input.\n- `-j`: Output the result as JSON. If `-o` is also specified and the `OUTPUT_FILE` ends in `.json`, this flag is automatically set.\n- `-m`: Enable fuzzy matching for the target instruction. This allows for partial matches.\n- `-o OUTPUT_FILE`: Write the output to the specified file. If omitted, prints to console.\n\n## Contributing\nWe 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.\n\nIf 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.\n\nIf you would like to contribute, please follow these steps:\n\n1. **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.\n\n2. **Create a new branch**: Create a new branch for your feature or bug fix:\n ```sh\n git checkout -b my-feature-branch\n ```\n\n3. **Make your changes**: Implement your feature or bug fix.\n\n4. **Commit your changes**: Commit your changes with a descriptive commit message:\n ```sh\n git commit -m \"Description of my changes\"\n ```\n\n5. **Push to your fork**: Push your changes to your forked repository:\n ```sh\n git push origin my-feature-branch\n ```\n\n6. **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.\n\n### Guidelines\n\n- Write clear and concise commit messages.\n- Update documentation if necessary.\n- Write tests for new features or bug fixes if applicable.\n\nThank you for contributing to `smalig`!\n\nDon't forget to star the repository if you found it useful.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n<p align=\"right\"><a href=\"#readme-top\">Go to top</a></p>\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 RevEngi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Smali ByteCode info (grammar) fetch tool written in Python",
"version": "0.1.6",
"project_urls": {
"homepage": "https://github.com/RevEngiSquad/smalig",
"issues": "https://github.com/RevEngiSquad/smalig/issues",
"source": "https://github.com/RevEngiSquad/smalig"
},
"split_keywords": [
"smali",
" grammar",
" parser",
" android",
" reverse-engineering"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d047ddf68e7d3c1f3eb0c1c82ac031158484a53bfa1eb3f7d6d78964f7aa4143",
"md5": "e28d037ff5ddf60bb5c3f688dcf718cf",
"sha256": "d63b0e290497aa1a71d649a22da48a3b9d56500358453c724d8c5ebbe9225c9d"
},
"downloads": -1,
"filename": "smalig-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e28d037ff5ddf60bb5c3f688dcf718cf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 11503,
"upload_time": "2024-12-19T23:36:43",
"upload_time_iso_8601": "2024-12-19T23:36:43.780638Z",
"url": "https://files.pythonhosted.org/packages/d0/47/ddf68e7d3c1f3eb0c1c82ac031158484a53bfa1eb3f7d6d78964f7aa4143/smalig-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "27de541a3bd234b0453489e95c313702ecbefcb4ec12132898761d668dc16f70",
"md5": "f43be503d775e79f20c186ae9d9d6474",
"sha256": "e2b0eff6880f77aa49bd6feb8fdd96af0e1a674bf85cd928fa46525ae8fe2d9a"
},
"downloads": -1,
"filename": "smalig-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "f43be503d775e79f20c186ae9d9d6474",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 12434,
"upload_time": "2024-12-19T23:36:44",
"upload_time_iso_8601": "2024-12-19T23:36:44.956873Z",
"url": "https://files.pythonhosted.org/packages/27/de/541a3bd234b0453489e95c313702ecbefcb4ec12132898761d668dc16f70/smalig-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-19 23:36:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "RevEngiSquad",
"github_project": "smalig",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "PyYAML",
"specs": []
},
{
"name": "jsbeautifier",
"specs": []
}
],
"lcname": "smalig"
}