pub struct RemoteCommand(/* private fields */);Expand description
A command string for the remote shell whose only constructors produce
injection-safe text. ssh hands its trailing argument to the remote login
shell, so a caller-built string would be a shell-injection sink; this type
is the only thing RemoteShell::ssh_argv accepts. The inner string is
private.
Implementations§
Source§impl RemoteCommand
impl RemoteCommand
Sourcepub fn powershell_encoded(script: &str) -> RemoteCommand
pub fn powershell_encoded(script: &str) -> RemoteCommand
powershell -NoProfile -NonInteractive -EncodedCommand <base64>, where
the payload is script as UTF-16LE. Base64 (A-Za-z0-9+/=) has no
character any shell, cmd.exe or PowerShell treats specially, so the
script cannot break out whatever the host’s default shell is.
Sourcepub fn posix(argv: &[&str]) -> Result<RemoteCommand, String>
pub fn posix(argv: &[&str]) -> Result<RemoteCommand, String>
A POSIX sh command line for argv: each argument single-quoted with
every ' written '\'', joined by spaces. Inside single quotes a POSIX
shell interprets nothing, so $(..), backticks, ;, !, * and
the rest reach the program as literal text. Refused: an empty argv,
and NUL or any other control character in any argument (a newline or
tab would otherwise survive quoting and still be a hazard to every log
and terminal it reaches).
Trait Implementations§
Source§impl Clone for RemoteCommand
impl Clone for RemoteCommand
Source§impl Debug for RemoteCommand
impl Debug for RemoteCommand
impl Eq for RemoteCommand
Source§impl PartialEq for RemoteCommand
impl PartialEq for RemoteCommand
impl StructuralPartialEq for RemoteCommand
Auto Trait Implementations§
impl Freeze for RemoteCommand
impl RefUnwindSafe for RemoteCommand
impl Send for RemoteCommand
impl Sync for RemoteCommand
impl Unpin for RemoteCommand
impl UnsafeUnpin for RemoteCommand
impl UnwindSafe for RemoteCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.