smb2-client 0.2.5

Minimal async SMB2 client in pure Rust: negotiate, NTLMv2 (SPNEGO) session setup, message signing (HMAC-SHA256 / AES-CMAC), tree connect, named-pipe and file I/O — no FFI.
Documentation

smb2-client

crates.io docs.rs License: MIT

A minimal, async, pure-Rust SMB2 clientno FFI, no windows crate — so it connects to Windows file servers from any platform. Built on ntlmssp for authentication.

Features

  • SMB2 NEGOTIATE — offers dialects 2.0.2 + 2.1.0; the server picks the highest, so this reaches Server 2008 through 2025. SMB 3.x is not offered yet (see Scope). NTLMv2 session setup wrapped in SPNEGO, from a password or an NT hash (pass-the-hash).
  • Message signing: HMAC-SHA256 over the offered 2.x dialects (live-validated). AES-CMAC / SP800-108 KDF code exists for SMB 3.0.x but is not validated — the client never reaches that branch today because 3.x isn't offered.
  • TREE_CONNECT, named-pipe open/read/write (the transport under DCE/RPC-over-SMB), and disk-file read (for pulling command output back over C$).
  • A small SMB2 server side (server) sufficient to stand up an NTLM capture endpoint.

Example

use smb2_client::SmbClient;

# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let mut c = SmbClient::connect("fileserver:445").await?;
c.login("fileserver", "CORP", "alice", "P@ssw0rd").await?;
c.tree_connect(r"\\fileserver\IPC$").await?;
let pipe = c.open_pipe("srvsvc").await?;   // now drive DCE/RPC over the pipe
# Ok(()) }

Pairs with dcerpc for SAMR / LSAT / DRSUAPI etc. over the named-pipe transport — together they're the "spec-vector captures for Rust" that didn't previously exist.

Scope

Client-focused SMB2 for automation/tooling (auth, signing, pipes, file read). Not a general file-server or a full SMB3 encryption implementation. NTLMv2 only (no NTLMv1/LM).

License

MIT © icedracon. Extracted from ADhammer.