plaso/engine/path_helper.py
def _ExpandUsersVariablePathSegments(
      cls, path_segments, path_separator, user_accounts):
    """Expands path segments with a users variable, e.g. %%users.homedir%%.

    Args:
      path_segments (list[str]): path segments.
      path_separator (str): path segment separator.
      user_accounts (list[UserAccountArtifact]): user accounts.

    Returns:
      list[str]: paths for which the users variables have been expanded.
    """
    if not path_segments:
      return []

    if path_segments[0] in ('%%users.homedir%%', '%%users.userprofile%%'):
      return cls._ExpandUsersHomeDirectoryPathSegments(
          path_segments, path_separator, user_accounts)

    path_expansions = cls._PATH_EXPANSIONS_PER_USERS_VARIABLE.get(
        path_segments[0], None)

    if path_expansions:
      expanded_paths = []

      for path_expansion in path_expansions:
        expanded_path_segments = list(path_expansion)
        expanded_path_segments.extend(path_segments[1:])

        paths = cls._ExpandUsersVariablePathSegments(
            expanded_path_segments, path_separator, user_accounts)
        expanded_paths.extend(paths)

      return expanded_paths

    # TODO: add support for %%users.username%%
    path = path_separator.join(path_segments)
    path = cls._StripDriveFromPath(path)
    return [path]
Expands path segments with a users variable, e.g. %%users.homedir%%.

    Args:
      path_segments (list[str]): path segments.
      path_separator (str): path segment separator.
      user_accounts (list[UserAccountArtifact]): user accounts.

    Returns:
      list[str]: paths for which the users variables have been expanded.
    
Expands path segments with a users variable, e.g.
Expands path segments with a users variable e . g .
def _ExpandUsersVariablePathSegments(
      cls, path_segments, path_separator, user_accounts):
    if not path_segments:
      return []
    if path_segments[0] in ('%%users.homedir%%', '%%users.userprofile%%'):
      return cls._ExpandUsersHomeDirectoryPathSegments(
          path_segments, path_separator, user_accounts)
    path_expansions = cls._PATH_EXPANSIONS_PER_USERS_VARIABLE.get(
        path_segments[0], None)
    if path_expansions:
      expanded_paths = []
      for path_expansion in path_expansions:
        expanded_path_segments = list(path_expansion)
        expanded_path_segments.extend(path_segments[1:])
        paths = cls._ExpandUsersVariablePathSegments(
            expanded_path_segments, path_separator, user_accounts)
        expanded_paths.extend(paths)
      return expanded_paths
    path = path_separator.join(path_segments)
    path = cls._StripDriveFromPath(path)
    return [path]
def _ExpandUsersVariablePathSegments ( cls , path_segments , path_separator , user_accounts ) : if not path_segments : return [ ] if path_segments [ 0 ] in ( '%%users.homedir%%' , '%%users.userprofile%%' ) : return cls . _ExpandUsersHomeDirectoryPathSegments ( path_segments , path_separator , user_accounts ) path_expansions = cls . _PATH_EXPANSIONS_PER_USERS_VARIABLE . get ( path_segments [ 0 ] , None ) if path_expansions : expanded_paths = [ ] for path_expansion in path_expansions : expanded_path_segments = list ( path_expansion ) expanded_path_segments . extend ( path_segments [ 1 : ] ) paths = cls . _ExpandUsersVariablePathSegments ( expanded_path_segments , path_separator , user_accounts ) expanded_paths . extend ( paths ) return expanded_paths path = path_separator . join ( path_segments ) path = cls . _StripDriveFromPath ( path ) return [ path ]
Expands path segments with a users variable, e.g.
Expands path segments with a users variable e . g .
"""Expands path segments with a users variable, e.g. %%users.homedir%%.

    Args:
      path_segments (list[str]): path segments.
      path_separator (str): path segment separator.
      user_accounts (list[UserAccountArtifact]): user accounts.

    Returns:
      list[str]: paths for which the users variables have been expanded.
    """ # TODO: add support for %%users.username%%
paths for which the users variables have been expanded.
paths for which the users variables have been expanded .
list[str]
cls
path_segments
None
path_separator
path segment separator.
path segment separator .
user_accounts
None