qilingframework / qiling

A True Instrumentable Binary Emulation Framework
https://qiling.io
GNU General Public License v2.0
5.06k stars 737 forks source link

add_fs_mapper for directories on host #1446

Closed psparc82 closed 6 months ago

psparc82 commented 6 months ago

Hi,

add_fs_mapper only allows you to map specific files to specific files on the host, e.g. add_fs_mapper("/tmp/file1", "/tmp/file1") will map uses of /tmp/file1 in the emulated environment to /tmp/file1 on the host.

Quite often I need to map a directory (such as /tmp) from the host to the emulated environment. The emulated code will then create files in /tmp which I want to analyze later (by reading them from my host /tmp directory). Unfortunately this isn't possible by using add_fs_mapper.

Allowing add_fs_mapper to map directories would save a lot of time in this case

Thank you

elicn commented 6 months ago

Thanks for the enhancement idea. fs_mapper could be used also to map objects or classes, maybe this method could be used to work around the gap you identify. That said, why not just create a tmp directory in your rootfs? It will stay there after the emulation finishes.

psparc82 commented 6 months ago

Ah yes I tried adding tmp to the rootfs and it worked exactly how I wanted it to. Thanks for the tip!