Quote variable for #2195

In order to interpret variable as string and not arbitrary code
This commit is contained in:
Simon Monai
2023-08-30 23:46:42 +02:00
committed by GitHub
parent 6698ec0b06
commit c97b84e4a2

View File

@@ -42,7 +42,7 @@ namespace mRemoteNG.Connection.Protocol.PowerShell
};
_consoleControl.StartProcess(@"C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell.exe",
$@"-NoExit -Command ""$password = ConvertTo-SecureString '{_connectionInfo.Password}' -AsPlainText -Force; $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @('{_connectionInfo.Domain}\{_connectionInfo.Username}', $password); Enter-PSSession -ComputerName {_connectionInfo.Hostname} -Credential $cred""");
$@"-NoExit -Command ""$password = ConvertTo-SecureString ""'{_connectionInfo.Password}'"" -AsPlainText -Force; $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @('{_connectionInfo.Domain}\{_connectionInfo.Username}', $password); Enter-PSSession -ComputerName {_connectionInfo.Hostname} -Credential $cred""");
while (!_consoleControl.IsHandleCreated) break;
_handle = _consoleControl.Handle;
@@ -99,4 +99,4 @@ namespace mRemoteNG.Connection.Protocol.PowerShell
#endregion
}
}
}