Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

looking for a parser for smali files

It exist a parser for the .smali files?
Let me be more explicative:
i need to code a program.
the input of this program is a .smali file.
this program ( thanks to the parser i'm looking for ) should catch every time a global variable is declarated.
next step add some code.
is that possible, or no parser yet exist for a similar task?
Thank you.

like image 601
Fujitina Avatar asked Sep 12 '25 23:09

Fujitina


1 Answers

This is the parser that smali itself uses when reassembling the smali files.

https://github.com/JesusFreke/smali/blob/master/smali/src/main/antlr/smaliParser.g

Another option might be to use dexlib2 directly to read in a dex file, perform the modifications you want, and write it back out.

like image 69
JesusFreke Avatar answered Sep 15 '25 12:09

JesusFreke