first commit
This commit is contained in:
237
EmoneyInteceptor/Emoney/Controls/EmoneyTabControl.Designer.cs
generated
Normal file
237
EmoneyInteceptor/Emoney/Controls/EmoneyTabControl.Designer.cs
generated
Normal file
@@ -0,0 +1,237 @@
|
||||
namespace EmoneyInteceptor.Emoney.Controls
|
||||
{
|
||||
partial class EmoneyTabControl
|
||||
{
|
||||
/// <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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.txtRequestJson = new System.Windows.Forms.TextBox();
|
||||
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnEncode = new System.Windows.Forms.Button();
|
||||
this.btnDecode = new System.Windows.Forms.Button();
|
||||
this.txtProtobufBody = new System.Windows.Forms.TextBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtProtocolID = new System.Windows.Forms.TextBox();
|
||||
this.btnRrquestEncode = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtAuth = new System.Windows.Forms.TextBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.flowLayoutPanel2.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.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.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.groupBox2, 0, 2);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 69);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 3;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 75.54112F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 24.45888F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(569, 415);
|
||||
this.tableLayoutPanel1.TabIndex = 1;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.txtRequestJson);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(563, 281);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "JSON";
|
||||
//
|
||||
// txtRequestJson
|
||||
//
|
||||
this.txtRequestJson.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtRequestJson.Location = new System.Drawing.Point(3, 19);
|
||||
this.txtRequestJson.MaxLength = 2147483647;
|
||||
this.txtRequestJson.Multiline = true;
|
||||
this.txtRequestJson.Name = "txtRequestJson";
|
||||
this.txtRequestJson.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.txtRequestJson.Size = new System.Drawing.Size(557, 259);
|
||||
this.txtRequestJson.TabIndex = 0;
|
||||
//
|
||||
// flowLayoutPanel2
|
||||
//
|
||||
this.flowLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
|
||||
this.flowLayoutPanel2.Controls.Add(this.btnEncode);
|
||||
this.flowLayoutPanel2.Controls.Add(this.btnDecode);
|
||||
this.flowLayoutPanel2.Location = new System.Drawing.Point(203, 290);
|
||||
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||
this.flowLayoutPanel2.Size = new System.Drawing.Size(162, 29);
|
||||
this.flowLayoutPanel2.TabIndex = 3;
|
||||
//
|
||||
// btnEncode
|
||||
//
|
||||
this.btnEncode.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnEncode.Name = "btnEncode";
|
||||
this.btnEncode.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnEncode.TabIndex = 0;
|
||||
this.btnEncode.Text = "编码↓";
|
||||
this.btnEncode.UseVisualStyleBackColor = true;
|
||||
this.btnEncode.Click += new System.EventHandler(this.btnEncode_Click);
|
||||
//
|
||||
// btnDecode
|
||||
//
|
||||
this.btnDecode.Location = new System.Drawing.Point(84, 3);
|
||||
this.btnDecode.Name = "btnDecode";
|
||||
this.btnDecode.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnDecode.TabIndex = 1;
|
||||
this.btnDecode.Text = "解码↑";
|
||||
this.btnDecode.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// txtProtobufBody
|
||||
//
|
||||
this.txtProtobufBody.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtProtobufBody.Location = new System.Drawing.Point(3, 19);
|
||||
this.txtProtobufBody.MaxLength = 2147483647;
|
||||
this.txtProtobufBody.Multiline = true;
|
||||
this.txtProtobufBody.Name = "txtProtobufBody";
|
||||
this.txtProtobufBody.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.txtProtobufBody.Size = new System.Drawing.Size(557, 65);
|
||||
this.txtProtobufBody.TabIndex = 0;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.txtProtobufBody);
|
||||
this.groupBox2.Location = new System.Drawing.Point(3, 325);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(563, 87);
|
||||
this.groupBox2.TabIndex = 2;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Protobuf(Base64)";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 10);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(74, 17);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Protocol ID";
|
||||
//
|
||||
// txtProtocolID
|
||||
//
|
||||
this.txtProtocolID.Location = new System.Drawing.Point(93, 7);
|
||||
this.txtProtocolID.Name = "txtProtocolID";
|
||||
this.txtProtocolID.Size = new System.Drawing.Size(100, 23);
|
||||
this.txtProtocolID.TabIndex = 1;
|
||||
//
|
||||
// btnRrquestEncode
|
||||
//
|
||||
this.btnRrquestEncode.Location = new System.Drawing.Point(199, 7);
|
||||
this.btnRrquestEncode.Name = "btnRrquestEncode";
|
||||
this.btnRrquestEncode.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnRrquestEncode.TabIndex = 2;
|
||||
this.btnRrquestEncode.Text = "请求";
|
||||
this.btnRrquestEncode.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(3, 39);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(85, 17);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Authorization";
|
||||
//
|
||||
// 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(93, 36);
|
||||
this.txtAuth.Name = "txtAuth";
|
||||
this.txtAuth.Size = new System.Drawing.Size(471, 23);
|
||||
this.txtAuth.TabIndex = 1;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.btnRrquestEncode);
|
||||
this.panel1.Controls.Add(this.tableLayoutPanel1);
|
||||
this.panel1.Controls.Add(this.txtAuth);
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.txtProtocolID);
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(578, 484);
|
||||
this.panel1.TabIndex = 2;
|
||||
//
|
||||
// EmoneyTabControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "EmoneyTabControl";
|
||||
this.Size = new System.Drawing.Size(578, 484);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.flowLayoutPanel2.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TextBox txtRequestJson;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||
private System.Windows.Forms.Button btnEncode;
|
||||
private System.Windows.Forms.Button btnDecode;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.TextBox txtProtobufBody;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtProtocolID;
|
||||
private System.Windows.Forms.Button btnRrquestEncode;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox txtAuth;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
}
|
||||
}
|
||||
343
EmoneyInteceptor/Emoney/Controls/EmoneyTabControl.cs
Normal file
343
EmoneyInteceptor/Emoney/Controls/EmoneyTabControl.cs
Normal file
@@ -0,0 +1,343 @@
|
||||
using Fiddler;
|
||||
using Flurl.Http;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EmoneyInteceptor.Emoney.Controls
|
||||
{
|
||||
public partial class EmoneyTabControl : UserControl
|
||||
{
|
||||
public EmoneyTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void OnWebSocketMessage(object sender, WebSocketMessageEventArgs args)
|
||||
{
|
||||
if (sender is Session session)
|
||||
{
|
||||
FiddlerApplication.Log.LogString($"Host name:{session.hostname}, host:{session.host}");
|
||||
}
|
||||
}
|
||||
|
||||
public void BeforeRequest(Session oSession)
|
||||
{
|
||||
// host 带端口,hostname 不带
|
||||
if (oSession == null) return;
|
||||
if (!oSession.hostname.ToLower().EndsWith("emoney.cn")) return;
|
||||
//FiddlerApplication.Log.LogString($"Host name:{oSession.hostname}, host:{oSession.host}, url: {oSession.url}");
|
||||
if (oSession.host.ToLower().Contains("mstat.emoney.cn"))
|
||||
{
|
||||
FiddlerApplication.Log.LogString($"mstat request uri: {oSession.url}");
|
||||
if (oSession.uriContains("/UserAnalysis/upload"))
|
||||
{
|
||||
// 清除信息,不追踪
|
||||
JObject jo = JObject.Parse(oSession.GetRequestBodyAsString());
|
||||
jo["events"] = new JArray();
|
||||
jo["pages"] = new JArray();
|
||||
FiddlerApplication.Log.LogString("Clean UserAnalysis from Emony");
|
||||
oSession.RequestBody = Encoding.UTF8.GetBytes(jo.ToString(Newtonsoft.Json.Formatting.None));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BeforeResponse(Session oSession)
|
||||
{
|
||||
int pid = 888020000;
|
||||
if (oSession == null) return;
|
||||
if (!oSession.hostname.ToLower().EndsWith("emoney.cn")
|
||||
&& !oSession.hostname.ToLower().EndsWith("aliyuncs.com")) return;
|
||||
|
||||
if (oSession.RequestHeaders.Exists("Authorization"))
|
||||
{
|
||||
if (txtAuth.Text != oSession.RequestHeaders["Authorization"])
|
||||
txtAuth.Text = oSession.RequestHeaders["Authorization"];
|
||||
}
|
||||
|
||||
if (oSession.uriContains("/user/auth/login"))
|
||||
{
|
||||
return;
|
||||
// 用户信息 inject
|
||||
if (!oSession.ResponseHeaders.ExistsAndContains("Content-Type", "application/json")) return;
|
||||
|
||||
Debug.Write(oSession.GetResponseBodyAsString());
|
||||
|
||||
JObject jo = JObject.Parse(oSession.GetResponseBodyAsString());
|
||||
jo["detail"]["pc"]["isMaster"] = true;
|
||||
jo["detail"]["pc"]["isZy"] = true;
|
||||
jo["detail"]["pc"]["pid"] = pid;
|
||||
oSession.ResponseBody = Encoding.UTF8.GetBytes(jo.ToString(Newtonsoft.Json.Formatting.None));
|
||||
}
|
||||
if (oSession.uriContains("/user/info"))
|
||||
{
|
||||
// 用户信息 inject
|
||||
if (!oSession.ResponseHeaders.ExistsAndContains("Content-Type", "application/json")) return;
|
||||
|
||||
Debug.Write(oSession.GetResponseBodyAsString());
|
||||
|
||||
JObject jo = JObject.Parse(oSession.GetResponseBodyAsString());
|
||||
jo["detail"]["pc"]["isMaster"] = true;
|
||||
jo["detail"]["pc"]["isZy"] = true;
|
||||
jo["detail"]["pc"]["pid"] = pid;
|
||||
jo["detail"]["login"]["loginType"] = 1;
|
||||
jo["detail"]["isShareSucc"] = true;
|
||||
jo["detail"]["enableLiveShare"] = true;
|
||||
oSession.ResponseBody = Encoding.UTF8.GetBytes(jo.ToString(Newtonsoft.Json.Formatting.None));
|
||||
}
|
||||
if (oSession.uriContains("/kankan/kankan/LoginKanKan"))
|
||||
{
|
||||
// 用户信息 inject
|
||||
if (!oSession.ResponseHeaders.ExistsAndContains("Content-Type", "application/json")) return;
|
||||
|
||||
Debug.Write(oSession.GetResponseBodyAsString());
|
||||
|
||||
JObject jo = JObject.Parse(oSession.GetResponseBodyAsString());
|
||||
jo["detail"]["pid"] = pid;
|
||||
oSession.ResponseBody = Encoding.UTF8.GetBytes(jo.ToString(Newtonsoft.Json.Formatting.None));
|
||||
}
|
||||
if (oSession.uriContains("/Config/UserExtendInfo/Index"))
|
||||
{
|
||||
return;
|
||||
// 额外信息 inject
|
||||
if (!oSession.ResponseHeaders.ExistsAndContains("Content-Type", "application/json")) return;
|
||||
Debug.Write(oSession.GetResponseBodyAsString());
|
||||
|
||||
JObject jo = JObject.Parse(oSession.GetResponseBodyAsString());
|
||||
jo["detail"]["product"]["id"] = pid;
|
||||
oSession.ResponseBody = Encoding.UTF8.GetBytes(jo.ToString(Newtonsoft.Json.Formatting.None));
|
||||
}
|
||||
if (oSession.uriContains("/user/authority/isshareenable"))
|
||||
{
|
||||
return;
|
||||
if (!oSession.ResponseHeaders.ExistsAndContains("Content-Type", "application/json")) return;
|
||||
Debug.Write(oSession.GetResponseBodyAsString());
|
||||
|
||||
JObject jo = JObject.Parse(oSession.GetResponseBodyAsString());
|
||||
jo["detail"] = true;
|
||||
oSession.ResponseBody = Encoding.UTF8.GetBytes(jo.ToString(Newtonsoft.Json.Formatting.None));
|
||||
}
|
||||
if (oSession.uriContains("v1000003/config_ind_online.json") && oSession.HTTPMethodIs("GET"))
|
||||
{
|
||||
if (File.Exists("config_ind_online.json"))
|
||||
{
|
||||
string configFile = File.ReadAllText("config_ind_online.json");
|
||||
oSession.ResponseBody = Encoding.UTF8.GetBytes(configFile);
|
||||
}
|
||||
}
|
||||
if (oSession.uriContains("/Strategy/PickStock/Filter"))
|
||||
{
|
||||
// 选股过滤器默认规则拦截,将 isLocked 由 true 改为 false
|
||||
if (!oSession.ResponseHeaders.ExistsAndContains("Content-Type", "application/json")) return;
|
||||
Debug.WriteLine(oSession.GetResponseBodyAsString());
|
||||
|
||||
JObject jo = JObject.Parse(oSession.GetResponseBodyAsString());
|
||||
|
||||
// 三个层级
|
||||
// 顶层 detail.isLocked
|
||||
// 子层 detail.subFilters[].isLocked
|
||||
// 孙层 detail.subFilters[].....fields[].isLocked
|
||||
// 如果 subFilters 还有 subFilters 就继续遍历
|
||||
void UnlockFilter(JToken subFilter)
|
||||
{
|
||||
if (subFilter == null) return;
|
||||
|
||||
// 当前层级有 isLocked 则清除
|
||||
// 适用于顶级 detail、每层 subFilter、孙子节点 field
|
||||
subFilter.SelectToken("isLocked")?.Replace(false);
|
||||
|
||||
var subFilters = subFilter.SelectToken("subFilters");
|
||||
if (subFilters != null)
|
||||
{
|
||||
// 当前层 subFilters 不为 null,则对其中每个 subFilter 都处理
|
||||
foreach(var _subFilter in subFilters)
|
||||
{
|
||||
UnlockFilter(_subFilter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 当前层已不含 subFilters,则应该存在 fields
|
||||
var fields = subFilter?.SelectToken("fields");
|
||||
if (fields != null)
|
||||
{
|
||||
foreach (var field in fields)
|
||||
{
|
||||
field?.SelectToken("isLocked")?.Replace(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
string[] strategyCodes = {
|
||||
"strategy_intersection_more", // 策略叠加内的策略叠加
|
||||
"super_selection_cldj" // 超级选股内的策略叠加
|
||||
};
|
||||
void AddStrategyIntersection(JToken subFilter)
|
||||
{
|
||||
if (subFilter == null) return; // 当前 token 是空直接返回
|
||||
JArray subFilters = subFilter.SelectToken("subFilters")?.Value<JArray>();
|
||||
if (strategyCodes.Contains(subFilter["code"].Value<string>()))
|
||||
{
|
||||
// 到相应层级,如果原本没有的就覆盖添加相应的内容
|
||||
if (subFilters == null)
|
||||
{
|
||||
subFilters = new JArray();
|
||||
subFilter["subFilters"] = subFilters;
|
||||
}
|
||||
// 载入我们自己准备好的策略权限
|
||||
if (!File.Exists("prepared_strategies.json")) return;
|
||||
string str = File.ReadAllText("prepared_strategies.json");
|
||||
JArray jArray = JArray.Parse(str);
|
||||
foreach (JToken strategy in jArray)
|
||||
{
|
||||
if (!subFilters.Any(f => f["code"].Value<string>() == strategy["code"].Value<string>()))
|
||||
{
|
||||
subFilters.Add(strategy);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (subFilters == null) return;
|
||||
foreach (var _subFilter in subFilters)
|
||||
{
|
||||
AddStrategyIntersection(_subFilter);
|
||||
}
|
||||
}
|
||||
|
||||
// detail 本身就是一个 filter
|
||||
UnlockFilter(jo.SelectToken("detail"));
|
||||
AddStrategyIntersection(jo.SelectToken("detail"));
|
||||
|
||||
oSession.ResponseBody = Encoding.UTF8.GetBytes(jo.ToString(Newtonsoft.Json.Formatting.None));
|
||||
}
|
||||
if (oSession.uriContains("/user/Authority/GetMyAuthority"))
|
||||
{
|
||||
if (!oSession.ResponseHeaders.ExistsAndContains("Content-Type", "application/json")) return;
|
||||
Debug.WriteLine(oSession.GetResponseBodyAsString());
|
||||
|
||||
JObject jo = JObject.Parse(oSession.GetResponseBodyAsString());
|
||||
|
||||
// 添加快速选股权限,该权限未在 config_ind_online.json 中体现
|
||||
// 是在分析网页选股的时候发现的
|
||||
|
||||
var stockPickingAuthorities = new Dictionary<string, string>
|
||||
{
|
||||
{ "kuaisuxuangu", "快速选股" },
|
||||
{ "zonghexuangu", "综合选股" },
|
||||
{ "celvediejia", "策略叠加" }
|
||||
};
|
||||
|
||||
foreach (var stockPickingAuthority in stockPickingAuthorities)
|
||||
{
|
||||
jo["detail"].Value<JArray>().Add(new JObject
|
||||
{
|
||||
["code"] = stockPickingAuthority.Key,
|
||||
["name"] = stockPickingAuthority.Value,
|
||||
["isValid"] = true,
|
||||
["isFee"] = true,
|
||||
["startTime"] = 1688486400000,
|
||||
["endTime"] = 7258089599000,
|
||||
["needPermission"] = true,
|
||||
["groupId"] = 9,
|
||||
["groupName"] = "选股"
|
||||
});
|
||||
}
|
||||
|
||||
if (File.Exists("config_ind_online.json"))
|
||||
{
|
||||
string configFile = File.ReadAllText("config_ind_online.json");
|
||||
JObject indConfig = JObject.Parse(configFile);
|
||||
JObject indIdNameConfig = indConfig["indIdNameConfig"].Value<JObject>();
|
||||
JObject indMap = indConfig["indMap"].Value<JObject>();
|
||||
JArray indGruopList = indConfig["indGroupList"].Value<JArray>();
|
||||
foreach (var pair in indMap)
|
||||
{
|
||||
string indId = pair.Key;
|
||||
JObject ind = pair.Value as JObject;
|
||||
if (ind["isCalc"].Value<int>() == 1) continue;
|
||||
if (ind["noPermShow"] == null || ind["noPermShow"].Value<bool>()) continue;
|
||||
string permCode = ind["permCode"].Value<string>();
|
||||
string groupId = "10";
|
||||
string groupName = "决策";
|
||||
// 只专注于在线隐藏指标
|
||||
if (jo["detail"].Any(o => o["code"].Value<string>() == permCode))
|
||||
{
|
||||
Debug.WriteLine($"已有 {permCode} 不覆盖");
|
||||
continue;
|
||||
}
|
||||
jo["detail"].Value<JArray>().Add(new JObject
|
||||
{
|
||||
["code"] = permCode,
|
||||
["name"] = indIdNameConfig[indId].Value<string>(),
|
||||
["isValid"] = true,
|
||||
["isFee"] = true,
|
||||
["startTime"] = 1688486400000,
|
||||
["endTime"] = 7258089599000,
|
||||
["needPermission"] = true,
|
||||
["groupId"] = int.Parse(groupId),
|
||||
["groupName"] = groupName
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
oSession.ResponseBody = Encoding.UTF8.GetBytes(jo.ToString(Newtonsoft.Json.Formatting.None));
|
||||
}
|
||||
}
|
||||
|
||||
private async void btnEncode_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (txtProtocolID.Text.Trim() == string.Empty)
|
||||
{
|
||||
MessageBox.Show("ProtocolID 不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
int protocolId;
|
||||
try
|
||||
{
|
||||
protocolId = Convert.ToInt32(txtProtocolID.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("ProtocolID 只能为数字!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var url = "http://localhost:9999/api/v1/emoney/converter/request/encode";
|
||||
try
|
||||
{
|
||||
string r = await url.PostJsonAsync(new
|
||||
{
|
||||
protocolId,
|
||||
protocolBody = txtRequestJson.Text,
|
||||
}).ReceiveString();
|
||||
if (r != null)
|
||||
{
|
||||
JObject jo = JObject.Parse(r);
|
||||
if (jo["code"].Value<int>() == 0)
|
||||
{
|
||||
txtProtobufBody.Text = jo["result"].Value<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(jo["msg"].Value<string>(), "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FiddlerApplication.Log.LogString($"转换 JSON 为 Protobuf 请求出现错误:{ex.Message}");
|
||||
FiddlerApplication.Log.LogString(ex.StackTrace);
|
||||
MessageBox.Show($"转换 JSON 为 Protobuf 请求出现错误:{ex.Message}", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
EmoneyInteceptor/Emoney/Controls/EmoneyTabControl.resx
Normal file
120
EmoneyInteceptor/Emoney/Controls/EmoneyTabControl.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>
|
||||
13
EmoneyInteceptor/Emoney/EmoneyHelper.cs
Normal file
13
EmoneyInteceptor/Emoney/EmoneyHelper.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EmoneyInteceptor.Emoney
|
||||
{
|
||||
public class EmoneyHelper
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user