-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2a1893
commit 89d4ec5
Showing
52 changed files
with
5,792 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
.vs | ||
bin | ||
obj | ||
packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
<?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>{ABA795E1-3A9C-4EF2-BDF5-C4ACAE48670F}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<RootNamespace>Garry.Control4.Jailbreak</RootNamespace> | ||
<AssemblyName>C4Jailbreak</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
<PublishUrl>publish\</PublishUrl> | ||
<Install>true</Install> | ||
<InstallFrom>Disk</InstallFrom> | ||
<UpdateEnabled>false</UpdateEnabled> | ||
<UpdateMode>Foreground</UpdateMode> | ||
<UpdateInterval>7</UpdateInterval> | ||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> | ||
<UpdatePeriodically>false</UpdatePeriodically> | ||
<UpdateRequired>false</UpdateRequired> | ||
<MapFileExtensions>true</MapFileExtensions> | ||
<ApplicationRevision>0</ApplicationRevision> | ||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> | ||
<IsWebBootstrapper>false</IsWebBootstrapper> | ||
<UseApplicationTrust>false</UseApplicationTrust> | ||
<BootstrapperEnabled>true</BootstrapperEnabled> | ||
</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 /> | ||
<PropertyGroup> | ||
<ApplicationManifest>app.manifest</ApplicationManifest> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<ApplicationIcon> | ||
</ApplicationIcon> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<StartupObject> | ||
</StartupObject> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Mono.Cecil, Version=0.11.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL"> | ||
<HintPath>packages\Mono.Cecil.0.11.1\lib\net40\Mono.Cecil.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Mono.Cecil.Mdb, Version=0.11.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL"> | ||
<HintPath>packages\Mono.Cecil.0.11.1\lib\net40\Mono.Cecil.Mdb.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Mono.Cecil.Pdb, Version=0.11.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL"> | ||
<HintPath>packages\Mono.Cecil.0.11.1\lib\net40\Mono.Cecil.Pdb.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Mono.Cecil.Rocks, Version=0.11.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL"> | ||
<HintPath>packages\Mono.Cecil.0.11.1\lib\net40\Mono.Cecil.Rocks.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL"> | ||
<HintPath>packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.ComponentModel.Composition" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.IO.Compression.FileSystem" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Numerics" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Deployment" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<Compile Include="UI\Restore.cs"> | ||
<SubType>UserControl</SubType> | ||
</Compile> | ||
<Compile Include="UI\Restore.Designer.cs"> | ||
<DependentUpon>Restore.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="UI\DirectorPatch.cs"> | ||
<SubType>UserControl</SubType> | ||
</Compile> | ||
<Compile Include="UI\DirectorPatch.Designer.cs"> | ||
<DependentUpon>DirectorPatch.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="UI\Director.cs"> | ||
<SubType>UserControl</SubType> | ||
</Compile> | ||
<Compile Include="UI\Director.Designer.cs"> | ||
<DependentUpon>Director.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="DirectorManager.cs" /> | ||
<Compile Include="UI\Composer.cs"> | ||
<SubType>UserControl</SubType> | ||
</Compile> | ||
<Compile Include="UI\Composer.Designer.cs"> | ||
<DependentUpon>Composer.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="UI\Backup.cs"> | ||
<SubType>UserControl</SubType> | ||
</Compile> | ||
<Compile Include="UI\Backup.Designer.cs"> | ||
<DependentUpon>Backup.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="UI\LogWindow.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="UI\LogWindow.Designer.cs"> | ||
<DependentUpon>LogWindow.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="UI\MainWindow.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="UI\MainWindow.Designer.cs"> | ||
<DependentUpon>MainWindow.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Soap\GetCommonName.cs" /> | ||
<Compile Include="Soap\GetItems.cs" /> | ||
<Compile Include="Soap\GetVersionInfo.cs" /> | ||
<Compile Include="Utility\Sddp.cs" /> | ||
<Compile Include="Utility\Sddp.DeviceResponse.cs" /> | ||
<Compile Include="Utility\SoapClient.cs" /> | ||
<EmbeddedResource Include="UI\Restore.resx"> | ||
<DependentUpon>Restore.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="UI\DirectorPatch.resx"> | ||
<DependentUpon>DirectorPatch.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="UI\Director.resx"> | ||
<DependentUpon>Director.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="UI\Composer.resx"> | ||
<DependentUpon>Composer.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="UI\Backup.resx"> | ||
<DependentUpon>Backup.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="UI\LogWindow.resx"> | ||
<DependentUpon>LogWindow.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="UI\MainWindow.resx"> | ||
<DependentUpon>MainWindow.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<SubType>Designer</SubType> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
<None Include="app.manifest" /> | ||
<None Include="packages.config" /> | ||
<None Include="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
<Compile Include="Properties\Settings.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\download.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\patch %281%29.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\four.ico" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2"> | ||
<Visible>False</Visible> | ||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName> | ||
<Install>true</Install> | ||
</BootstrapperPackage> | ||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> | ||
<Visible>False</Visible> | ||
<ProductName>.NET Framework 3.5 SP1</ProductName> | ||
<Install>false</Install> | ||
</BootstrapperPackage> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\loupe.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\cup-cake.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\folder.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\database.png" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<PublishUrlHistory>publish\</PublishUrlHistory> | ||
<InstallUrlHistory /> | ||
<SupportUrlHistory /> | ||
<UpdateUrlHistory /> | ||
<BootstrapperUrlHistory /> | ||
<ErrorReportUrlHistory /> | ||
<FallbackCulture>en-US</FallbackCulture> | ||
<VerifyUploadedFiles>false</VerifyUploadedFiles> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29411.108 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Control4.Jailbreak", "Control4.Jailbreak.csproj", "{ABA795E1-3A9C-4EF2-BDF5-C4ACAE48670F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{ABA795E1-3A9C-4EF2-BDF5-C4ACAE48670F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{ABA795E1-3A9C-4EF2-BDF5-C4ACAE48670F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{ABA795E1-3A9C-4EF2-BDF5-C4ACAE48670F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{ABA795E1-3A9C-4EF2-BDF5-C4ACAE48670F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {DF3DE388-B315-4AB1-8043-C4EB6ED31E0C} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using Garry.Control4.Jailbreak.Utility; | ||
using Renci.SshNet; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Garry.Control4.Jailbreak | ||
{ | ||
public class DirectorManager | ||
{ | ||
private IPAddress address; | ||
|
||
SoapClient Soap; | ||
ConnectionInfo SshConnectionInfo; | ||
|
||
public string SystemName { get; private set; } | ||
public string CommonName { get; private set; } | ||
public string Version { get; private set; } | ||
|
||
public DirectorManager( IPAddress address ) | ||
{ | ||
this.address = address; | ||
|
||
SshConnectionInfo = new ConnectionInfo( address.ToString(), "root", new PasswordAuthenticationMethod( "root", "t0talc0ntr0l4!" ) ); | ||
SshConnectionInfo.RetryAttempts = 1; | ||
SshConnectionInfo.Timeout = TimeSpan.FromSeconds( 2 ); | ||
} | ||
|
||
public ScpClient ScpClient => new ScpClient( SshConnectionInfo ); | ||
public SshClient SshClient => new SshClient( SshConnectionInfo ); | ||
|
||
public async Task<bool> TryInitialize() | ||
{ | ||
Soap = new SoapClient( address ); | ||
|
||
var getItems = await Soap.Call<Soap.GetItems>( "GetItems", "filter", "1" ); | ||
var getVersionInfo = await Soap.Call<Soap.GetVersionInfo>( "GetVersionInfo" ); | ||
var getCommonName = await Soap.Call<Soap.GetCommonName>( "GetCommonName" ); | ||
|
||
SystemName = getItems.SystemItems.All.Single( x => x.Type == 1 ).Name; | ||
CommonName = getCommonName.CommonName; | ||
Version = getVersionInfo.Versions.All.Single( x => x.Name == "Director" ).VersionNumber; | ||
|
||
Trace.WriteLine( $"Version is {Version}" ); | ||
|
||
return true; | ||
} | ||
|
||
internal async void Reboot( LogWindow log ) | ||
{ | ||
log.WriteNormal( $"\nRebooting Director\n\n" ); | ||
|
||
using ( var ssh = SshClient ) | ||
{ | ||
log.WriteTrace( $"\nConnecting via SSH.. " ); | ||
|
||
ssh.Connect(); | ||
|
||
log.WriteTrace( $"\n .. connected!" ); | ||
|
||
log.WriteSuccess( $"\n\nYour director is now rebooting. This can take a few minutes and it's a nervous wait - I know.\n" ); | ||
log.WriteSuccess( $"But nothing we've done here will stop your director from booting up, so don't worry.\n" ); | ||
|
||
var cmd = ssh.CreateCommand( "sysman reboot" ); | ||
|
||
var task = cmd.BeginExecute(); | ||
|
||
while( !task.IsCompleted ) | ||
{ | ||
await Task.Delay( 10 ); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Garry Newman | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.