Skip to content

Instantly share code, notes, and snippets.

@nfalliere
Created August 27, 2021 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfalliere/94351c2cf59d4a595990afe14fec75bc to your computer and use it in GitHub Desktop.
Save nfalliere/94351c2cf59d4a595990afe14fec75bc to your computer and use it in GitHub Desktop.
#?description=
#?shortcut=
from com.pnfsoftware.jeb.client.api import IScript
from com.pnfsoftware.jeb.core.units.code.android import IDexUnit
from com.pnfsoftware.jeb.core.actions import Actions, ActionContext, ActionOverridesData
class PrintDexOverrides(IScript):
def run(self, ctx):
prj = ctx.getMainProject()
# method 1: retrieving the selected method graphically: set the caret on a method item
unit = ctx.getFocusedUnit()
assert isinstance(unit, IDexUnit)
current_item = ctx.getFocusedItem()
item_id = current_item.getItemId()
# method 2: retrieving a method item programmatically via its signature
#unit = prj.findUnit(IDexUnit)
#cl = unit.getMethod('Lcom/foo/Bar;->func1(I)V')
#item_id = cl.getItemId()
data = ActionOverridesData()
if unit.prepareExecution(ActionContext(unit, Actions.QUERY_OVERRIDES, item_id, None), data):
print('Overrides (method signatures): %s' % data.getAddresses())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment