MCPcopy Create free account
hub / github.com/qilingframework/qiling / __virtual_to_host_path

Method __virtual_to_host_path

qiling/os/path.py:224–237  ·  view source on GitHub ↗

Convert a virtual path to its corresponding path on the host. This method partialy normalizes the virtual path and does not resolve references to parent directories neither virtual symbolic links

(self, virtpath: Union[str, AnyPurePath])

Source from the content-addressed store, hash-verified

222 return acc_vpath
223
224 def __virtual_to_host_path(self, virtpath: Union[str, AnyPurePath]) -> Path:
225 """Convert a virtual path to its corresponding path on the host.
226
227 This method partialy normalizes the virtual path and does not resolve
228 references to parent directories neither virtual symbolic links
229 """
230
231 absvpath = self.__virtual_abspath(virtpath)
232
233 # remove path anchor to allow path to be rebased
234 vpath = absvpath.relative_to(absvpath.anchor)
235
236 # rebase virtual path on top of rootfs to get the host path
237 return self._rootfs_path / vpath
238
239 def __is_safe_host_path(self, hostpath: Path, strict: bool = False) -> bool:
240 """Sanitize the specified host path and make sure it does not traverse out

Callers 1

virtual_to_host_pathMethod · 0.95

Calls 1

__virtual_abspathMethod · 0.95

Tested by

no test coverage detected