first commit
This commit is contained in:
233
FiddlerDecryption/Controls/RequestDecodeControl.Designer.cs
generated
Normal file
233
FiddlerDecryption/Controls/RequestDecodeControl.Designer.cs
generated
Normal file
@@ -0,0 +1,233 @@
|
||||
namespace FiddlerDecryption.Controls
|
||||
{
|
||||
partial class RequestDecodeControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.txtSupposedClass = new System.Windows.Forms.TextBox();
|
||||
this.txtAuth = new System.Windows.Forms.TextBox();
|
||||
this.txtProtoName = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtProtoId = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.tecJson = new ICSharpCode.TextEditor.TextEditorControlEx();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(552, 434);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.txtSupposedClass);
|
||||
this.tabPage1.Controls.Add(this.txtAuth);
|
||||
this.tabPage1.Controls.Add(this.txtProtoName);
|
||||
this.tabPage1.Controls.Add(this.label4);
|
||||
this.tabPage1.Controls.Add(this.txtProtoId);
|
||||
this.tabPage1.Controls.Add(this.label2);
|
||||
this.tabPage1.Controls.Add(this.label3);
|
||||
this.tabPage1.Controls.Add(this.label1);
|
||||
this.tabPage1.Controls.Add(this.tecJson);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(544, 408);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "基本解析";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// txtSupposedClass
|
||||
//
|
||||
this.txtSupposedClass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtSupposedClass.Location = new System.Drawing.Point(107, 32);
|
||||
this.txtSupposedClass.Name = "txtSupposedClass";
|
||||
this.txtSupposedClass.ReadOnly = true;
|
||||
this.txtSupposedClass.Size = new System.Drawing.Size(431, 21);
|
||||
this.txtSupposedClass.TabIndex = 3;
|
||||
//
|
||||
// txtAuth
|
||||
//
|
||||
this.txtAuth.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtAuth.Location = new System.Drawing.Point(107, 56);
|
||||
this.txtAuth.Name = "txtAuth";
|
||||
this.txtAuth.ReadOnly = true;
|
||||
this.txtAuth.Size = new System.Drawing.Size(431, 21);
|
||||
this.txtAuth.TabIndex = 4;
|
||||
//
|
||||
// txtProtoName
|
||||
//
|
||||
this.txtProtoName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtProtoName.Location = new System.Drawing.Point(279, 8);
|
||||
this.txtProtoName.Name = "txtProtoName";
|
||||
this.txtProtoName.ReadOnly = true;
|
||||
this.txtProtoName.Size = new System.Drawing.Size(259, 21);
|
||||
this.txtProtoName.TabIndex = 2;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(7, 36);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(89, 12);
|
||||
this.label4.TabIndex = 6;
|
||||
this.label4.Text = "Supposed Class";
|
||||
//
|
||||
// txtProtoId
|
||||
//
|
||||
this.txtProtoId.Location = new System.Drawing.Point(107, 8);
|
||||
this.txtProtoId.Name = "txtProtoId";
|
||||
this.txtProtoId.ReadOnly = true;
|
||||
this.txtProtoId.Size = new System.Drawing.Size(77, 21);
|
||||
this.txtProtoId.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 60);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(83, 12);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "Authorization";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(190, 11);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(83, 12);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Protocol Name";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(71, 12);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "Protocol ID";
|
||||
//
|
||||
// tecJson
|
||||
//
|
||||
this.tecJson.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tecJson.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.tecJson.FoldingStrategy = "JSON";
|
||||
this.tecJson.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.tecJson.IsReadOnly = true;
|
||||
this.tecJson.Location = new System.Drawing.Point(6, 81);
|
||||
this.tecJson.Name = "tecJson";
|
||||
this.tecJson.Size = new System.Drawing.Size(532, 321);
|
||||
this.tecJson.SyntaxHighlighting = "JSON";
|
||||
this.tecJson.TabIndex = 5;
|
||||
this.tecJson.TextChanged += new System.EventHandler(this.tecJson_TextChanged);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.label5);
|
||||
this.tabPage2.Controls.Add(this.textBox1);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(544, 408);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "设置";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox1.Location = new System.Drawing.Point(89, 15);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(449, 21);
|
||||
this.textBox1.TabIndex = 0;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(6, 18);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(77, 12);
|
||||
this.label5.TabIndex = 1;
|
||||
this.label5.Text = "API Host地址";
|
||||
//
|
||||
// RequestDecodeControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Name = "RequestDecodeControl";
|
||||
this.Size = new System.Drawing.Size(552, 434);
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage1.PerformLayout();
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TextBox txtSupposedClass;
|
||||
private System.Windows.Forms.TextBox txtAuth;
|
||||
private System.Windows.Forms.TextBox txtProtoName;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox txtProtoId;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private ICSharpCode.TextEditor.TextEditorControlEx tecJson;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
}
|
||||
}
|
||||
68
FiddlerDecryption/Controls/RequestDecodeControl.cs
Normal file
68
FiddlerDecryption/Controls/RequestDecodeControl.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FiddlerDecryption.Controls
|
||||
{
|
||||
public partial class RequestDecodeControl : UserControl
|
||||
{
|
||||
|
||||
public RequestDecodeControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void tecJson_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateAndCheckFoldings();
|
||||
}
|
||||
|
||||
private void UpdateAndCheckFoldings()
|
||||
{
|
||||
tecJson.Document.FoldingManager.UpdateFoldings(null, null);
|
||||
}
|
||||
|
||||
public void SetData(JObject jo, string auth)
|
||||
{
|
||||
txtAuth.Text = auth;
|
||||
if (jo == null)
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
txtProtoId.Text = jo["protocolId"]?.Value<string>().ToString();
|
||||
txtSupposedClass.Text = jo["supposedClassName"]?.Value<string>().ToString();
|
||||
|
||||
|
||||
|
||||
if (!jo["ok"].Value<bool>())
|
||||
{
|
||||
tecJson.Text = string.Empty;
|
||||
tecJson.Text = jo["message"].Value<string>().ToString();
|
||||
UpdateAndCheckFoldings();
|
||||
}
|
||||
else
|
||||
{
|
||||
tecJson.Text = string.Empty;
|
||||
tecJson.Text = jo.ToString(Newtonsoft.Json.Formatting.Indented);
|
||||
UpdateAndCheckFoldings();
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
tecJson.Text = string.Empty;
|
||||
txtAuth.Clear();
|
||||
txtProtoId.Clear();
|
||||
txtProtoName.Clear();
|
||||
txtSupposedClass.Clear();
|
||||
}
|
||||
|
||||
public void AddToTab(TabPage o)
|
||||
{
|
||||
o.Text = "EProtobuf";
|
||||
o.Controls.Add(this);
|
||||
o.Controls[0].Dock = DockStyle.Fill;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
FiddlerDecryption/Controls/RequestDecodeControl.resx
Normal file
120
FiddlerDecryption/Controls/RequestDecodeControl.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
149
FiddlerDecryption/FiddlerDecryption.csproj
Normal file
149
FiddlerDecryption/FiddlerDecryption.csproj
Normal file
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Costura.Fody.6.0.0-beta0000\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.6.0.0-beta0000\build\Costura.Fody.props')" />
|
||||
<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>{1210036A-18F1-4786-BC4F-C3B2AECDE45B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FiddlerDecryption</RootNamespace>
|
||||
<AssemblyName>FiddlerDecryption</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<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' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Costura, Version=6.0.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.6.0.0-beta0000\lib\netstandard2.0\Costura.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Fiddler">
|
||||
<HintPath>D:\Program Files\Fiddler\Fiddler.exe</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Flurl, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Flurl.4.0.0\lib\net461\Flurl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Flurl.Http, Version=4.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Flurl.Http.4.0.2\lib\net461\Flurl.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Standard">
|
||||
<HintPath>D:\Program Files\Fiddler\Inspectors\Standard.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.6.0.0\lib\net461\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=6.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.6.0.4\lib\net461\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<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" />
|
||||
<Reference Include="Tomlyn, Version=0.17.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Tomlyn.0.17.0\lib\netstandard2.0\Tomlyn.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controls\RequestDecodeControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\RequestDecodeControl.Designer.cs">
|
||||
<DependentUpon>RequestDecodeControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils\DecodeUtil.cs" />
|
||||
<Compile Include="ResponseDecode.cs" />
|
||||
<Compile Include="RequestDecode.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils\Setting.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Controls\RequestDecodeControl.resx">
|
||||
<DependentUpon>RequestDecodeControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditorEx.csproj">
|
||||
<Project>{2d18be89-d210-49eb-a9dd-2246fbb3df6d}</Project>
|
||||
<Name>ICSharpCode.TextEditorEx</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy "$(TargetPath)" "D:\Program Files\Fiddler\Inspectors\$(TargetFilename)"
|
||||
"$(ProjectDir)move-package.bat" "D:\Program Files\Fiddler\"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\packages\System.Text.Json.6.0.4\build\System.Text.Json.targets" Condition="Exists('..\packages\System.Text.Json.6.0.4\build\System.Text.Json.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\System.Text.Json.6.0.4\build\System.Text.Json.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Text.Json.6.0.4\build\System.Text.Json.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.6.8.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.8.2\build\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.6.0.0-beta0000\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.6.0.0-beta0000\build\Costura.Fody.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.6.0.0-beta0000\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.6.0.0-beta0000\build\Costura.Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Fody.6.8.2\build\Fody.targets" Condition="Exists('..\packages\Fody.6.8.2\build\Fody.targets')" />
|
||||
<Import Project="..\packages\Costura.Fody.6.0.0-beta0000\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.6.0.0-beta0000\build\Costura.Fody.targets')" />
|
||||
</Project>
|
||||
3
FiddlerDecryption/FodyWeavers.xml
Normal file
3
FiddlerDecryption/FodyWeavers.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Costura />
|
||||
</Weavers>
|
||||
37
FiddlerDecryption/Properties/AssemblyInfo.cs
Normal file
37
FiddlerDecryption/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("FiddlerDecryption")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("FiddlerDecryption")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("1210036a-18f1-4786-bc4f-c3b2aecde45b")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: Fiddler.RequiredVersion("4.6.20171.9220")]
|
||||
17
FiddlerDecryption/README.md
Normal file
17
FiddlerDecryption/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# FiddlerDecryption
|
||||
|
||||
功能:实时解密接口数据并格式化展示。
|
||||
|
||||

|
||||
|
||||
代码内容:
|
||||
|
||||
* DecryptionUtil.cs:解密方法
|
||||
* RequestDecryption.cs:请求数据的解密插件
|
||||
* RequestDecryptionFormat.cs:请求数据的解密&格式化插件
|
||||
* ResponseDecryption.cs:返回数据的解密插件
|
||||
* ResponseDecryptionFormat.cs:返回数据的解密&格式化插件
|
||||
|
||||
如需应用到自己的项目,修改 DecryptionUtil 中的解密算法即可。
|
||||
|
||||
更多介绍请见[Fiddler 插件开发:数据解密](https://blog.csdn.net/Gdeer/article/details/102756017)。
|
||||
105
FiddlerDecryption/RequestDecode.cs
Normal file
105
FiddlerDecryption/RequestDecode.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using Fiddler;
|
||||
using System.Windows.Forms;
|
||||
using Util;
|
||||
using FiddlerDecryption.Controls;
|
||||
|
||||
namespace Request
|
||||
{
|
||||
/// <summary>
|
||||
/// 益盟请求解码为格式化 JSON 字符串
|
||||
/// </summary>
|
||||
public sealed class RequestDecode : Inspector2, IRequestInspector2
|
||||
{
|
||||
private bool mBDirty;
|
||||
private bool mBReadOnly;
|
||||
private byte[] mBody;
|
||||
private HTTPRequestHeaders mRequestHeaders;
|
||||
private RequestDecodeControl requestDecodeControl;
|
||||
|
||||
public RequestDecode()
|
||||
{
|
||||
requestDecodeControl = new RequestDecodeControl();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实现 <see cref="Fiddler.IBaseInspector2.bDirty"/> 字段
|
||||
/// </summary>
|
||||
public bool bDirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBDirty;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 实现 <see cref="Fiddler.IBaseInspector2.body"/> 字段
|
||||
/// </summary>
|
||||
public byte[] body
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBody;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
mBody = value;
|
||||
requestDecodeControl.SetData(
|
||||
DecodeUtil.DoDecryptionNew(headers, mBody).Result,
|
||||
DecodeUtil.NeedToDecrypt(headers) && headers.Exists("Authorization") ?
|
||||
headers["Authorization"] : string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实现 <see cref="Fiddler.IBaseInspector2.bReadOnly"/> 字段
|
||||
/// </summary>
|
||||
public bool bReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBReadOnly;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
mBReadOnly = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实现 <see cref="Fiddler.IRequestInspector2.headers"/> 字段
|
||||
/// </summary>
|
||||
public HTTPRequestHeaders headers
|
||||
{
|
||||
get
|
||||
{
|
||||
return mRequestHeaders;
|
||||
}
|
||||
set
|
||||
{
|
||||
mRequestHeaders = value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实现 <see cref="Fiddler.Inspector2.AddToTab"/> 方法
|
||||
/// </summary>
|
||||
public override void AddToTab(TabPage o)
|
||||
{
|
||||
requestDecodeControl.AddToTab(o);
|
||||
o.Text = "EProtobuf";
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
mBody = null;
|
||||
requestDecodeControl.Clear();
|
||||
}
|
||||
|
||||
// 在 Tab 上的摆放位置
|
||||
public override int GetOrder() => 200;
|
||||
}
|
||||
}
|
||||
93
FiddlerDecryption/ResponseDecode.cs
Normal file
93
FiddlerDecryption/ResponseDecode.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using Fiddler;
|
||||
using System;
|
||||
using Standard;
|
||||
using System.Windows.Forms;
|
||||
using Util;
|
||||
|
||||
namespace Response
|
||||
{
|
||||
public sealed class ResponseDecode : Inspector2, IResponseInspector2, IBaseInspector2
|
||||
{
|
||||
private bool mBDirty;
|
||||
private bool mBReadOnly;
|
||||
private byte[] mBody;
|
||||
private HTTPResponseHeaders mResponseHeaders;
|
||||
private ResponseTextViewer mResponseTextViewer;
|
||||
|
||||
public ResponseDecode()
|
||||
{
|
||||
mResponseTextViewer = new ResponseTextViewer();
|
||||
}
|
||||
|
||||
public bool bDirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBDirty;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] body
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBody;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
mBody = value;
|
||||
byte[] decodedBody = DecodeUtil.DoDecryption(headers, mBody).Result;
|
||||
if (decodedBody != null)
|
||||
{
|
||||
mResponseTextViewer.body = decodedBody;
|
||||
}
|
||||
else
|
||||
{
|
||||
Clear();
|
||||
mResponseTextViewer.body = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool bReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBReadOnly;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
mBReadOnly = value;
|
||||
}
|
||||
}
|
||||
|
||||
public HTTPResponseHeaders headers
|
||||
{
|
||||
get
|
||||
{
|
||||
return mResponseHeaders;
|
||||
}
|
||||
set
|
||||
{
|
||||
mResponseHeaders = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddToTab(TabPage o)
|
||||
{
|
||||
mResponseTextViewer.AddToTab(o);
|
||||
o.Text = "EProtobuf";
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
mBody = null;
|
||||
mResponseTextViewer.Clear();
|
||||
}
|
||||
|
||||
// 在 Tab 上的摆放位置
|
||||
public override int GetOrder() => 200;
|
||||
}
|
||||
}
|
||||
212
FiddlerDecryption/Utils/DecodeUtil.cs
Normal file
212
FiddlerDecryption/Utils/DecodeUtil.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using Fiddler;
|
||||
using FiddlerDecryption.Utils;
|
||||
using Flurl.Http;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Util
|
||||
{
|
||||
class DecodeUtil
|
||||
{
|
||||
|
||||
static Uri GetAPIUri(string path)
|
||||
{
|
||||
Setting setting = Setting.Instance;
|
||||
Uri uri = new Uri(setting.ApiHost);
|
||||
string scheme = uri.Scheme.ToLower();
|
||||
if (scheme != "http" && scheme != "https")
|
||||
{
|
||||
setting.ApiHost = Setting.DEFAULT_API_HOST;
|
||||
uri = new Uri(setting.ApiHost);
|
||||
}
|
||||
UriBuilder builder = new UriBuilder(uri);
|
||||
builder.Path += path;
|
||||
return builder.Uri;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除返回 JObject 中 cachedSize 和 serializedSize 字段
|
||||
/// </summary>
|
||||
/// <param name="j"></param>
|
||||
/// <returns></returns>
|
||||
public static JToken ClearSizeInfo(JToken j)
|
||||
{
|
||||
if (j == null) return null;
|
||||
if (j is JArray ja) {
|
||||
for (int i = 0; i < ja.Count; i++)
|
||||
{
|
||||
ja[i] = ClearSizeInfo(ja[i]);
|
||||
}
|
||||
return ja;
|
||||
}
|
||||
if (j is JObject jo)
|
||||
{
|
||||
jo.Remove("cachedSize");
|
||||
jo.Remove("serializedSize");
|
||||
foreach (var p in jo)
|
||||
{
|
||||
string key = p.Key;
|
||||
JToken val = p.Value;
|
||||
jo[key] = ClearSizeInfo(val);
|
||||
}
|
||||
return jo;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
public static async Task<JObject> DoDecryptionNew(HTTPRequestHeaders headers, byte[] mBody)
|
||||
{
|
||||
if (NeedToDecrypt(headers))
|
||||
{
|
||||
var url = "http://localhost:7790/api/v1/proto/request/decode";
|
||||
try
|
||||
{
|
||||
string r = await url.PostJsonAsync(new
|
||||
{
|
||||
protocolId = Convert.ToInt32(headers["X-Protocol-Id"]),
|
||||
protocolBody = Convert.ToBase64String(mBody)
|
||||
}).Result.GetStringAsync();
|
||||
if (r != null)
|
||||
{
|
||||
JObject jo = JObject.Parse(r);
|
||||
return ClearSizeInfo(jo) as JObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new JObject()
|
||||
{
|
||||
new JProperty("ok", false),
|
||||
new JProperty("resultCode", 502),
|
||||
new JProperty("message", ex.InnerException?.Message ?? ex.Message)
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static async Task<byte[]> DoDecryption(HTTPRequestHeaders headers, byte[] mBody)
|
||||
{
|
||||
// 判断是否是对应内容
|
||||
string showBody = "";
|
||||
if (NeedToDecrypt(headers))
|
||||
{
|
||||
var url = "http://localhost:7790/api/v1/proto/request/decode";
|
||||
try
|
||||
{
|
||||
string r = await url.PostJsonAsync(new
|
||||
{
|
||||
protocolId = Convert.ToInt32(headers["X-Protocol-Id"]),
|
||||
protocolBody = Convert.ToBase64String(mBody)
|
||||
}).Result.GetStringAsync();
|
||||
if (r != null)
|
||||
{
|
||||
JObject jo = JObject.Parse(r);
|
||||
if (jo["ok"].Value<bool>())
|
||||
{
|
||||
JObject result = jo["data"].Value<JObject>();
|
||||
result = ClearSizeInfo(result) as JObject;
|
||||
jo["data"] = result;
|
||||
}
|
||||
showBody = jo.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
showBody = ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
return Encoding.UTF8.GetBytes(showBody);
|
||||
}
|
||||
|
||||
public static async Task<byte[]> DoDecryption(HTTPResponseHeaders headers, byte[] mBody)
|
||||
{
|
||||
// 判断是否是对应内容
|
||||
string showBody = "";
|
||||
if (NeedToDecrypt(headers))
|
||||
{
|
||||
var url = "http://localhost:7790/api/v1/proto/response/decode";
|
||||
try
|
||||
{
|
||||
int? protocolId = headers["X-Protocol-Id"] == null ? (int?)null : Convert.ToInt32(headers["X-Protocol-Id"]);
|
||||
string r = await url.PostJsonAsync(new
|
||||
{
|
||||
protocolId,
|
||||
protocolBody = Convert.ToBase64String(mBody)
|
||||
}).Result.GetStringAsync();
|
||||
if (r != null)
|
||||
{
|
||||
JObject jo = JObject.Parse(r);
|
||||
if (jo["ok"].Value<bool>())
|
||||
{
|
||||
JObject result = jo["data"].Value<JObject>();
|
||||
result = ClearSizeInfo(result) as JObject;
|
||||
jo["data"] = result;
|
||||
}
|
||||
showBody = jo.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
showBody = ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
return Encoding.UTF8.GetBytes(showBody);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求是否需要做益盟解密
|
||||
/// </summary>
|
||||
/// <param name="headers">请求的 Headers</param>
|
||||
/// <returns></returns>
|
||||
public static bool NeedToDecrypt(HTTPRequestHeaders headers)
|
||||
{
|
||||
if (headers.Exists("Host") && headers.Exists("Content-Type") && headers.Exists("X-Protocol-Id"))
|
||||
{
|
||||
var host = headers["Host"];
|
||||
var contentType = headers["Content-Type"];
|
||||
var protocolId = headers["X-Protocol-Id"];
|
||||
|
||||
return Regex.IsMatch(protocolId, "^\\d+$")
|
||||
&& host.ToLower().EndsWith(".emoney.cn")
|
||||
&& contentType.ToLower().Contains("application/x-protobuf-v3");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 响应是否需要做益盟解密
|
||||
/// </summary>
|
||||
/// <param name="headers">返回的 Headers</param>
|
||||
/// <returns></returns>
|
||||
public static bool NeedToDecrypt(HTTPResponseHeaders headers)
|
||||
{
|
||||
if (headers.Exists("Content-Type") && headers.Exists("X-Protocol-Id"))
|
||||
{
|
||||
var contentType = headers["Content-Type"];
|
||||
var protocolId = headers["X-Protocol-Id"];
|
||||
|
||||
return Regex.IsMatch(protocolId, "^\\d+$")
|
||||
&& contentType.ToLower().Contains("application/x-protobuf-v3");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
FiddlerDecryption/Utils/Setting.cs
Normal file
39
FiddlerDecryption/Utils/Setting.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tomlyn;
|
||||
|
||||
namespace FiddlerDecryption.Utils
|
||||
{
|
||||
internal class Setting
|
||||
{
|
||||
public static string DEFAULT_API_HOST = "http://localhost:7788";
|
||||
public string ApiHost { get; set; } = DEFAULT_API_HOST;
|
||||
public static Setting Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
Setting setting;
|
||||
try
|
||||
{
|
||||
setting = Toml.ToModel<Setting>(File.ReadAllText("emoney.toml"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
setting = new Setting();
|
||||
setting.Save();
|
||||
}
|
||||
return setting;
|
||||
}
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
string toml = Toml.FromModel(this);
|
||||
File.WriteAllText("emoney.toml", toml);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
FiddlerDecryption/app.config
Normal file
15
FiddlerDecryption/app.config
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup></configuration>
|
||||
22
FiddlerDecryption/move-package.bat
Normal file
22
FiddlerDecryption/move-package.bat
Normal file
@@ -0,0 +1,22 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem 检查是否提供了目标路径参数
|
||||
if "%~1"=="" (
|
||||
echo Usage: %0 targetPath
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
rem 设置目标路径
|
||||
set "targetPath=%~1"
|
||||
|
||||
rem 查找并复制 DLL 文件
|
||||
for /r ..\packages\ %%D in (.) do (
|
||||
if exist "%%D\net461\*.dll" (
|
||||
echo Copying DLLs from %%D\net461 to %targetPath%
|
||||
xcopy "%%D\net461\*.dll" "%targetPath%" /Y /I
|
||||
)
|
||||
)
|
||||
|
||||
echo Done.
|
||||
endlocal
|
||||
18
FiddlerDecryption/packages.config
Normal file
18
FiddlerDecryption/packages.config
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Costura.Fody" version="6.0.0-beta0000" targetFramework="net462" developmentDependency="true" />
|
||||
<package id="Flurl" version="4.0.0" targetFramework="net462" />
|
||||
<package id="Flurl.Http" version="4.0.2" targetFramework="net462" />
|
||||
<package id="Fody" version="6.8.2" targetFramework="net462" developmentDependency="true" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Encodings.Web" version="6.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Json" version="6.0.4" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
<package id="Tomlyn" version="0.17.0" targetFramework="net462" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user