Compare commits

..

6 Commits

Author SHA1 Message Date
David Sparer
575dae446f bump version and update changelog 2018-03-03 09:16:55 -06:00
David Sparer
9b438576f2 deserializing enums now ignores case. resolves #899 2018-02-27 09:48:09 -06:00
David Sparer
cbd32f1a07 added powershell script for creating bulk connections 2018-02-27 08:37:25 -06:00
David Sparer
516182ec40 the xml v2.6 schema must have the export field event if we dont use it. need to bump to v2.7 to get rid of it 2018-02-26 08:11:59 -06:00
David Sparer
4ad3a68d80 readded Export field to xml schema 2018-02-26 07:13:36 -06:00
David Sparer
2f9ba32c07 bump readme for development channel badge 2018-02-25 13:41:32 -06:00
10 changed files with 142 additions and 34 deletions

View File

@@ -1,3 +1,10 @@
1.76.2 Alpha 4 (2018-03-03):
Fixes:
------
#899: DoNotPlay is Case Sensitive in XML Serialization
1.76.1 Alpha 3 (2018-02-24):
Features/Enhancements:

View File

@@ -12,7 +12,7 @@
| ---------------|--------------|-----------|
| Stable | [![Build status](https://ci.appveyor.com/api/projects/status/k0sdbxmq90fgdmj6/branch/master?svg=true)](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/master) | [![Github Releases (by Release)](https://img.shields.io/github/downloads/mRemoteNG/mRemoteNG/v1.75.7011/total.svg)](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.75.7011) |
| Beta | | [![Github Releases (by Release)](https://img.shields.io/github/downloads/mRemoteNG/mRemoteNG/v1.75.7011/total.svg)](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.75.7011) |
| Development | [![Build status](https://ci.appveyor.com/api/projects/status/k0sdbxmq90fgdmj6/branch/develop?svg=true)](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/develop) | [![Github Releases (by Release)](https://img.shields.io/github/downloads/mRemoteNG/mRemoteNG/v1.76Alpha2/total.svg)](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.76Alpha2) |
| Development | [![Build status](https://ci.appveyor.com/api/projects/status/k0sdbxmq90fgdmj6/branch/develop?svg=true)](https://ci.appveyor.com/project/mremoteng/mremoteng/branch/develop) | [![Github Releases (by Release)](https://img.shields.io/github/downloads/mRemoteNG/mRemoteNG/v1.76Alpha3/total.svg)](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.76Alpha3) |
mRemoteNG is the next generation of mRemote, a full-featured, multi-tab remote connections manager.

View File

@@ -0,0 +1,106 @@
$EncryptionKey = (Get-Credential -Message "Enter the encryption key you would like to use. This must match the encryption key used by the rest of the confCons file." -UserName "DontNeedUsername").Password
$PathToMrngFolder = "C:\Users\SparerD\Downloads\mRemoteNG-Portable-1.75.7012.16846"
if ($PathToMrngFolder -eq "") {
Write-Error -Message 'You must set the $PathToMrngFolder variable in this script to the folder which contains mRemoteNG.exe'
}
$assembly = [System.Reflection.Assembly]::LoadFile((Join-Path -Path $PathToMrngFolder -ChildPath "mRemoteNG.exe"))
$assembly = [System.Reflection.Assembly]::LoadFile((Join-Path -Path $PathToMrngFolder -ChildPath "BouncyCastle.Crypto.dll"))
function New-mRemoteNGXmlSerializer {
[CmdletBinding()]
param (
[SecureString]
$EncryptionKey
)
PROCESS {
$cryptoProvider = New-Object -TypeName mRemoteNG.Security.SymmetricEncryption.AeadCryptographyProvider
$saveFilter = New-Object -TypeName mRemoteNG.Security.SaveFilter -ArgumentList @($false)
$xmlSerializer = New-Object -TypeName mRemoteNG.Config.Serializers.XmlConnectionNodeSerializer -ArgumentList @($cryptoProvider, $encryptionKey, $saveFilter)
Write-Output $xmlSerializer
}
}
function New-mRemoteNGConnectionInfo {
[CmdletBinding()]
param (
)
PROCESS {
$connectionInfo = New-Object -TypeName mRemoteNG.Connection.ConnectionInfo
Write-Output $connectionInfo
}
}
function New-mRemoteNGContainerInfo {
[CmdletBinding()]
param (
)
PROCESS {
$connectionInfo = New-Object -TypeName mRemoteNG.Container.ContainerInfo
Write-Output $connectionInfo
}
}
# Setup the services needed to do serialization
$xmlSerializer = New-mRemoteNGXmlSerializer -EncryptionKey $EncryptionKey
#----------------------------------------------------------------
# Example 1: serialize many connections
# Here you can define the number of connection info objects to create
# You can also provide a list of desired hostnames and iterate over those
$xml = ""
foreach($i in 1..5)
{
$connectionInfo = New-mRemoteNGConnectionInfo
# Set connection info properties
$connectionInfo.Name = "server-$i"
$connectionInfo.Hostname = "some-win-server-$i"
$connectionInfo.Protocol = [mRemoteNG.Connection.Protocol.ProtocolType]::RDP
$connectionInfo.Inheritance.Username = $true
$connectionInfo.Inheritance.Domain = $true
$connectionInfo.Inheritance.Password = $true
$serializedConnection = $xmlSerializer.SerializeConnectionInfo($connectionInfo).ToString()
$xml += $serializedConnection + [System.Environment]::NewLine
}
Write-Output $xml
#----------------------------------------------------------------
# Example 2: serialize a container which has connections
# You can also create containers and add connections to them, which will be nested correctly when serialized
$xml = ""
$container = New-mRemoteNGContainerInfo
$container.Name = "ProductionServers"
$serializedContainer = $xmlSerializer.SerializeConnectionInfo($container)
foreach($i in 1..3)
{
$connectionInfo = New-mRemoteNGConnectionInfo
# Set connection info properties
$connectionInfo.Name = "server-$i"
$connectionInfo.Hostname = "some-linux-server-$i"
$connectionInfo.Protocol = [mRemoteNG.Connection.Protocol.ProtocolType]::SSH2
$connectionInfo.Inheritance.Username = $true
$connectionInfo.Inheritance.Domain = $true
$connectionInfo.Inheritance.Password = $true
# serialize the connection
$serializedConnection = $xmlSerializer.SerializeConnectionInfo($connectionInfo)
# add the connection to the container
$serializedContainer.Add($serializedConnection)
}
# get the raw xml text
Write-Output $serializedContainer.ToString()

View File

@@ -85,7 +85,7 @@ namespace mRemoteNG.Config.Serializers.Xml
element.Add(new XAttribute("RedirectPorts", connectionInfo.RedirectPorts.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RedirectPrinters", connectionInfo.RedirectPrinters.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RedirectSmartCards", connectionInfo.RedirectSmartCards.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RedirectSound", connectionInfo.RedirectSound.ToString().ToLowerInvariant()));
element.Add(new XAttribute("RedirectSound", connectionInfo.RedirectSound.ToString()));
element.Add(new XAttribute("SoundQuality", connectionInfo.SoundQuality.ToString()));
element.Add(new XAttribute("RedirectKeys", connectionInfo.RedirectKeys.ToString().ToLowerInvariant()));
element.Add(new XAttribute("Connected", (connectionInfo.OpenConnections.Count > 0).ToString().ToLowerInvariant()));

View File

@@ -13,7 +13,6 @@ using mRemoteNG.Connection.Protocol.VNC;
using mRemoteNG.Container;
using mRemoteNG.Messages;
using mRemoteNG.Security;
using mRemoteNG.Tools;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Forms;
@@ -144,10 +143,10 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 2.6)
{
BlockCipherEngines engine;
Enum.TryParse(connectionsRootElement?.Attributes["EncryptionEngine"].Value, out engine);
Enum.TryParse(connectionsRootElement?.Attributes["EncryptionEngine"].Value, true, out engine);
BlockCipherModes mode;
Enum.TryParse(connectionsRootElement?.Attributes["BlockCipherMode"].Value, out mode);
Enum.TryParse(connectionsRootElement?.Attributes["BlockCipherMode"].Value, true, out mode);
int keyDerivationIterations;
int.TryParse(connectionsRootElement?.Attributes["KdfIterations"].Value, out keyDerivationIterations);
@@ -301,7 +300,9 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 0.7)
{
connectionInfo.Protocol = (ProtocolType)MiscTools.StringToEnum(typeof(ProtocolType), xmlnode.Attributes["Protocol"].Value);
ProtocolType protocolType;
Enum.TryParse(xmlnode.Attributes["Protocol"].Value, true, out protocolType);
connectionInfo.Protocol = protocolType;
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["Port"].Value);
}
@@ -317,9 +318,9 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 1.3)
{
connectionInfo.Colors = (RdpProtocol.RDPColors)MiscTools.StringToEnum(typeof(RdpProtocol.RDPColors), xmlnode.Attributes["Colors"].Value);
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)MiscTools.StringToEnum(typeof(RdpProtocol.RDPResolutions), Convert.ToString(xmlnode.Attributes["Resolution"].Value));
connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)MiscTools.StringToEnum(typeof(RdpProtocol.RDPSounds), Convert.ToString(xmlnode.Attributes["RedirectSound"].Value));
connectionInfo.Colors = (RdpProtocol.RDPColors)Enum.Parse(typeof(RdpProtocol.RDPColors), xmlnode.Attributes["Colors"].Value, true);
connectionInfo.Resolution = (RdpProtocol.RDPResolutions)Enum.Parse(typeof(RdpProtocol.RDPResolutions), xmlnode.Attributes["Resolution"].Value, true);
connectionInfo.RedirectSound = (RdpProtocol.RDPSounds)Enum.Parse(typeof(RdpProtocol.RDPSounds), xmlnode.Attributes["RedirectSound"].Value, true);
}
else
{
@@ -395,7 +396,7 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 1.6)
{
connectionInfo.ICAEncryptionStrength = (IcaProtocol.EncryptionStrength)MiscTools.StringToEnum(typeof(IcaProtocol.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value);
connectionInfo.ICAEncryptionStrength = (IcaProtocol.EncryptionStrength)Enum.Parse(typeof(IcaProtocol.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value, true);
connectionInfo.Inheritance.ICAEncryptionStrength = bool.Parse(xmlnode.Attributes["InheritICAEncryptionStrength"].Value);
connectionInfo.PreExtApp = xmlnode.Attributes["PreExtApp"].Value;
connectionInfo.PostExtApp = xmlnode.Attributes["PostExtApp"].Value;
@@ -405,16 +406,16 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 1.7)
{
connectionInfo.VNCCompression = (ProtocolVNC.Compression)MiscTools.StringToEnum(typeof(ProtocolVNC.Compression), xmlnode.Attributes["VNCCompression"].Value);
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)MiscTools.StringToEnum(typeof(ProtocolVNC.Encoding), Convert.ToString(xmlnode.Attributes["VNCEncoding"].Value));
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)MiscTools.StringToEnum(typeof(ProtocolVNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value);
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)MiscTools.StringToEnum(typeof(ProtocolVNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value);
connectionInfo.VNCCompression = (ProtocolVNC.Compression)Enum.Parse(typeof(ProtocolVNC.Compression), xmlnode.Attributes["VNCCompression"].Value, true);
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Enum.Parse(typeof(ProtocolVNC.Encoding), xmlnode.Attributes["VNCEncoding"].Value, true);
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Enum.Parse(typeof(ProtocolVNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value, true);
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Enum.Parse(typeof(ProtocolVNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value, true);
connectionInfo.VNCProxyIP = xmlnode.Attributes["VNCProxyIP"].Value;
connectionInfo.VNCProxyPort = Convert.ToInt32(xmlnode.Attributes["VNCProxyPort"].Value);
connectionInfo.VNCProxyUsername = xmlnode.Attributes["VNCProxyUsername"].Value;
connectionInfo.VNCProxyPassword = _decryptor.Decrypt(xmlnode.Attributes["VNCProxyPassword"].Value);
connectionInfo.VNCColors = (ProtocolVNC.Colors)MiscTools.StringToEnum(typeof(ProtocolVNC.Colors), xmlnode.Attributes["VNCColors"].Value);
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)MiscTools.StringToEnum(typeof(ProtocolVNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value);
connectionInfo.VNCColors = (ProtocolVNC.Colors)Enum.Parse(typeof(ProtocolVNC.Colors), xmlnode.Attributes["VNCColors"].Value, true);
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Enum.Parse(typeof(ProtocolVNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value, true);
connectionInfo.VNCViewOnly = bool.Parse(xmlnode.Attributes["VNCViewOnly"].Value);
connectionInfo.Inheritance.VNCCompression = bool.Parse(xmlnode.Attributes["InheritVNCCompression"].Value);
connectionInfo.Inheritance.VNCEncoding = bool.Parse(xmlnode.Attributes["InheritVNCEncoding"].Value);
@@ -431,13 +432,13 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 1.8)
{
connectionInfo.RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel)MiscTools.StringToEnum(typeof(RdpProtocol.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value);
connectionInfo.RDPAuthenticationLevel = (RdpProtocol.AuthenticationLevel)Enum.Parse(typeof(RdpProtocol.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value, true);
connectionInfo.Inheritance.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value);
}
if (_confVersion >= 1.9)
{
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)MiscTools.StringToEnum(typeof(HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value);
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Enum.Parse(typeof(HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value, true);
connectionInfo.MacAddress = xmlnode.Attributes["MacAddress"].Value;
connectionInfo.Inheritance.RenderingEngine = bool.Parse(xmlnode.Attributes["InheritRenderingEngine"].Value);
connectionInfo.Inheritance.MacAddress = bool.Parse(xmlnode.Attributes["InheritMacAddress"].Value);
@@ -458,9 +459,9 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 2.2)
{
// Get settings
connectionInfo.RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod)MiscTools.StringToEnum(typeof(RdpProtocol.RDGatewayUsageMethod), Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value));
connectionInfo.RDGatewayUsageMethod = (RdpProtocol.RDGatewayUsageMethod)Enum.Parse(typeof(RdpProtocol.RDGatewayUsageMethod), xmlnode.Attributes["RDGatewayUsageMethod"].Value, true);
connectionInfo.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value;
connectionInfo.RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)MiscTools.StringToEnum(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value));
connectionInfo.RDGatewayUseConnectionCredentials = (RdpProtocol.RDGatewayUseConnectionCredentials)Enum.Parse(typeof(RdpProtocol.RDGatewayUseConnectionCredentials), xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value, true);
connectionInfo.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value;
connectionInfo.RDGatewayPassword = _decryptor.Decrypt(Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value));
connectionInfo.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value;
@@ -501,7 +502,7 @@ namespace mRemoteNG.Config.Serializers.Xml
if (_confVersion >= 2.6)
{
connectionInfo.SoundQuality = (RdpProtocol.RDPSoundQuality)MiscTools.StringToEnum(typeof(RdpProtocol.RDPSoundQuality), Convert.ToString(xmlnode.Attributes["SoundQuality"].Value));
connectionInfo.SoundQuality = (RdpProtocol.RDPSoundQuality)Enum.Parse(typeof(RdpProtocol.RDPSoundQuality), xmlnode.Attributes["SoundQuality"].Value, true);
connectionInfo.Inheritance.SoundQuality = bool.Parse(xmlnode.Attributes["InheritSoundQuality"].Value);
connectionInfo.RDPMinutesToIdleTimeout = Convert.ToInt32(xmlnode.Attributes["RDPMinutesToIdleTimeout"]?.Value ?? "0");
connectionInfo.Inheritance.RDPMinutesToIdleTimeout = bool.Parse(xmlnode.Attributes["InheritRDPMinutesToIdleTimeout"]?.Value ?? "False");

View File

@@ -4,7 +4,7 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.Config.Serializers.Xml
{
public class XmlRootNodeSerializer
public class XmlRootNodeSerializer
{
public XElement SerializeRootNodeInfo(RootNodeInfo rootNodeInfo, ICryptographyProvider cryptographyProvider, bool fullFileEncryption = false)
{
@@ -12,7 +12,8 @@ namespace mRemoteNG.Config.Serializers.Xml
var element = new XElement(xmlNamespace + "Connections");
element.Add(new XAttribute(XNamespace.Xmlns+"mrng", xmlNamespace));
element.Add(new XAttribute(XName.Get("Name"), rootNodeInfo.Name));
element.Add(new XAttribute(XName.Get("EncryptionEngine"), cryptographyProvider.CipherEngine));
element.Add(new XAttribute(XName.Get("Export"), "false"));
element.Add(new XAttribute(XName.Get("EncryptionEngine"), cryptographyProvider.CipherEngine));
element.Add(new XAttribute(XName.Get("BlockCipherMode"), cryptographyProvider.CipherMode));
element.Add(new XAttribute(XName.Get("KdfIterations"), cryptographyProvider.KeyDerivationIterations));
element.Add(new XAttribute(XName.Get("FullFileEncryption"), fullFileEncryption.ToString().ToLowerInvariant()));

View File

@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// <Assembly: AssemblyVersion("1.0.*")>
[assembly: AssemblyVersion("1.76.1.*")]
[assembly: AssemblyVersion("1.76.2.*")]
[assembly: NeutralResourcesLanguage("en")]

View File

@@ -14,6 +14,7 @@
<xs:element name="Node" type="mrng:connectioninfo" />
</xs:sequence>
<xs:attribute name="Name" type="xs:string" use="required" />
<xs:attribute name="Export" type="xs:boolean" use="required" />
<xs:attribute name="EncryptionEngine" type="xs:string" use="required" />
<xs:attribute name="BlockCipherMode" type="xs:string" use="required" />
<xs:attribute name="KdfIterations" type="xs:int" use="optional" />

View File

@@ -12,7 +12,7 @@ using static System.String;
namespace mRemoteNG.Tools
{
public static class MiscTools
public static class MiscTools
{
public static Icon GetIconFromFile(string FileName)
{
@@ -68,13 +68,6 @@ namespace mRemoteNG.Tools
{
return Text.Replace("\'", "\'\'");
}
public static object StringToEnum(Type t, string value)
{
return Enum.Parse(t, value);
}
public static string GetExceptionMessageRecursive(Exception ex)
{

View File

@@ -7,7 +7,6 @@ using mRemoteNG.Container;
using mRemoteNG.Messages;
using mRemoteNG.Tools;
using WeifenLuo.WinFormsUI.Docking;
using static mRemoteNG.Tools.MiscTools;
namespace mRemoteNG.UI.Window
{
@@ -129,7 +128,7 @@ namespace mRemoteNG.UI.Window
private void btnImport_Click(object sender, EventArgs e)
{
ProtocolType protocol = (ProtocolType)StringToEnum(typeof(ProtocolType), Convert.ToString(cbProtocol.SelectedItem));
ProtocolType protocol = (ProtocolType)Enum.Parse(typeof(ProtocolType), Convert.ToString(cbProtocol.SelectedItem), true);
importSelectedHosts(protocol);
DialogResult = DialogResult.OK;
Close();