-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added installer for fiddler extension (#177)
- Loading branch information
1 parent
8b02057
commit 2915c7d
Showing
12 changed files
with
379 additions
and
4 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
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
38 changes: 38 additions & 0 deletions
38
Fiddler.Kerberos.NET/Fiddler.Kerberos.NET/FiddlerKerberosNET.nuspec
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,38 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<metadata> | ||
<id>FiddlerKerberosNET</id> | ||
<version>4.0.1</version> | ||
<title>Kerberos.NET Fiddler Extension</title> | ||
<authors>Kerberos.NET</authors> | ||
<owners>.NET Foundation</owners> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>A Fiddler extension that parses Kerberos messages using the Kerberos.NET library.</description> | ||
</metadata> | ||
<files> | ||
<file src="DeltaCompressionDotNet.dll" target="lib\net45\DeltaCompressionDotNet.dll" /> | ||
<file src="DeltaCompressionDotNet.MsDelta.dll" target="lib\net45\DeltaCompressionDotNet.MsDelta.dll" /> | ||
<file src="DeltaCompressionDotNet.PatchApi.dll" target="lib\net45\DeltaCompressionDotNet.PatchApi.dll" /> | ||
<file src="Fiddler.Kerberos.NET.dll" target="lib\net45\Fiddler.Kerberos.NET.dll" /> | ||
<file src="InstallHost.exe" target="lib\net45\InstallHost.exe" /> | ||
<file src="KerberosInstaller.dll" target="lib\net45\KerberosInstaller.dll" /> | ||
<file src="Kerberos.NET.dll" target="lib\net45\Kerberos.NET.dll" /> | ||
<file src="Microsoft.Extensions.Logging.Abstractions.dll" target="lib\net45\Microsoft.Extensions.Logging.Abstractions.dll" /> | ||
<file src="Mono.Cecil.dll" target="lib\net45\Mono.Cecil.dll" /> | ||
<file src="Mono.Cecil.Mdb.dll" target="lib\net45\Mono.Cecil.Mdb.dll" /> | ||
<file src="Mono.Cecil.Pdb.dll" target="lib\net45\Mono.Cecil.Pdb.dll" /> | ||
<file src="Mono.Cecil.Rocks.dll" target="lib\net45\Mono.Cecil.Rocks.dll" /> | ||
<file src="Newtonsoft.Json.dll" target="lib\net45\Newtonsoft.Json.dll" /> | ||
<file src="NuGet.Squirrel.dll" target="lib\net45\NuGet.Squirrel.dll" /> | ||
<file src="SharpCompress.dll" target="lib\net45\SharpCompress.dll" /> | ||
<file src="Splat.dll" target="lib\net45\Splat.dll" /> | ||
<file src="Squirrel.dll" target="lib\net45\Squirrel.dll" /> | ||
<file src="System.Buffers.dll" target="lib\net45\System.Buffers.dll" /> | ||
<file src="System.IO.Pipelines.dll" target="lib\net45\System.IO.Pipelines.dll" /> | ||
<file src="System.Memory.dll" target="lib\net45\System.Memory.dll" /> | ||
<file src="System.Numerics.Vectors.dll" target="lib\net45\System.Numerics.Vectors.dll" /> | ||
<file src="System.Runtime.CompilerServices.Unsafe.dll" target="lib\net45\System.Runtime.CompilerServices.Unsafe.dll" /> | ||
<file src="System.Security.Cryptography.Pkcs.dll" target="lib\net45\System.Security.Cryptography.Pkcs.dll" /> | ||
<file src="System.Threading.Tasks.Extensions.dll" target="lib\net45\System.Threading.Tasks.Extensions.dll" /> | ||
</files> | ||
</package> |
15 changes: 14 additions & 1 deletion
15
Fiddler.Kerberos.NET/Fiddler.Kerberos.NET/KerberosInspector.cs
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
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,71 @@ | ||
<?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>{2B5D7B76-A951-4DF5-B0A6-2A110FF194D2}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>InstallHost</RootNamespace> | ||
<AssemblyName>InstallHost</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<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> | ||
<SignAssembly>false</SignAssembly> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<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="key.snk" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="squirrel.windows"> | ||
<Version>1.9.1</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\KerberosInstaller\KerberosInstaller.csproj"> | ||
<Project>{9686f73f-5526-4c9a-b603-c7acbfcb1976}</Project> | ||
<Name>KerberosInstaller</Name> | ||
</ProjectReference> | ||
</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,10 @@ | ||
namespace Fiddler.Kerberos.NET | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
InstallManager.Setup(); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Fiddler.Kerberos.NET/InstallHost/Properties/AssemblyInfo.cs
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 @@ | ||
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("InstallHost")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("InstallHost")] | ||
[assembly: AssemblyCopyright("Copyright © 2020")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] | ||
|
||
// 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("2b5d7b76-a951-4df5-b0a6-2a110ff194d2")] |
Binary file not shown.
103 changes: 103 additions & 0 deletions
103
Fiddler.Kerberos.NET/KerberosInstaller/InstallManager.cs
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,103 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using Squirrel; | ||
|
||
namespace Fiddler.Kerberos.NET | ||
{ | ||
public static class InstallManager | ||
{ | ||
public static void Setup() | ||
{ | ||
SquirrelAwareApp.HandleEvents( | ||
onInitialInstall: v => CopyFiles(), | ||
onAppUpdate: v => CopyFiles(), | ||
onAppUninstall: v => DeleteFiles(), | ||
onFirstRun: () => { } | ||
); | ||
} | ||
|
||
private static bool running; | ||
|
||
public static void Watch() | ||
{ | ||
if (running) | ||
{ | ||
return; | ||
} | ||
|
||
running = true; | ||
|
||
Task.Run(Update); | ||
} | ||
|
||
private static async Task Update() | ||
{ | ||
try | ||
{ | ||
using (var mgr = await UpdateManager.GitHubUpdateManager("https://github.com/dotnet/Kerberos.NET")) | ||
{ | ||
await mgr.UpdateApp(); | ||
} | ||
} | ||
catch | ||
{ | ||
return; | ||
} | ||
} | ||
|
||
private static void DeleteFiles() | ||
{ | ||
var files = GetPluginFiles(); | ||
|
||
foreach (var file in files) | ||
{ | ||
var name = Path.GetFileName(file); | ||
|
||
var inspectorPath = GetInspectorPath(name); | ||
|
||
try | ||
{ | ||
if (File.Exists(inspectorPath)) | ||
{ | ||
File.Delete(inspectorPath); | ||
} | ||
} | ||
catch | ||
{ | ||
; | ||
} | ||
} | ||
} | ||
|
||
private static void CopyFiles() | ||
{ | ||
string[] files = GetPluginFiles(); | ||
|
||
foreach (var file in files) | ||
{ | ||
var name = Path.GetFileName(file); | ||
var targetPath = GetInspectorPath(name); | ||
|
||
File.Copy( | ||
file, | ||
targetPath, | ||
overwrite: true | ||
); | ||
} | ||
} | ||
|
||
private static string GetInspectorPath(string file) | ||
{ | ||
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + $"\\fiddler2\\inspectors\\{file}"; | ||
} | ||
|
||
private static string[] GetPluginFiles() | ||
{ | ||
var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | ||
|
||
return Directory.GetFiles(directory, "*.dll"); | ||
} | ||
} | ||
} |
Oops, something went wrong.