frida / frida-tools

Frida CLI tools
Other
338 stars 95 forks source link

frida-tools package is not zip_safe #125

Closed ChiChou closed 1 year ago

ChiChou commented 1 year ago

tracer.py uses relative path to locate tracer_agent.js. If the package has been installed as zip (.egg), frida-trace can't read from the tracer template, thus result in failure.

To reproduce, clone this repo and run python3 setup.py install on a clean machine (that has not installed frida-tools before), then use frida-trace command. Then it will complain [Errno 20] Not a directory: ...tracer_agent.js

yotamN commented 1 year ago

Before merging it, I wonder if we can maybe it zip safe instead

ChiChou commented 1 year ago

@yotamN then you have to add extra checks in all of them to read from zip (.egg) format instead of constructing paths from __file__

https://github.com/frida/frida-tools/blob/f0867e206f7b9127940c18e1a985626223c03c69/frida_tools/ls.py#L41 https://github.com/frida/frida-tools/blob/f0867e206f7b9127940c18e1a985626223c03c69/frida_tools/push.py#L51 https://github.com/frida/frida-tools/blob/f0867e206f7b9127940c18e1a985626223c03c69/frida_tools/pull.py#L62 https://github.com/frida/frida-tools/blob/f0867e206f7b9127940c18e1a985626223c03c69/frida_tools/tracer.py#L343 https://github.com/frida/frida-tools/blob/f0867e206f7b9127940c18e1a985626223c03c69/frida_tools/rm.py#L44

yotamN commented 1 year ago

It seems that the property is deprecated so I don't think it's worth refactoring everything to be zip safe.
Keeping the property is fine I guess, so I will merge.