Skip to content

Commit 2915c7d

Browse files
authored
Added installer for fiddler extension (#177)
1 parent 8b02057 commit 2915c7d

12 files changed

+379
-4
lines changed

Fiddler.Kerberos.NET/Fiddler.Kerberos.NET.sln

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ VisualStudioVersion = 16.0.30225.117
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fiddler.Kerberos.NET", "Fiddler.Kerberos.NET\Fiddler.Kerberos.NET.csproj", "{4B76BD9D-C771-45CC-BC4A-5702B3DBD11E}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallHost", "InstallHost\InstallHost.csproj", "{2B5D7B76-A951-4DF5-B0A6-2A110FF194D2}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KerberosInstaller", "KerberosInstaller\KerberosInstaller.csproj", "{9686F73F-5526-4C9A-B603-C7ACBFCB1976}"
11+
EndProject
812
Global
913
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1014
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +19,14 @@ Global
1519
{4B76BD9D-C771-45CC-BC4A-5702B3DBD11E}.Debug|Any CPU.Build.0 = Debug|Any CPU
1620
{4B76BD9D-C771-45CC-BC4A-5702B3DBD11E}.Release|Any CPU.ActiveCfg = Release|Any CPU
1721
{4B76BD9D-C771-45CC-BC4A-5702B3DBD11E}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{2B5D7B76-A951-4DF5-B0A6-2A110FF194D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{2B5D7B76-A951-4DF5-B0A6-2A110FF194D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{2B5D7B76-A951-4DF5-B0A6-2A110FF194D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{2B5D7B76-A951-4DF5-B0A6-2A110FF194D2}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{9686F73F-5526-4C9A-B603-C7ACBFCB1976}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{9686F73F-5526-4C9A-B603-C7ACBFCB1976}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{9686F73F-5526-4C9A-B603-C7ACBFCB1976}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{9686F73F-5526-4C9A-B603-C7ACBFCB1976}.Release|Any CPU.Build.0 = Release|Any CPU
1830
EndGlobalSection
1931
GlobalSection(SolutionProperties) = preSolution
2032
HideSolutionNode = FALSE

Fiddler.Kerberos.NET/Fiddler.Kerberos.NET/Fiddler.Kerberos.NET.csproj

+21-3
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,33 @@
106106
</ItemGroup>
107107
<ItemGroup>
108108
<None Include="app.config" />
109+
<None Include="FiddlerKerberosNET.nuspec" />
109110
<None Include="packages.config" />
110111
</ItemGroup>
112+
<ItemGroup>
113+
<ProjectReference Include="..\InstallHost\InstallHost.csproj">
114+
<Project>{2b5d7b76-a951-4df5-b0a6-2a110ff194d2}</Project>
115+
<Name>InstallHost</Name>
116+
</ProjectReference>
117+
<ProjectReference Include="..\KerberosInstaller\KerberosInstaller.csproj">
118+
<Project>{9686f73f-5526-4c9a-b603-c7acbfcb1976}</Project>
119+
<Name>KerberosInstaller</Name>
120+
</ProjectReference>
121+
</ItemGroup>
111122
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
112123
<PropertyGroup>
113-
<PostBuildEvent>XCOPY "$(TargetDir)*.dll" "%25userprofile%25\Documents\Fiddler2\Inspectors\" /S /Y
114-
XCOPY "$(TargetDir)*.pdb" "%25userprofile%25\Documents\Fiddler2\Inspectors\" /S /Y
115-
XCOPY "$(TargetPath)" "%25userprofile%25\Documents\Fiddler2\Scripts\" /S /Y</PostBuildEvent>
124+
<PostBuildEvent>rem XCOPY "$(TargetDir)*.dll" "%25userprofile%25\Documents\Fiddler2\Inspectors\" /S /Y
125+
rem XCOPY "$(TargetDir)*.pdb" "%25userprofile%25\Documents\Fiddler2\Inspectors\" /S /Y
126+
rem XCOPY "$(TargetPath)" "%25userprofile%25\Documents\Fiddler2\Scripts\" /S /Y</PostBuildEvent>
116127
</PropertyGroup>
117128
<PropertyGroup>
118129
<PreBuildEvent>taskkill /im fiddler.exe /t /f 2&gt;&amp;1 | exit /B 0</PreBuildEvent>
119130
</PropertyGroup>
131+
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'">
132+
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
133+
<Output TaskParameter="Assemblies" ItemName="myAssemblyInfo" />
134+
</GetAssemblyIdentity>
135+
<Exec Command="nuget pack FiddlerKerberosNet.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=Release -OutputDirectory $(OutDir) -BasePath $(OutDir)" />
136+
<Exec Command="squirrel --releasify $(OutDir)FiddlerKerberosNet.$([System.Version]::Parse(%(myAssemblyInfo.Version)).ToString(3)).nupkg" />
137+
</Target>
120138
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3+
<metadata>
4+
<id>FiddlerKerberosNET</id>
5+
<version>4.0.1</version>
6+
<title>Kerberos.NET Fiddler Extension</title>
7+
<authors>Kerberos.NET</authors>
8+
<owners>.NET Foundation</owners>
9+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
10+
<description>A Fiddler extension that parses Kerberos messages using the Kerberos.NET library.</description>
11+
</metadata>
12+
<files>
13+
<file src="DeltaCompressionDotNet.dll" target="lib\net45\DeltaCompressionDotNet.dll" />
14+
<file src="DeltaCompressionDotNet.MsDelta.dll" target="lib\net45\DeltaCompressionDotNet.MsDelta.dll" />
15+
<file src="DeltaCompressionDotNet.PatchApi.dll" target="lib\net45\DeltaCompressionDotNet.PatchApi.dll" />
16+
<file src="Fiddler.Kerberos.NET.dll" target="lib\net45\Fiddler.Kerberos.NET.dll" />
17+
<file src="InstallHost.exe" target="lib\net45\InstallHost.exe" />
18+
<file src="KerberosInstaller.dll" target="lib\net45\KerberosInstaller.dll" />
19+
<file src="Kerberos.NET.dll" target="lib\net45\Kerberos.NET.dll" />
20+
<file src="Microsoft.Extensions.Logging.Abstractions.dll" target="lib\net45\Microsoft.Extensions.Logging.Abstractions.dll" />
21+
<file src="Mono.Cecil.dll" target="lib\net45\Mono.Cecil.dll" />
22+
<file src="Mono.Cecil.Mdb.dll" target="lib\net45\Mono.Cecil.Mdb.dll" />
23+
<file src="Mono.Cecil.Pdb.dll" target="lib\net45\Mono.Cecil.Pdb.dll" />
24+
<file src="Mono.Cecil.Rocks.dll" target="lib\net45\Mono.Cecil.Rocks.dll" />
25+
<file src="Newtonsoft.Json.dll" target="lib\net45\Newtonsoft.Json.dll" />
26+
<file src="NuGet.Squirrel.dll" target="lib\net45\NuGet.Squirrel.dll" />
27+
<file src="SharpCompress.dll" target="lib\net45\SharpCompress.dll" />
28+
<file src="Splat.dll" target="lib\net45\Splat.dll" />
29+
<file src="Squirrel.dll" target="lib\net45\Squirrel.dll" />
30+
<file src="System.Buffers.dll" target="lib\net45\System.Buffers.dll" />
31+
<file src="System.IO.Pipelines.dll" target="lib\net45\System.IO.Pipelines.dll" />
32+
<file src="System.Memory.dll" target="lib\net45\System.Memory.dll" />
33+
<file src="System.Numerics.Vectors.dll" target="lib\net45\System.Numerics.Vectors.dll" />
34+
<file src="System.Runtime.CompilerServices.Unsafe.dll" target="lib\net45\System.Runtime.CompilerServices.Unsafe.dll" />
35+
<file src="System.Security.Cryptography.Pkcs.dll" target="lib\net45\System.Security.Cryptography.Pkcs.dll" />
36+
<file src="System.Threading.Tasks.Extensions.dll" target="lib\net45\System.Threading.Tasks.Extensions.dll" />
37+
</files>
38+
</package>

Fiddler.Kerberos.NET/Fiddler.Kerberos.NET/KerberosInspector.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
using System.Windows.Forms;
1+
using System;
2+
using System.Windows.Forms;
23

34
namespace Fiddler.Kerberos.NET
45
{
56
public abstract class KerberosInspector : Inspector2
67
{
8+
protected KerberosInspector()
9+
{
10+
try
11+
{
12+
InstallManager.Watch();
13+
}
14+
catch (Exception ex)
15+
{
16+
FiddlerApplication.Log.LogString("Kerberos Inspector Update Exception: " + ex.ToString());
17+
}
18+
}
19+
720
protected KerberosMessageView View { get; } = new KerberosMessageView();
821

922
public override void AddToTab(TabPage o)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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>{2B5D7B76-A951-4DF5-B0A6-2A110FF194D2}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>InstallHost</RootNamespace>
10+
<AssemblyName>InstallHost</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<PropertyGroup>
36+
<SignAssembly>false</SignAssembly>
37+
</PropertyGroup>
38+
<PropertyGroup>
39+
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
40+
</PropertyGroup>
41+
<ItemGroup>
42+
<Reference Include="System" />
43+
<Reference Include="System.Core" />
44+
<Reference Include="System.Xml.Linq" />
45+
<Reference Include="System.Data.DataSetExtensions" />
46+
<Reference Include="Microsoft.CSharp" />
47+
<Reference Include="System.Data" />
48+
<Reference Include="System.Net.Http" />
49+
<Reference Include="System.Xml" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<Compile Include="Program.cs" />
53+
<Compile Include="Properties\AssemblyInfo.cs" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<None Include="App.config" />
57+
<None Include="key.snk" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<PackageReference Include="squirrel.windows">
61+
<Version>1.9.1</Version>
62+
</PackageReference>
63+
</ItemGroup>
64+
<ItemGroup>
65+
<ProjectReference Include="..\KerberosInstaller\KerberosInstaller.csproj">
66+
<Project>{9686f73f-5526-4c9a-b603-c7acbfcb1976}</Project>
67+
<Name>KerberosInstaller</Name>
68+
</ProjectReference>
69+
</ItemGroup>
70+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
71+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Fiddler.Kerberos.NET
2+
{
3+
class Program
4+
{
5+
static void Main(string[] args)
6+
{
7+
InstallManager.Setup();
8+
}
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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("InstallHost")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("InstallHost")]
13+
[assembly: AssemblyCopyright("Copyright © 2020")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
18+
19+
// Setting ComVisible to false makes the types in this assembly not visible
20+
// to COM components. If you need to access a type in this assembly from
21+
// COM, set the ComVisible attribute to true on that type.
22+
[assembly: ComVisible(false)]
23+
24+
// The following GUID is for the ID of the typelib if this project is exposed to COM
25+
[assembly: Guid("2b5d7b76-a951-4df5-b0a6-2a110ff194d2")]
596 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using System;
2+
using System.IO;
3+
using System.Reflection;
4+
using System.Threading.Tasks;
5+
using Squirrel;
6+
7+
namespace Fiddler.Kerberos.NET
8+
{
9+
public static class InstallManager
10+
{
11+
public static void Setup()
12+
{
13+
SquirrelAwareApp.HandleEvents(
14+
onInitialInstall: v => CopyFiles(),
15+
onAppUpdate: v => CopyFiles(),
16+
onAppUninstall: v => DeleteFiles(),
17+
onFirstRun: () => { }
18+
);
19+
}
20+
21+
private static bool running;
22+
23+
public static void Watch()
24+
{
25+
if (running)
26+
{
27+
return;
28+
}
29+
30+
running = true;
31+
32+
Task.Run(Update);
33+
}
34+
35+
private static async Task Update()
36+
{
37+
try
38+
{
39+
using (var mgr = await UpdateManager.GitHubUpdateManager("https://github.com/dotnet/Kerberos.NET"))
40+
{
41+
await mgr.UpdateApp();
42+
}
43+
}
44+
catch
45+
{
46+
return;
47+
}
48+
}
49+
50+
private static void DeleteFiles()
51+
{
52+
var files = GetPluginFiles();
53+
54+
foreach (var file in files)
55+
{
56+
var name = Path.GetFileName(file);
57+
58+
var inspectorPath = GetInspectorPath(name);
59+
60+
try
61+
{
62+
if (File.Exists(inspectorPath))
63+
{
64+
File.Delete(inspectorPath);
65+
}
66+
}
67+
catch
68+
{
69+
;
70+
}
71+
}
72+
}
73+
74+
private static void CopyFiles()
75+
{
76+
string[] files = GetPluginFiles();
77+
78+
foreach (var file in files)
79+
{
80+
var name = Path.GetFileName(file);
81+
var targetPath = GetInspectorPath(name);
82+
83+
File.Copy(
84+
file,
85+
targetPath,
86+
overwrite: true
87+
);
88+
}
89+
}
90+
91+
private static string GetInspectorPath(string file)
92+
{
93+
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + $"\\fiddler2\\inspectors\\{file}";
94+
}
95+
96+
private static string[] GetPluginFiles()
97+
{
98+
var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
99+
100+
return Directory.GetFiles(directory, "*.dll");
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)