Skip to content

Commit

Permalink
FreeRDP is now built as a dll instead of an executable for better mod…
Browse files Browse the repository at this point in the history
…ularity and to reduce the risk of false positive detection of wfreerdp.exe by some antiviruses (mostly cloud based)

embedded interact.js and simple-keyboard (nodejs modules) into myrtille in order to remove dependencies on external CDNs (ans thus allow myrtille to be used standalone and not subject to external changes)
  • Loading branch information
cedrozor committed Mar 7, 2021
1 parent b89e372 commit 6f209f8
Show file tree
Hide file tree
Showing 88 changed files with 18,276 additions and 1,339 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ FakesAssemblies/

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# allow to embed nodejs modules into Myrtille so as not to use external CDNs
#node_modules/

# Visual Studio 6 build log
*.plg
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
2021-02-21 Version 2.9.2
2021-03-07 Version 2.9.2
FreeRDP is now built as a dll instead of an executable for better modularity and to reduce the risk of false positive detection of wfreerdp.exe by some antiviruses (mostly cloud based)
embedded interact.js and simple-keyboard (nodejs modules) into myrtille in order to remove dependencies on external CDNs (ans thus allow myrtille to be used standalone and not subject to external changes)
fixed a problem with the creation of the self-signed certificate that prevented Myrtille from installing correctly on Windows Server 2012 R2 (thanks camjcorley)
a session can now be shared directly by url (simply copy & paste the page url then share it), with owner rights (web.config, can be disabled for anti-spoofing protection)
region updates are now dropped by the gateway if the client latency is above the image cache duration (1 sec); only fullscreen updates are sent
Expand Down
43 changes: 43 additions & 0 deletions Myrtille.RDP/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, Log4net"/>
</configSections>

<log4net>
<root>
<level value="DEBUG"/>
<appender-ref ref="LogFileAppender"/>
</root>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="..\log\Myrtille.RDP.log"/>
<param name="AppendToFile" value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="10MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"/>
</layout>
</appender>
</log4net>

<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="Log4netTraceListener" type="Myrtille.Log.Log4netTraceListener, Myrtille.Common">
<!-- trace level (Information, Warning or Error) -->
<filter type="Myrtille.Log.Log4netTraceFilter, Myrtille.Common" initializeData="Information"/>
</add>
<!-- disable output window traces -->
<remove name="Default"/>
</listeners>
</trace>
</system.diagnostics>

<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>

</configuration>
Binary file added Myrtille.RDP/FreeRDP.ico
Binary file not shown.
79 changes: 79 additions & 0 deletions Myrtille.RDP/Myrtille.RDP.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{01E631B8-2A75-4C16-BAE9-E7F0523D89B1}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Myrtille.RDP</RootNamespace>
<AssemblyName>Myrtille.RDP</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>FreeRDP.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Myrtille.Common\Myrtille.Common.csproj">
<Project>{37630774-1321-4e6a-8661-4430a8946e9e}</Project>
<Name>Myrtille.Common</Name>
</ProjectReference>
<ProjectReference Include="..\Myrtille.Services.Contracts\Myrtille.Services.Contracts.csproj">
<Project>{010e1702-3045-4b13-bfb6-06ffc60b5cbb}</Project>
<Name>Myrtille.Services.Contracts</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="FreeRDP.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if exist "$(ProjectDir)FreeRDP\$(ConfigurationName)" copy /y "$(ProjectDir)FreeRDP\$(ConfigurationName)\*.dll" "$(TargetDir)"
</PostBuildEvent>
</PropertyGroup>
</Project>
115 changes: 115 additions & 0 deletions Myrtille.RDP/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using log4net.Config;
using Myrtille.Services.Contracts;

namespace Myrtille.RDP
{
public class Program
{
[DllImport("wfreerdp-client.dll")]
private static extern int StartRdpClient();

private static int Main(string[] args)
{
// enable the code below for debug; disable otherwise
//if (Environment.UserInteractive)
//{
// MessageBox.Show("Attach the .NET debugger to the 'RDP Debug' Myrtille.RDP.exe process now for debug. Click OK when ready...", "RDP Debug");
//}
//else
//{
// Thread.Sleep(10000);
//}

// logger
XmlConfigurator.Configure();

string argKeyValueSeparator = ":";
foreach (string arg in args)
{
var argParts = arg.Trim().Split(argKeyValueSeparator.ToCharArray(), 2);
parseCommandLineArg(argParts[0].ToLower(), (argParts.Length > 1 ? argParts[1] : ""));
}

if (!ValidConfig)
{
return (int)RemoteSessionExitCode.InvalidConfiguration;
}

int exitCode = (int)RemoteSessionExitCode.Success;

try
{
exitCode = StartRdpClient();
}
catch (Exception e)
{
if (ConsoleOutput)
{
Console.WriteLine(e.Message);
}

Trace.TraceError("RDP error, remote session {0} ({1})", RemoteSessionID, e);

exitCode = (int)RemoteSessionExitCode.Unknown;
}

return exitCode;
}

#region configuration

private static string RemoteSessionID { get; set; } // Myrtille session ID used for pipe messaging
private static bool LoggingEnabled { get; set; } // Myrtille logging parameter
private static bool ConsoleOutput { get; set; } // Output comms to console window
private static uint Height { get; set; } // Height of RDP session
private static uint Width { get; set; } // Width of RDP session

/// <summary>
/// Indicate all command line parameters for correct operation have been received.
/// </summary>
private static bool ValidConfig
{
get
{
if (string.IsNullOrEmpty(RemoteSessionID)) return false;
if (Height == 0) return false;
if (Width == 0) return false;
return true;
}
}

/// <summary>
/// Parse command line arguments
/// </summary>
/// <param name="arg"></param>
/// <param name="value"></param>
private static void parseCommandLineArg(string arg, string value)
{
switch (arg)
{
case "/myrtille-sid":
RemoteSessionID = value.Trim();
break;
case "/myrtille-window":
ConsoleOutput = true;
break;
case "/myrtille-log":
LoggingEnabled = true;
break;
case "/h":
Height = uint.Parse(value);
break;
case "/w":
Width = uint.Parse(value);
break;
}
}

#endregion
}
}
36 changes: 36 additions & 0 deletions Myrtille.RDP/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Myrtille.RDP")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Myrtille")]
[assembly: AssemblyCopyright("Copyright © 2014-2021 Cedric Coste")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("01e631b8-2a75-4c16-bae9-e7f0523d89b1")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.9.2.0")]
[assembly: AssemblyFileVersion("2.9.2.0")]
4 changes: 4 additions & 0 deletions Myrtille.RDP/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.8" targetFramework="net45" />
</packages>
4 changes: 2 additions & 2 deletions Myrtille.Services/RemoteSessionProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public void StartProcess(
{
// see https://github.com/cedrozor/myrtille/blob/master/DOCUMENTATION.md#build for information and steps to build FreeRDP along with myrtille
case HostType.RDP:
clientFilePath = @"Myrtille.RDP\FreeRDP";
clientFileName = "wfreerdp.exe";
clientFilePath = @"Myrtille.RDP\bin";
clientFileName = "Myrtille.RDP.exe";
break;
case HostType.SSH:
clientFilePath = @"Myrtille.SSH\bin";
Expand Down
Loading

0 comments on commit 6f209f8

Please sign in to comment.