Expand description
§librust-winrm
A WinRM (Windows Remote Management) client library for Rust.
§Features
- NTLM Authentication: Full support for NTLM authentication over HTTPS
- Command Execution: Execute commands and PowerShell scripts remotely
- File Transfer: Upload and download files to/from remote Windows systems
- Error Handling: Comprehensive error types with context
§Example
use librust_winrm::WinRMClient;
let mut client = WinRMClient::new(
"https://10.0.3.203:5986/wsman",
"administrator",
"password",
"ntlm",
true, // insecure (skip SSL verification)
None, // CA cert path
)?;
// Open shell
let shell_id = client.open_shell()?;
// Run command
let command_id = client.run_command(&shell_id, "whoami")?;
// Get output
let (stdout, stderr, exit_code) = client.get_command_output(&shell_id, &command_id)?;
println!("Output: {}", stdout);
// Close shell
client.close_shell(&shell_id)?;§File Transfer Example
use librust_winrm::{WinRMClient, upload_file, download_file};
let mut client = WinRMClient::new(
"https://server:5986/wsman",
"admin",
"pass",
"ntlm",
false,
None,
)?;
let shell_id = client.open_shell()?;
// Upload
upload_file(&mut client, &shell_id, "local.txt", "C:\\\\remote.txt")?;
// Download
download_file(&mut client, &shell_id, "C:\\\\file.txt", "./local.txt")?;
client.close_shell(&shell_id)?;Structs§
Enums§
Functions§
Type Aliases§
- Result
- Re-export of Result type for convenience