示例#1
0
文件: vfs.py 项目: kshithijiyer/grr
    def ListFiles(self):
        args = vfs_pb2.ApiListFilesArgs(client_id=self.client_id,
                                        file_path=self.path)
        items = self._context.SendIteratorRequest("ListFiles", args)

        def MapDataToFile(data):
            return File(client_id=self.client_id,
                        data=data,
                        context=self._context)

        return utils.MapItemsIterator(MapDataToFile, items)
示例#2
0
  def ListFiles(self) -> utils.ItemsIterator["File"]:
    """Lists files under the directory."""
    args = vfs_pb2.ApiListFilesArgs(
        client_id=self.client_id, file_path=self.path)
    items = self._context.SendIteratorRequest("ListFiles", args)

    def MapDataToFile(data: message.Message) -> "File":
      if not isinstance(data, vfs_pb2.ApiFile):
        raise TypeError(f"Unexpected response type: {type(data)}")

      return File(client_id=self.client_id, data=data, context=self._context)

    return utils.MapItemsIterator(MapDataToFile, items)