Skip to content

Commit 6f209f8

Browse files
committed
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)
1 parent b89e372 commit 6f209f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+18276
-1339
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ FakesAssemblies/
276276

277277
# Node.js Tools for Visual Studio
278278
.ntvs_analysis.dat
279-
node_modules/
279+
# allow to embed nodejs modules into Myrtille so as not to use external CDNs
280+
#node_modules/
280281

281282
# Visual Studio 6 build log
282283
*.plg

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
2021-02-21 Version 2.9.2
1+
2021-03-07 Version 2.9.2
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)
3+
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)
24
fixed a problem with the creation of the self-signed certificate that prevented Myrtille from installing correctly on Windows Server 2012 R2 (thanks camjcorley)
35
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)
46
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

Myrtille.RDP/App.config

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
4+
<configSections>
5+
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, Log4net"/>
6+
</configSections>
7+
8+
<log4net>
9+
<root>
10+
<level value="DEBUG"/>
11+
<appender-ref ref="LogFileAppender"/>
12+
</root>
13+
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
14+
<param name="File" value="..\log\Myrtille.RDP.log"/>
15+
<param name="AppendToFile" value="true"/>
16+
<rollingStyle value="Size"/>
17+
<maxSizeRollBackups value="10"/>
18+
<maximumFileSize value="10MB"/>
19+
<staticLogFileName value="true"/>
20+
<layout type="log4net.Layout.PatternLayout">
21+
<param name="ConversionPattern" value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"/>
22+
</layout>
23+
</appender>
24+
</log4net>
25+
26+
<system.diagnostics>
27+
<trace autoflush="true" indentsize="4">
28+
<listeners>
29+
<add name="Log4netTraceListener" type="Myrtille.Log.Log4netTraceListener, Myrtille.Common">
30+
<!-- trace level (Information, Warning or Error) -->
31+
<filter type="Myrtille.Log.Log4netTraceFilter, Myrtille.Common" initializeData="Information"/>
32+
</add>
33+
<!-- disable output window traces -->
34+
<remove name="Default"/>
35+
</listeners>
36+
</trace>
37+
</system.diagnostics>
38+
39+
<startup>
40+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
41+
</startup>
42+
43+
</configuration>

Myrtille.RDP/FreeRDP.ico

1.12 KB
Binary file not shown.

Myrtille.RDP/Myrtille.RDP.csproj

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{01E631B8-2A75-4C16-BAE9-E7F0523D89B1}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>Myrtille.RDP</RootNamespace>
10+
<AssemblyName>Myrtille.RDP</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<Deterministic>true</Deterministic>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<PropertyGroup>
35+
<ApplicationIcon>FreeRDP.ico</ApplicationIcon>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
39+
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
40+
</Reference>
41+
<Reference Include="System" />
42+
<Reference Include="System.Configuration" />
43+
<Reference Include="System.Core" />
44+
<Reference Include="System.Web" />
45+
<Reference Include="System.Windows.Forms" />
46+
<Reference Include="System.Xml.Linq" />
47+
<Reference Include="System.Data.DataSetExtensions" />
48+
<Reference Include="Microsoft.CSharp" />
49+
<Reference Include="System.Data" />
50+
<Reference Include="System.Net.Http" />
51+
<Reference Include="System.Xml" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<Compile Include="Program.cs" />
55+
<Compile Include="Properties\AssemblyInfo.cs" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<None Include="App.config" />
59+
<None Include="packages.config" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<ProjectReference Include="..\Myrtille.Common\Myrtille.Common.csproj">
63+
<Project>{37630774-1321-4e6a-8661-4430a8946e9e}</Project>
64+
<Name>Myrtille.Common</Name>
65+
</ProjectReference>
66+
<ProjectReference Include="..\Myrtille.Services.Contracts\Myrtille.Services.Contracts.csproj">
67+
<Project>{010e1702-3045-4b13-bfb6-06ffc60b5cbb}</Project>
68+
<Name>Myrtille.Services.Contracts</Name>
69+
</ProjectReference>
70+
</ItemGroup>
71+
<ItemGroup>
72+
<Content Include="FreeRDP.ico" />
73+
</ItemGroup>
74+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
75+
<PropertyGroup>
76+
<PostBuildEvent>if exist "$(ProjectDir)FreeRDP\$(ConfigurationName)" copy /y "$(ProjectDir)FreeRDP\$(ConfigurationName)\*.dll" "$(TargetDir)"
77+
</PostBuildEvent>
78+
</PropertyGroup>
79+
</Project>

