dissect.target.helpers.nfs.client.nfs

Module Contents

Classes

ReadDirResult

Client

An abstract base class for context managers.

Attributes

dissect.target.helpers.nfs.client.nfs.Credentials
dissect.target.helpers.nfs.client.nfs.Verifier
exception dissect.target.helpers.nfs.client.nfs.NfsError(message: str, nfsstat: dissect.target.helpers.nfs.nfs3.NfsStat)

Bases: dissect.target.exceptions.Error

Generic dissect.target error.

message
nfsstat
__str__() str

Return str(self).

class dissect.target.helpers.nfs.client.nfs.ReadDirResult

Bases: NamedTuple

dir_attributes: dissect.target.helpers.nfs.nfs3.FileAttributes | None
entries: list[dissect.target.helpers.nfs.nfs3.EntryPlus]
class dissect.target.helpers.nfs.client.nfs.Client(rpc_client: dissect.target.helpers.sunrpc.client.AbstractClient)

Bases: contextlib.AbstractContextManager

An abstract base class for context managers.

DIR_COUNT = 4096
MAX_COUNT = 32768
READ_CHUNK_SIZE = 1048576
__enter__() typing_extensions.Self

Return self upon entering the runtime context.

__exit__(_: type[BaseException] | None, __: BaseException | None, ___: types.TracebackType | None) bool

Raise any exception triggered within the runtime context.

classmethod connect(hostname: str, port: int, auth: dissect.target.helpers.sunrpc.client.AuthScheme[Credentials, Verifier], local_port: int | dissect.target.helpers.sunrpc.client.LocalPortPolicy = 0, timeout_in_seconds: float | None = 5.0) Client

Connect to a NFS server.

Parameters:
  • hostname – The remote hostname.

  • port – The remote port.

  • auth – The authentication scheme.

  • local_port – The local port to bind to. If equal to LocalPortPolicy.PRIVILEGED or -1, bind to the first free privileged port. If equal to LocalPortPolicy.ANY or 0, bind to any free port. Otherwise, bind to the specified port.

  • timeout_in_seconds – The timeout for making the connection.

rebind_auth(auth: dissect.target.helpers.sunrpc.client.AuthScheme[Credentials, Verifier]) None

Change the authentication scheme of the underlying sunrpc client.

readdir(dir: dissect.target.helpers.nfs.nfs3.FileHandle) ReadDirResult | dissect.target.helpers.nfs.nfs3.NfsStat

Read the contents of a directory, including file attributes.

readfile(handle: dissect.target.helpers.nfs.nfs3.FileHandle, offset: int = 0, size: int = -1) collections.abc.Iterator[bytes]

Read a file by its file handle.

lookup(name: str, parent: dissect.target.helpers.nfs.nfs3.FileHandle) dissect.target.helpers.nfs.nfs3.LookupResult

Lookup a file by name in a directory.

getattr(handle: dissect.target.helpers.nfs.nfs3.FileHandle) dissect.target.helpers.nfs.nfs3.FileAttributes

Get the attributes of a file by its file handle.

Read the target of a symlink by its file handle.

close() None
__del__()