pub struct SmbClient { /* private fields */ }Expand description
SMB2/3 client.
Implementations§
Source§impl SmbClient
impl SmbClient
Sourcepub fn negotiate(&mut self) -> Result<SmbDialect, SmbError>
pub fn negotiate(&mut self) -> Result<SmbDialect, SmbError>
Negotiate SMB dialect with server.
Sourcepub fn session_setup(
&mut self,
username: &str,
password: &str,
domain: &str,
) -> Result<u64, SmbError>
pub fn session_setup( &mut self, username: &str, password: &str, domain: &str, ) -> Result<u64, SmbError>
Establish an authenticated session via NTLM.
Sourcepub fn tree_connect(&mut self, share_path: &str) -> Result<u32, SmbError>
pub fn tree_connect(&mut self, share_path: &str) -> Result<u32, SmbError>
Connect to a share (\\server\share).
Sourcepub fn tree_disconnect(&mut self) -> Result<(), SmbError>
pub fn tree_disconnect(&mut self) -> Result<(), SmbError>
Disconnect from a share.
Sourcepub fn create(
&mut self,
path: &str,
desired_access: u32,
share_access: u32,
disposition: CreateDisposition,
) -> Result<SmbFileId, SmbError>
pub fn create( &mut self, path: &str, desired_access: u32, share_access: u32, disposition: CreateDisposition, ) -> Result<SmbFileId, SmbError>
Open or create a file.
Sourcepub fn read(
&mut self,
file_id: &SmbFileId,
offset: u64,
length: u32,
) -> Result<Vec<u8>, SmbError>
pub fn read( &mut self, file_id: &SmbFileId, offset: u64, length: u32, ) -> Result<Vec<u8>, SmbError>
Read from an open file.
Sourcepub fn write(
&mut self,
file_id: &SmbFileId,
offset: u64,
data: &[u8],
) -> Result<u32, SmbError>
pub fn write( &mut self, file_id: &SmbFileId, offset: u64, data: &[u8], ) -> Result<u32, SmbError>
Write to an open file.
Sourcepub fn query_directory(
&mut self,
dir_id: &SmbFileId,
pattern: &str,
) -> Result<Vec<SmbDirEntry>, SmbError>
pub fn query_directory( &mut self, dir_id: &SmbFileId, pattern: &str, ) -> Result<Vec<SmbDirEntry>, SmbError>
Query directory contents.
Sourcepub fn sign_message(&self, packet: &mut [u8])
pub fn sign_message(&self, packet: &mut [u8])
Sign an SMB2 message with HMAC-SHA256.
Sourcepub fn verify_signature(&self, packet: &[u8]) -> bool
pub fn verify_signature(&self, packet: &[u8]) -> bool
Verify an SMB2 message signature.
Sourcepub fn dialect(&self) -> Option<SmbDialect>
pub fn dialect(&self) -> Option<SmbDialect>
Get the negotiated dialect.
Sourcepub fn session_id(&self) -> u64
pub fn session_id(&self) -> u64
Get the session ID.
Sourcepub fn server_addr(&self) -> &str
pub fn server_addr(&self) -> &str
Get the server address.