pass method as argument to skip select-list
This commit is contained in:
parent
a0156c7c23
commit
e9c0132816
@ -21,7 +21,7 @@ def switch(argument_key, idx):
|
|||||||
}[argument_key] % idx)
|
}[argument_key] % idx)
|
||||||
|
|
||||||
|
|
||||||
def main(app_id, module_id):
|
def main(app_id, module_id, method):
|
||||||
import subprocess
|
import subprocess
|
||||||
output = subprocess.getoutput('nm --demangle --dynamic %s' % module_id)
|
output = subprocess.getoutput('nm --demangle --dynamic %s' % module_id)
|
||||||
|
|
||||||
@ -41,10 +41,17 @@ def main(app_id, module_id):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for idx, symbol in enumerate(symbols):
|
selection_idx = None
|
||||||
print("%4d) %s (%d)" % (idx, symbol['name'], len(symbol['args'])))
|
|
||||||
|
|
||||||
selection_idx = input("Enter symbol number: ")
|
for idx, symbol in enumerate(symbols):
|
||||||
|
if method is None:
|
||||||
|
print("%4d) %s (%d)" % (idx, symbol['name'], len(symbol['args'])))
|
||||||
|
elif method == symbol['name']:
|
||||||
|
selection_idx = idx
|
||||||
|
break
|
||||||
|
|
||||||
|
if selection_idx is None:
|
||||||
|
selection_idx = input("Enter symbol number: ")
|
||||||
|
|
||||||
method = symbols[int(selection_idx)]
|
method = symbols[int(selection_idx)]
|
||||||
print('[+] Selected method: %s' % method['name'])
|
print('[+] Selected method: %s' % method['name'])
|
||||||
@ -97,8 +104,9 @@ if __name__ == '__main__':
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--app', help='app identifier "com.company.app"')
|
parser.add_argument('--app', help='app identifier "com.company.app"')
|
||||||
parser.add_argument('--module', help='loaded module name "libfoo.2.so"')
|
parser.add_argument('--module', help='loaded module name "libfoo.2.so"')
|
||||||
|
parser.add_argument('--method', help='method name "SomeClass::someMethod", if empty it will print select-list')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main(args.app, args.module)
|
main(args.app, args.module, args.method)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user