objtree icon indicating copy to clipboard operation
objtree copied to clipboard

Update optparse to argparse

Open novitae opened this issue 1 year ago • 0 comments

The required version of Frida is too old and have some big bugs (as an example, I couldn't even attach anything to my USB device). It was using optparse which is now deprecated (for a while) and was giving the following error when launching because Frida now uses Argparse instead of optparse:

Traceback (most recent call last):
  File "/opt/homebrew/bin/objtree", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/objtree/cli.py", line 99, in main
    app = TestApplication()
          ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/frida_tools/application.py", line 152, in __init__
    parser = self._initialize_arguments_parser()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/frida_tools/application.py", line 257, in _initialize_arguments_parser
    self._add_options(parser)
  File "/opt/homebrew/lib/python3.11/site-packages/objtree/cli.py", line 17, in _add_options
    parser.add_option('-m', help="include OBJC_METHOD",
    ^^^^^^^^^^^^^^^^^
AttributeError: 'ArgumentParser' object has no attribute 'add_option'. Did you mean: '_add_action'?

I fixed this issue by changing to argparse, and now we can use latest frida-tools version.

novitae avatar Jan 07 '24 15:01 novitae