Myrtille.RDP/Program.cs

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
using System;
2+
using System.Diagnostics;
3+
using System.Runtime.InteropServices;
4+
using System.Threading;
5+
using System.Windows.Forms;
6+
using log4net.Config;
7+
using Myrtille.Services.Contracts;
8+
9+
namespace Myrtille.RDP
10+
{
11+
public class Program
12+
{
13+
[DllImport("wfreerdp-client.dll")]
14+
private static extern int StartRdpClient();
15+
16+
private static int Main(string[] args)
17+
{
18+
// enable the code below for debug; disable otherwise
19+
//if (Environment.UserInteractive)
20+
//{
21+
// MessageBox.Show("Attach the .NET debugger to the 'RDP Debug' Myrtille.RDP.exe process now for debug. Click OK when ready...", "RDP Debug");
22+
//}
23+
//else
24+
//{
25+
// Thread.Sleep(10000);
26+
//}
27+
28+
// logger
29+
XmlConfigurator.Configure();
30+
31+
string argKeyValueSeparator = ":";
32+
foreach (string arg in args)
33+
{
34+
var argParts = arg.Trim().Split(argKeyValueSeparator.ToCharArray(), 2);
35+
parseCommandLineArg(argParts[0].ToLower(), (argParts.Length > 1 ? argParts[1] : ""));
36+
}
37+
38+
if (!ValidConfig)
39+
{
40+
return (int)RemoteSessionExitCode.InvalidConfiguration;
41+
}
42+
43+
int exitCode = (int)RemoteSessionExitCode.Success;
44+
45+
try
46+
{
47+
exitCode = StartRdpClient();
48+
}
49+
catch (Exception e)
50+
{
51+
if (ConsoleOutput)
52+
{
53+
Console.WriteLine(e.Message);
54+
}
55+
56+
Trace.TraceError("RDP error, remote session {0} ({1})", RemoteSessionID, e);
57+
58+
exitCode = (int)RemoteSessionExitCode.Unknown;
59+
}
60+
61+
return exitCode;
62+
}
63+
64+
#region configuration
65+
66+
private static string RemoteSessionID { get; set; } // Myrtille session ID used for pipe messaging
67+
private static bool LoggingEnabled { get; set; } // Myrtille logging parameter
68+
private static bool ConsoleOutput { get; set; } // Output comms to console window
69+
private static uint Height { get; set; } // Height of RDP session
70+
private static uint Width { get; set; } // Width of RDP session
71+
72+
/// <summary>
73+
/// Indicate all command line parameters for correct operation have been received.
74+
/// </summary>
75+
private static bool ValidConfig
76+
{
77+
get
78+
{
79+
if (string.IsNullOrEmpty(RemoteSessionID)) return false;
80+
if (Height == 0) return false;
81+
if (Width == 0) return false;
82+
return true;
83+
}
84+
}
85+
86+
/// <summary>
87+
/// Parse command line arguments
88+
/// </summary>
89+
/// <param name="arg"></param>
90+
/// <param name="value"></param>
91+
private static void parseCommandLineArg(string arg, string value)
92+
{
93+
switch (arg)
94+
{
95+
case "/myrtille-sid":
96+
RemoteSessionID = value.Trim();
97+
break;
98+
case "/myrtille-window":
99+
ConsoleOutput = true;
100+
break;
101+
case "/myrtille-log":
102+
LoggingEnabled = true;
103+
break;
104+
case "/h":
105+
Height = uint.Parse(value);
106+
break;
107+
case "/w":
108+
Width = uint.Parse(value);
109+
break;
110+
}
111+
}
112+
113+
#endregion
114+
}
115+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Myrtille.RDP")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Myrtille")]
13+
[assembly: AssemblyCopyright("Copyright © 2014-2021 Cedric Coste")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("01e631b8-2a75-4c16-bae9-e7f0523d89b1")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("2.9.2.0")]
36+
[assembly: AssemblyFileVersion("2.9.2.0")]

Myrtille.RDP/packages.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="log4net" version="2.0.8" targetFramework="net45" />
4+
</packages>

Myrtille.Services/RemoteSessionProcess.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ public void StartProcess(
160160
{
161161
// see https://github.com/cedrozor/myrtille/blob/master/DOCUMENTATION.md#build for information and steps to build FreeRDP along with myrtille
162162
case HostType.RDP:
163-
clientFilePath = @"Myrtille.RDP\FreeRDP";
164-
clientFileName = "wfreerdp.exe";
163+
clientFilePath = @"Myrtille.RDP\bin";
164+
clientFileName = "Myrtille.RDP.exe";
165165
break;
166166
case HostType.SSH:
167167
clientFilePath = @"Myrtille.SSH\bin";

0 commit comments

Comments
 (0)