Skip to main content

Module msg

Module msg 

Source
Expand description

SMB2 request bodies and response parsers (MS-SMB2 §2.2). Offsets in the on-wire *Offset fields are measured from the start of the SMB2 header (i.e. 64 + body_off).

Structs§

DirEntry
One entry from a directory enumeration (FileDirectoryInformation, class 1).

Constants§

FILE_DIRECTORY_INFORMATION
FileDirectoryInformation class (§2.4.10) — the classic name+attrs+size directory-enumeration info-class. Exposed publicly in 0.2.4 (adopted from g0h4n’s PR #1) so downstream callers building custom query_directory_req-shaped requests do not have to remember the magic byte. Additional info classes (FileFullDirectoryInformation class 2, FileBothDirectoryInformation class 3, etc.) can be added alongside if needed.
FSCTL_PIPE_TRANSCEIVE

Functions§

close_req
SMB2 CLOSE (§2.2.15).
create_file
Generic disk-file CREATE (§2.2.13). path is relative to the connected share root (no leading backslash). Callers pass the access mask, share mode, disposition, and options.
create_file_id
FileId (16 bytes) from a CREATE response.
create_pipe
Open a named pipe (e.g. “samr”) on the IPC$ tree.
ioctl_output
Extract the pipe output (RPC response bytes) from an IOCTL response.
ioctl_transceive
Send input through the pipe and read the response in one round trip.
negotiate
Offer dialect 2.1.0 with a random client GUID.
parse_directory_info
Parse a QUERY_DIRECTORY response (§2.2.34) carrying FileDirectoryInformation entries. Bounds-checked and loop-bounded: a hostile server cannot drive an out-of-range read or a non-terminating walk (a NextEntryOffset that fails to advance, or an entry claiming a name longer than the buffer, ends parsing).
query_directory_output
Raw output-buffer extractor for a QUERY_DIRECTORY response (§2.2.34). Returns the whole info-class buffer as bytes; callers that want the higher-level Vec<DirEntry> decoding call parse_directory_info instead. Adopted from g0h4n’s PR #1 for 0.2.4 — useful when a caller wants to walk a non-FileDirectoryInformation info-class from the same wire framing. Bounds-checked: a truncated response returns SmbError::Truncated, never panics through the direct-indexing helpers.
query_directory_req
SMB2 QUERY_DIRECTORY (§2.2.33): enumerate an open directory handle using FileDirectoryInformation (class 1). pattern is the search wildcard (typically *); on continuation calls the server ignores it and resumes from where the handle left off, so passing * every time is correct.
read_output
Extract the data returned by a READ response (§2.2.20).
read_req
SMB2 READ (§2.2.19): read length bytes at offset from the open file.
session_setup
The security buffer holds a raw NTLMSSP token.
session_setup_token
Extract the security buffer (server NTLM token) from a SESSION_SETUP response.
tree_connect
write_req
SMB2 WRITE (§2.2.21): write data to the open handle at offset.