ScreenCast binary is now packaged in zip instead of embedded in Agent binary.

This commit is contained in:
Jared Goodwin 2019-03-25 08:41:36 -07:00
parent 1522125aeb
commit 7f7f751c5b
9 changed files with 39 additions and 75 deletions

4
.gitignore vendored
View File

@ -263,9 +263,7 @@ __pycache__/
/Remotely_Server/wwwroot/Downloads/*.exe
/Remotely_Server/wwwroot/Downloads/*.zip
/Remotely_Server/wwwroot/Downloads/*.appimage
/Remotely_Server/wwwroot/Downloads/CurrentAgentVersion.txt
/Remotely_Server/Server.db
/Remotely_Agent/Resources/*
/Remotely_Server/Recordings/*
/Remotely_Server/ffmpeg.exe
/Remotely_Server/Properties/PublishProfiles
/Remotely_Server/Properties/PublishProfiles

View File

@ -1,7 +1,6 @@
# Remotely
[![Build Status](https://dev.azure.com/translucency/Remotely/_apis/build/status/Remotely-GitHub?branchName=master)](https://dev.azure.com/translucency/Remotely/_build/latest?definitionId=5&branchName=master)
A remote control and remote scripting solution, built with .NET Core and SignalR Core.
> ## Repo is "On Pause"
@ -11,6 +10,8 @@ A remote control and remote scripting solution, built with .NET Core and SignalR
>
> Also, I'm looking for work. If you might entertain the idea of hiring me, please shoot me an email! :) (translucency@outlook.com)
(Please Note: Documentation and setup processes will improve eventually. Compatibility for older OS versions will likely never happen. I have a full-time job and a family/kids, which leaves me very little time to work on this. Right now, my focus is on getting features built that I already have planned.)
## Build Instructions (Windows 10)
The following steps will configure your Windows 10 machine for building the Remotely server and clients.
* Install Visual Studio 2019.
@ -28,18 +29,19 @@ The following steps will configure your Windows 10 machine for building the Remo
* Download and install the .NET Core Runtime.
* Link: https://dotnet.microsoft.com/download
* This includes the Hosting Bundle for Windows, which allows you to run ASP.NET Core in IIS.
* Download and unzip the Remotely Windows server package into your IIS site folder.
* An SSL certificate for HTTPS is required. You can install one for free using Let's Encrypt.
* Obtain a copy of the server files, either by building (above) or downloading the Windows server package from the website.
* Put the server files into your IIS site folder.
* An SSL certificate for HTTPS is recommended. You can install one for free using Let's Encrypt.
* Resources: https://letsencrypt.org/, https://certifytheweb.com/
* Documentation for hosting in IIS can be found here: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.2
## Hosting a Server (Linux)
* Download and install the .NET Core Runtime.
* Link: https://dotnet.microsoft.com/download
* Download and unzip the Remotely Linux server package.
* These files would typically go in /var/www/remotely/.
* Run Remotely_Server_Setup.sh (with sudo), which is in the Utilities folder in source control.
* Certbot is used in this script and will install an SSL certificate for your site. Your server needs to have a public domain name that is accessible from the internet.
* Obtain a copy of the server files, either by building (above) or downloading the Linux server package from the website.
* Copy the server files to the location from which they will be run.
* This would typically be in /var/www/remotely/.
* Run Remotely_Server_Setup.sh (with sudo), which is in the [Utilities folder in source control](https://raw.githubusercontent.com/Jay-Rad/Remotely/master/Utilities/Remotely_Server_Install.sh).
* The script installs the .NET Core runtime, as well as other dependencies.
* Certbot is used in this script and will install an SSL certificate for your site. Your server needs to have a public domain name that is accessible from the internet for this to work.
* More information: https://letsencrypt.org/, https://certbot.eff.org/
* App root will be the above output folder.
* Change values in appsettings.json for your environment.
@ -49,7 +51,7 @@ The following steps will configure your Windows 10 machine for building the Remo
* You can turn on session recording in appsettings.json.
* The following requirements must be met for it to work:
* On Linux, libgdiplus must be installed (sudo apt-get install libdgiplus).
* The process running the app must have access to create and/or modify a folder name "Recordings" in the site's root content folder.
* The process running the app must have access to create and modify a folder name "Recordings" in the site's root content folder.
* FFmpeg must be executable from the process running the Remotely server.
* Link: https://www.ffmpeg.org/download.html
* Remote control sessions will first be recorded as a series of images, which will then be converted to MP4 using FFmpeg.

View File

@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{
Utilities\Get-PSCommands.ps1 = Utilities\Get-PSCommands.ps1
Utilities\Get-WindowsCommands.ps1 = Utilities\Get-WindowsCommands.ps1
Utilities\Publish.ps1 = Utilities\Publish.ps1
Utilities\Register-TURNServer.ps1 = Utilities\Register-TURNServer.ps1
Utilities\Remotely_Server_Install.sh = Utilities\Remotely_Server_Install.sh
Utilities\Setup_Ubuntu_Builder.sh = Utilities\Setup_Ubuntu_Builder.sh
EndProjectSection

View File

@ -17,14 +17,6 @@
<RootNamespace>Remotely_Agent</RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\Remotely_ScreenCast.exe" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Remotely_ScreenCast.exe" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Management.Infrastructure" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="1.1.0" />

View File

@ -264,7 +264,12 @@ namespace Remotely_Agent.Services
return;
}
var filePath = ExtractScreenCasterEXE();
if (!File.Exists(OSUtils.ScreenCastExecutableFileName))
{
await hubConnection.InvokeAsync("DisplayConsoleMessage", "Remote control executable not found on target device.", requesterID);
return;
}
// Start ScreenCast.
await hubConnection.InvokeAsync("DisplayConsoleMessage", $"Starting remote control...", requesterID);
@ -273,11 +278,11 @@ namespace Remotely_Agent.Services
if (Program.IsDebug)
{
Process.Start(filePath, $"-mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -desktop default");
Process.Start(OSUtils.ScreenCastExecutableFileName, $"-mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -desktop default");
}
else
{
var result = Win32Interop.OpenInteractiveProcess(filePath + $" -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -desktop default", "default", true, out _);
var result = Win32Interop.OpenInteractiveProcess(OSUtils.ScreenCastExecutableFileName + $" -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -desktop default", "default", true, out _);
if (!result)
{
await hubConnection.InvokeAsync("DisplayConsoleMessage", "Remote control failed to start on target device.", requesterID);
@ -311,16 +316,15 @@ namespace Remotely_Agent.Services
{
// Start ScreenCast.
if (OSUtils.IsWindows)
{
var filePath = ExtractScreenCasterEXE();
{
if (Program.IsDebug)
{
Process.Start(filePath, $"-mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -relaunch true -desktop default -viewers {String.Join(",", viewerIDs)}");
Process.Start(OSUtils.ScreenCastExecutableFileName, $"-mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -relaunch true -desktop default -viewers {String.Join(",", viewerIDs)}");
}
else
{
var result = Win32Interop.OpenInteractiveProcess(filePath + $" -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -relaunch true -desktop default -viewers {String.Join(",", viewerIDs)}", "default", true, out _);
var result = Win32Interop.OpenInteractiveProcess(OSUtils.ScreenCastExecutableFileName + $" -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -relaunch true -desktop default -viewers {String.Join(",", viewerIDs)}", "default", true, out _);
if (!result)
{
Logger.Write("Failed to relaunch screen caster.");
@ -368,38 +372,6 @@ namespace Remotely_Agent.Services
});
}
private static string ExtractScreenCasterEXE()
{
// Cleanup old files.
foreach (var file in Directory.GetFiles(Path.GetTempPath(), "Remotely_ScreenCast*"))
{
try
{
File.Delete(file);
}
catch { }
}
// Get temp file name.
var count = 0;
var filePath = Path.Combine(Path.GetTempPath(), "Remotely_ScreenCast.exe");
while (File.Exists(filePath))
{
filePath = Path.Combine(Path.GetTempPath(), $"Remotely_ScreenCast{count}.exe");
count++;
}
// Extract ScreenCast.
using (var mrs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Remotely_Agent.Resources.Remotely_ScreenCast.exe"))
{
using (var fs = new FileStream(filePath, FileMode.Create))
{
mrs.CopyTo(fs);
}
}
return filePath;
}
private static void SendResultsViaAjax(string resultType, object result)
{
var targetURL = Utilities.GetConnectionInfo().Host + $"/API/Commands/{resultType}";

View File

@ -43,11 +43,11 @@ namespace Remotely_Library.Services
{
if (IsWindows)
{
return "Remotely Remote Control.exe";
return "Remotely_ScreenCast.exe";
}
else if (IsLinux)
{
return "remotely_remote_control";
return "Remotely_ScreenCast";
}
else
{

View File

@ -195,7 +195,7 @@
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Debug (
copy /y "$(TargetPath)" "$(SolutionDir)Remotely_Agent\Resources\"
copy /y "$(TargetPath)" "$(SolutionDir)Remotely_Agent\bin\Debug\netcoreapp2.2\"
)</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Fody.4.0.2\build\Fody.targets" Condition="Exists('..\packages\Fody.4.0.2\build\Fody.targets')" />

View File

@ -1 +1 @@
2019.03.23.1213
2019.03.25.0814

View File

@ -58,16 +58,7 @@ if ($ArgList.Contains("c")) {
# Add Current Version file to root content folder for client update checks.
Set-Content -Path ".\Remotely_Server\CurrentVersion.txt" -Value $CurrentVersion.Trim() -Encoding UTF8 -Force
# Copy .NET Framework ScreenCaster to Agent resources for embedding.
if ((Test-Path -Path ".\Remotely_Agent\Resources") -eq $false) {
New-Item -Path ".\Remotely_Agent\Resources" -ItemType Directory
}
if ((Test-Path -Path ".\Remotely_ScreenCast\bin\Release\Remotely_ScreenCast.exe") -eq $true) {
Copy-Item -Path ".\Remotely_ScreenCast\bin\Release\Remotely_ScreenCast.exe" -Destination ".\Remotely_Agent\Resources\Remotely_ScreenCast.exe" -Force
}
elseif ((Test-Path -Path ".\Remotely_ScreenCast\bin\Debug\Remotely_ScreenCast.exe") -eq $true) {
Copy-Item -Path ".\Remotely_ScreenCast\bin\Debug\Remotely_ScreenCast.exe" -Destination ".\Remotely_Agent\Resources\Remotely_ScreenCast.exe" -Force
}
# Clear publish folders.
if ((Test-Path -Path ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x64\publish") -eq $true) {
Get-ChildItem -Path ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x64\publish" | Remove-Item -Force -Recurse
@ -88,6 +79,16 @@ if ($ArgList.Contains("c")) {
Pop-Location
# Copy .NET Framework ScreenCaster to Agent output.
if ((Test-Path -Path ".\Remotely_ScreenCast\bin\Release\Remotely_ScreenCast.exe") -eq $true) {
Copy-Item -Path ".\Remotely_ScreenCast\bin\Release\Remotely_ScreenCast.exe" -Destination ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x64\publish\Remotely_ScreenCast.exe" -Force
Copy-Item -Path ".\Remotely_ScreenCast\bin\Release\Remotely_ScreenCast.exe" -Destination ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x86\publish\Remotely_ScreenCast.exe" -Force
}
elseif ((Test-Path -Path ".\Remotely_ScreenCast\bin\Debug\Remotely_ScreenCast.exe") -eq $true) {
Copy-Item -Path ".\Remotely_ScreenCast\bin\Debug\Remotely_ScreenCast.exe" -Destination ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x64\publish\Remotely_ScreenCast.exe" -Force
Copy-Item -Path ".\Remotely_ScreenCast\bin\Debug\Remotely_ScreenCast.exe" -Destination ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x86\publish\Remotely_ScreenCast.exe" -Force
}
# Compress Core clients.
Push-Location -Path ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x64\publish"
Compress-Archive -Path ".\*" -DestinationPath "Remotely-Win10-x64.zip" -CompressionLevel Optimal -Force