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.
Asked
Active
Viewed 2,354 times
4

Fujitina
- 129
- 1
- 2
- 16
1 Answers
6
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.

JesusFreke
- 19,784
- 5
- 65
- 68
-
This looks like a good solution, just for helping introduce people to the smali practices (including me) Could you point out to a step-by-step guide on how to parse smali files? That would be awesome. There is a lack of clear parse explanations out there in my opinion. For example in my case I cannot manage to parse smali to sqlite. cheers. – JCO9 Jun 20 '18 at 11:50