diff --git a/mRemoteV1/Tools/ExternalToolArgumentParser.cs b/mRemoteV1/Tools/ExternalToolArgumentParser.cs index b450b0a7..43cd16bd 100644 --- a/mRemoteV1/Tools/ExternalToolArgumentParser.cs +++ b/mRemoteV1/Tools/ExternalToolArgumentParser.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using mRemoteNG.Connection; +using mRemoteNG.Security.SymmetricEncryption; +using mRemoteNG.App; namespace mRemoteNG.Tools { @@ -169,12 +171,26 @@ namespace mRemoteNG.Tools break; case "username": replacement = _connectionInfo.Username; + if (string.IsNullOrEmpty(replacement)) + if (Settings.Default.EmptyCredentials == "windows") + replacement = Environment.UserName; + else if (Settings.Default.EmptyCredentials == "custom") + replacement = Settings.Default.DefaultUsername; break; case "password": replacement = _connectionInfo.Password; + if (string.IsNullOrEmpty(replacement) && Settings.Default.EmptyCredentials == "custom") + replacement = new LegacyRijndaelCryptographyProvider() + .Decrypt(Convert.ToString(Settings.Default.DefaultPassword), + Runtime.EncryptionKey); break; case "domain": replacement = _connectionInfo.Domain; + if (string.IsNullOrEmpty(replacement)) + if (Settings.Default.EmptyCredentials == "windows") + replacement = Environment.UserDomainName; + else if (Settings.Default.EmptyCredentials == "custom") + replacement = Settings.Default.DefaultDomain; break; case "description": replacement = _connectionInfo.Description;