androguard / androguard

Reverse engineering and pentesting for Android applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'MethodIdItem' object has no attribute 'get_short_string'

protocolblack3302 opened this issue · comments

pydot version 2.0.0
dot -V (11.0.0) - graphviz
androguard - 4.1.1
windows 11

Do you want to clean the directory cfg? (Y/N): y
Deleting...
Decompilation ... End
Decompilation ... End
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts\androguard.exe_main
.py", line 7, in
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\androguard\cli\cli.py", line 301, in decompile
export_apps_to_format(fname, s, output, limit,
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\androguard\cli\main.py", line 163, in export_apps_to_format
filename = clean_file_name(os.path.join(filename_class, method.get_short_string()))
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MethodIdItem' object has no attribute 'get_short_string'

There's a fix for this in master, try pulling and installing it. See #1033

There's a fix for this in master, try pulling and installing it. See #1033

pydot version 2.0.0
dot -V (11.0.0) - graphviz
androguard - 4.1.1 master branch
windows 11
b'Error: not well-formed (invalid token) in line 118 \r\n... "ScriptIntrinsicBlur.crea\x85ement.U8_4(renderScript))" ...\r\nin label of node struct_3d8262dd519a093cdc09f7a7e152c143\r\n'

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts\androguard.exe_main
.py", line 7, in
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 783, in invoke
return _callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\androguard\cli\entry_points.py", line 396, in decompile
export_apps_to_format(fname, s, output, limit,
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\androguard\cli\main.py", line 253, in export_apps_to_format
method2format(filename + "." + form, form, None, buff)
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\androguard\core\bytecode.py", line 471, in method2format
getattr(g, "write
" + _format.lower())(output)
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pydot\core.py", line 1587, in new_method
self.write(path, format=f, prog=prog, encoding=encoding)
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pydot\core.py", line 1662, in write
s = self.create(prog, format, encoding=encoding)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\proto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pydot\core.py", line 1786, in create
process.returncode == 0
AssertionError: "dot" with args ['-Tpng', 'C:\Users\proto\AppData\Local\Temp\tmpmcm73733'] returned code: 1

hi @protocolblack3302, please provide more details.
Which flags used?
if possible please share which APK as well

androguard decompile -o foldername -f png -i .\soemthing.apk --limit "^Lcom/xxx/yyy.*"

Ubuntu 22.04.4 LTS
Androguard, version 4.1.1
python 3.10.12

Wanted to bump this issue again. I ran into the same issue on Friday trying to decompile .apk bundles from an OWASP training exercise. I only mention since it's open and safe to try out if anyone wants a known file to reproduce the problem.

Here's the call stack:

➜  owasp_crackme_2 androguard decompile -o out UnCrackable-Level2.apk     
Dump information UnCrackable-Level2.apk in out
Create directory out
Decompilation ... End
Dump Landroid/animation/Animator; addListener (Landroid/animation/Animator$AnimatorListener;)V ... Traceback (most recent call last):
  File "/home/johndoe/.local/bin/androguard", line 8, in <module>
    sys.exit(entry_point())
  File "/home/johndoe/.local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/johndoe/.local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/johndoe/.local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/johndoe/.local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/johndoe/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/johndoe/.local/lib/python3.10/site-packages/androguard/cli/cli.py", line 301, in decompile
    export_apps_to_format(fname, s, output, limit,
  File "/home/johndoe/.local/lib/python3.10/site-packages/androguard/cli/main.py", line 163, in export_apps_to_format
    filename = clean_file_name(os.path.join(filename_class, method.get_short_string()))
AttributeError: 'MethodIdItem' object has no attribute 'get_short_string'

Please check here how to install a version with the latest commits.
A new patch version will be released also shortly.