pub struct SmbClient { /* private fields */ }Implementations§
Source§impl SmbClient
impl SmbClient
pub async fn connect(host: &str) -> Result<Self>
Sourcepub async fn probe_signing(&mut self) -> Result<(u16, bool)>
pub async fn probe_signing(&mut self) -> Result<(u16, bool)>
Unauthenticated NEGOTIATE probe: returns (dialect revision, signing_required). Signing NOT required marks a host as an NTLM-relay target. Cheap — no session setup.
Sourcepub async fn login(
&mut self,
host: &str,
domain: &str,
user: &str,
password: &str,
) -> Result<()>
pub async fn login( &mut self, host: &str, domain: &str, user: &str, password: &str, ) -> Result<()>
Negotiate + NTLM session setup with a plaintext password.
Sourcepub async fn login_kerberos(
&mut self,
gss_blob: &[u8],
session_key: &[u8; 16],
) -> Result<()>
pub async fn login_kerberos( &mut self, gss_blob: &[u8], session_key: &[u8; 16], ) -> Result<()>
Pass-the-ticket: negotiate + Kerberos session setup with a pre-built GSS/SPNEGO AP-REQ blob and the 16-byte GSS session key (the AP-REQ authenticator subkey). Single-shot — no NTLM challenge round-trip. Subsequent messages are signed with the Kerberos session key.
Sourcepub async fn login_hash(
&mut self,
host: &str,
domain: &str,
user: &str,
nt: &[u8; 16],
) -> Result<()>
pub async fn login_hash( &mut self, host: &str, domain: &str, user: &str, nt: &[u8; 16], ) -> Result<()>
Pass-the-hash: negotiate + NTLM session setup with a raw NT hash.
Sourcepub async fn login_cred(
&mut self,
host: &str,
domain: &str,
user: &str,
cred: Cred<'_>,
) -> Result<()>
pub async fn login_cred( &mut self, host: &str, domain: &str, user: &str, cred: Cred<'_>, ) -> Result<()>
Negotiate + NTLM session setup with either a password or an NT hash.
Sourcepub async fn tree_connect(&mut self, unc: &str) -> Result<()>
pub async fn tree_connect(&mut self, unc: &str) -> Result<()>
Connect to a share, e.g. \\dc01\IPC$.
Sourcepub async fn open_pipe(&mut self, name: &str) -> Result<[u8; 16]>
pub async fn open_pipe(&mut self, name: &str) -> Result<[u8; 16]>
Open a named pipe on the connected tree and return its FileId.
Sourcepub async fn read_pipe(
&mut self,
file_id: &[u8; 16],
max: u32,
) -> Result<Vec<u8>>
pub async fn read_pipe( &mut self, file_id: &[u8; 16], max: u32, ) -> Result<Vec<u8>>
Read up to max bytes from a pipe (SMB2 READ). Returns empty at end-of-pipe. Used to
drain RPC response fragments that don’t fit one FSCTL_PIPE_TRANSCEIVE.
Sourcepub async fn write_pipe(
&mut self,
file_id: &[u8; 16],
data: &[u8],
) -> Result<()>
pub async fn write_pipe( &mut self, file_id: &[u8; 16], data: &[u8], ) -> Result<()>
Write to a pipe/file with no read back — used for a fire-and-forget RPC AUTH3.
Sourcepub async fn transact(
&mut self,
file_id: &[u8; 16],
data: &[u8],
) -> Result<Vec<u8>>
pub async fn transact( &mut self, file_id: &[u8; 16], data: &[u8], ) -> Result<Vec<u8>>
One RPC round trip over the pipe (FSCTL_PIPE_TRANSCEIVE): send data, return output.
Sourcepub async fn read_file_delete(&mut self, path: &str) -> Result<Vec<u8>>
pub async fn read_file_delete(&mut self, path: &str) -> Result<Vec<u8>>
Read a whole file off the currently-connected disk share and delete it on close.
path is relative to the share root (e.g. Windows\Temp\out.txt). Retries the open
while the file does not yet exist — an async writer (e.g. our exec child) may still be
starting. Returns the file contents (possibly empty). Tree-connect the share first.