From bfb1ff514dd93c795edbfddb25b3df48b6399fc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A2=85=E6=B5=A9=E4=B8=9C?= <1083092844@qq.com>
Date: Mon, 14 Apr 2025 15:16:55 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E7=A8=8B=E5=BA=8F=EF=BC=8C?=
=?UTF-8?q?=E5=B9=B6=E7=A7=BB=E9=99=A4=20BouncyCastle=20=E7=9A=84dll?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BarrageGrab/AppRuntime.cs | 18 ++++-----
BarrageGrab/AppSetting.cs | 2 +-
BarrageGrab/ComPortServer.cs | 10 ++---
BarrageGrab/DyServer.cs | 4 +-
BarrageGrab/Forms/FormView.cs | 38 +++++++++----------
BarrageGrab/Forms/Models/RoomCacheItem.cs | 6 +--
BarrageGrab/Forms/RoomDetail.cs | 6 +--
BarrageGrab/JsEngine.cs | 24 ++++++------
BarrageGrab/LiveCompanHelper.cs | 14 +++----
BarrageGrab/Logger.cs | 6 +--
BarrageGrab/Modles/BusinessExecption.cs | 2 +-
.../Modles/JsonEntity/BarrageMessages.cs | 14 +++----
BarrageGrab/Modles/JsonEntity/Command.cs | 2 +-
BarrageGrab/Modles/RoomInfo.cs | 6 +--
BarrageGrab/ObjectExtension.cs | 10 ++---
BarrageGrab/Program.cs | 12 +++---
BarrageGrab/Properties/AssemblyInfo.cs | 4 +-
BarrageGrab/Proxy/ISystemProxy.cs | 4 +-
.../ProxyEventArgs/HttpResponseEventArgs.cs | 2 +-
.../SystemProxyChangeEventArgs.cs | 4 +-
BarrageGrab/Proxy/SystemProxy.cs | 12 +++---
BarrageGrab/Proxy/TitaniumProxy.cs | 35 ++++++++---------
BarrageGrab/WsBarrageServer.cs | 24 ++++++------
BarrageGrab/WssBarrageGrab.cs | 4 +-
BarrageGrab/WssBarrageService.csproj | 5 +--
25 files changed, 133 insertions(+), 135 deletions(-)
diff --git a/BarrageGrab/AppRuntime.cs b/BarrageGrab/AppRuntime.cs
index 390466f..485f78f 100644
--- a/BarrageGrab/AppRuntime.cs
+++ b/BarrageGrab/AppRuntime.cs
@@ -37,10 +37,10 @@ namespace BarrageGrab
static AppRuntime()
{
-
+
}
- public static void Init()
+ public static void Init()
{
WsServer = new WsBarrageServer();
RoomCaches = new RoomCacheManager();
@@ -57,7 +57,7 @@ namespace BarrageGrab
var hWnd = WinApi.GetConsoleWindow();
if (hWnd != IntPtr.Zero)
{
- WinApi.ShowWindow(hWnd, show? WinApi.CmdShow.SW_SHOW:WinApi.CmdShow.SW_HIDE);
+ WinApi.ShowWindow(hWnd, show ? WinApi.CmdShow.SW_SHOW : WinApi.CmdShow.SW_HIDE);
}
}
@@ -95,7 +95,7 @@ namespace BarrageGrab
WebRoomId = webrid,
Title = "房间" + webrid
};
- var succ = RoomInfoCache.TryAdd(roomid,info);
+ var succ = RoomInfoCache.TryAdd(roomid, info);
if (succ)
{
OnCache?.Invoke(this, new RoomCacheEventArgs()
@@ -130,7 +130,7 @@ namespace BarrageGrab
var succ = RoomInfoCache.TryAdd(roomid, roomInfo);
if (succ)
{
- OnCache?.Invoke(this,new RoomCacheEventArgs()
+ OnCache?.Invoke(this, new RoomCacheEventArgs()
{
Model = 0,
RoomInfo = roomInfo
@@ -147,7 +147,7 @@ namespace BarrageGrab
public string GetCachedWebRoomid(string roomid)
{
RoomInfo value;
- if (RoomInfoCache.TryGetValue(roomid,out value)) return value.WebRoomId??"未知";
+ if (RoomInfoCache.TryGetValue(roomid, out value)) return value.WebRoomId ?? "未知";
return "未知";
}
@@ -177,13 +177,13 @@ namespace BarrageGrab
public class RoomCacheEventArgs : EventArgs
{
- public RoomInfo RoomInfo { get; set; }
-
+ public RoomInfo RoomInfo { get; set; }
+
///
/// 0:添加,1更新,2删除
///
public int Model { get; set; }
}
- }
+ }
}
}
diff --git a/BarrageGrab/AppSetting.cs b/BarrageGrab/AppSetting.cs
index 2a4d2c4..6f30b85 100644
--- a/BarrageGrab/AppSetting.cs
+++ b/BarrageGrab/AppSetting.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Configuration;
+using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BarrageGrab.Modles.JsonEntity;
using static System.Configuration.ConfigurationManager;
-using System.Drawing;
namespace BarrageGrab
{
diff --git a/BarrageGrab/ComPortServer.cs b/BarrageGrab/ComPortServer.cs
index f328ea1..f690094 100644
--- a/BarrageGrab/ComPortServer.cs
+++ b/BarrageGrab/ComPortServer.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
+using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.IO.Ports;
-using Jint;
-using Jint.Runtime;
using System.Windows.Forms;
+using Jint;
using Jint.Native;
+using Jint.Runtime;
namespace BarrageGrab
{
@@ -34,7 +34,7 @@ namespace BarrageGrab
{
Logger.LogError(ex, $"comPortFilter.js 执行错误: {ex.Message}");
throw;
- }
+ }
}
}
@@ -81,7 +81,7 @@ namespace BarrageGrab
catch (Exception ex)
{
Logger.LogError(ex, $"串口过滤器 onPackData 执行错误:{ex.Message}");
- return;
+ return;
}
if (result == null) return;
diff --git a/BarrageGrab/DyServer.cs b/BarrageGrab/DyServer.cs
index 4ee203c..6a2e732 100644
--- a/BarrageGrab/DyServer.cs
+++ b/BarrageGrab/DyServer.cs
@@ -55,7 +55,7 @@ namespace BarrageGrab
Logger.LogError($"礼物信息从服务器请求失败: {ex.Message}");
return null;
}
- }
+ }
///
/// 获取房间信息,通过原生接口
@@ -69,7 +69,7 @@ namespace BarrageGrab
string url = "https://live.douyin.com/webcast/room/web/enter/";
var client = new HttpClient();
-
+
var uri = new UriBuilder(url);
var dict = new Dictionary();
diff --git a/BarrageGrab/Forms/FormView.cs b/BarrageGrab/Forms/FormView.cs
index 430a38b..0c400a8 100644
--- a/BarrageGrab/Forms/FormView.cs
+++ b/BarrageGrab/Forms/FormView.cs
@@ -1,8 +1,4 @@
-using BarrageGrab.Forms;
-using BarrageGrab.Forms.Models;
-using BarrageGrab.Modles.JsonEntity;
-using BarrageGrab.Proxy;
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -13,6 +9,10 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using BarrageGrab.Forms;
+using BarrageGrab.Forms.Models;
+using BarrageGrab.Modles.JsonEntity;
+using BarrageGrab.Proxy;
namespace BarrageGrab
{
@@ -29,7 +29,7 @@ namespace BarrageGrab
InitializeComponent();
barServer.OnPrint += WssService_OnPrint;
barServer.Grab.Proxy.OnProxyStatus += Proxy_OnProxyStatus;
- AppRuntime.RoomCaches.OnCache += RoomCaches_OnCache;
+ AppRuntime.RoomCaches.OnCache += RoomCaches_OnCache;
}
private void InitTabPages()
@@ -85,8 +85,8 @@ namespace BarrageGrab
private void Ck_CheckedChanged(object sender, EventArgs e)
{
- CheckBox cbx = sender as CheckBox;
- if (cbx == null) return;
+ CheckBox cbx = sender as CheckBox;
+ if (cbx == null) return;
var selected = GetCheckedBarTypes((FlowLayoutPanel)cbx.Parent);
if (cbx.Parent.Parent == this.tabPage_Console)
{
@@ -96,7 +96,7 @@ namespace BarrageGrab
{
AppSetting.Current.PushFilter = selected;
}
- if(cbx.Parent.Parent == this.tabPage_Log)
+ if (cbx.Parent.Parent == this.tabPage_Log)
{
AppSetting.Current.LogFilter = selected;
}
@@ -113,12 +113,12 @@ namespace BarrageGrab
if (cbk.Checked && cbk.Name.StartsWith("cbx_bartype_"))
{
list.Add((int)cbk.Tag);
- }
+ }
}
return list.OrderBy(o => o).ToArray();
}
- private Dictionary GetMsgTypes()
+ private Dictionary GetMsgTypes()
{
var dic = new Dictionary();
Type enumType = typeof(PackMsgType);
@@ -127,7 +127,7 @@ namespace BarrageGrab
{
DescriptionAttribute attribute = (DescriptionAttribute)field.GetCustomAttribute(typeof(DescriptionAttribute), false);
int value = (int)field.GetValue(null);
- if (attribute != null && value>0)
+ if (attribute != null && value > 0)
{
dic.Add(value, attribute.Description);
}
@@ -146,7 +146,7 @@ namespace BarrageGrab
this.label3.Text = $"房间缓存列表({AppRuntime.RoomCaches.RoomInfoCache.Count})";
list_roomCaches.Items.Add(item);
}
- }));
+ }));
}
private void FormView_Load(object sender, EventArgs e)
@@ -165,7 +165,7 @@ namespace BarrageGrab
this.Invoke(new Action(() =>
{
this.cbx_enableProxy.Checked = e.Open;
- }));
+ }));
}
private void WssService_OnPrint(object sender, WsBarrageServer.PrintEventArgs e)
@@ -187,7 +187,7 @@ namespace BarrageGrab
this.rich_output.Clear();
printCount = 0;
}
- }));
+ }));
}
private void cbx_enableProxy_CheckedChanged(object sender, EventArgs e)
@@ -209,7 +209,7 @@ namespace BarrageGrab
var selectedItem = list_roomCaches.SelectedItem as RoomCacheItem;
if (selectedItem == null) return;
- var form = new RoomDetail(selectedItem.RoomInfo);
+ var form = new RoomDetail(selectedItem.RoomInfo);
form.ShowDialog();
}
@@ -225,8 +225,8 @@ namespace BarrageGrab
catch (Exception ex)
{
//弹窗提示错误
- MessageBox.Show(ex.Message,"设置失败");
- }
+ MessageBox.Show(ex.Message, "设置失败");
+ }
}
private void cbx_barrageLog_CheckedChanged(object sender, EventArgs e)
@@ -235,5 +235,5 @@ namespace BarrageGrab
AppSetting.Current.BarrageLog = checker.Checked;
AppSetting.Current.Save();
}
- }
+ }
}
diff --git a/BarrageGrab/Forms/Models/RoomCacheItem.cs b/BarrageGrab/Forms/Models/RoomCacheItem.cs
index 6dad8c2..2deaa6b 100644
--- a/BarrageGrab/Forms/Models/RoomCacheItem.cs
+++ b/BarrageGrab/Forms/Models/RoomCacheItem.cs
@@ -1,9 +1,9 @@
-using BarrageGrab.Modles;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using BarrageGrab.Modles;
namespace BarrageGrab.Forms.Models
{
@@ -21,7 +21,7 @@ namespace BarrageGrab.Forms.Models
public override string ToString()
{
if (RoomInfo == null) return "NULL";
- return $"({RoomInfo.WebRoomId}){RoomInfo?.Owner?.Nickname??"-1"}";
+ return $"({RoomInfo.WebRoomId}){RoomInfo?.Owner?.Nickname ?? "-1"}";
}
}
}
diff --git a/BarrageGrab/Forms/RoomDetail.cs b/BarrageGrab/Forms/RoomDetail.cs
index 352b3ce..67358f4 100644
--- a/BarrageGrab/Forms/RoomDetail.cs
+++ b/BarrageGrab/Forms/RoomDetail.cs
@@ -1,5 +1,4 @@
-using BarrageGrab.Modles;
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -8,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using BarrageGrab.Modles;
using Newtonsoft.Json;
namespace BarrageGrab.Forms
@@ -18,7 +18,7 @@ namespace BarrageGrab.Forms
{
InitializeComponent();
//小驼峰
- var json = JsonConvert.SerializeObject(info,Formatting.Indented,new JsonSerializerSettings()
+ var json = JsonConvert.SerializeObject(info, Formatting.Indented, new JsonSerializerSettings()
{
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
});
diff --git a/BarrageGrab/JsEngine.cs b/BarrageGrab/JsEngine.cs
index 0ba724f..1a90262 100644
--- a/BarrageGrab/JsEngine.cs
+++ b/BarrageGrab/JsEngine.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.IO;
using Jint;
-using Newtonsoft.Json;
using Jint.Native;
+using Newtonsoft.Json;
namespace BarrageGrab
{
@@ -83,7 +83,7 @@ namespace BarrageGrab
Engine eng;
public JsEncoder(Engine eng)
{
- this.eng = eng;
+ this.eng = eng;
}
private JsValue ByteConvert(byte[] buff)
@@ -165,14 +165,14 @@ namespace BarrageGrab
return eng.Invoke("byteToUint8Array", buff);
}
- public JsValue toNumber(byte[] buff,int startIndex = 0)
+ public JsValue toNumber(byte[] buff, int startIndex = 0)
{
return BitConverter.ToDouble(buff, startIndex);
}
-
+
public bool toBoolean(byte[] buff, int startIndex = 0)
{
- return BitConverter.ToBoolean(buff, startIndex);
+ return BitConverter.ToBoolean(buff, startIndex);
}
public string toString(byte[] buff, int startIndex = 0)
@@ -182,7 +182,7 @@ namespace BarrageGrab
public string toString(byte[] buff, int startIndex, int length)
{
- return BitConverter.ToString(buff, startIndex, length);
+ return BitConverter.ToString(buff, startIndex, length);
}
public JsValue getBytes(JsValue value)
@@ -190,21 +190,21 @@ namespace BarrageGrab
byte[] buff = new byte[0];
switch (value.Type)
{
- case Jint.Runtime.Types.Empty:
+ case Jint.Runtime.Types.Empty:
case Jint.Runtime.Types.Undefined:
case Jint.Runtime.Types.Null:
break;
case Jint.Runtime.Types.Boolean:
buff = BitConverter.GetBytes(value.AsBoolean());
- break;
+ break;
case Jint.Runtime.Types.Number:
buff = BitConverter.GetBytes(value.AsNumber());
- break;
+ break;
case Jint.Runtime.Types.BigInt:
buff = BitConverter.GetBytes((long)value.AsNumber());
- break;
+ break;
default:
- throw new Exception($"不支持该类型转换:" + value.Type);
+ throw new Exception($"不支持该类型转换:" + value.Type);
}
return ByteConvert(buff);
diff --git a/BarrageGrab/LiveCompanHelper.cs b/BarrageGrab/LiveCompanHelper.cs
index 780157a..2c20da1 100644
--- a/BarrageGrab/LiveCompanHelper.cs
+++ b/BarrageGrab/LiveCompanHelper.cs
@@ -1,18 +1,18 @@
-using HtmlAgilityPack;
-using System;
+using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
+using HtmlAgilityPack;
using IWshRuntimeLibrary;
-using File = System.IO.File;
using Microsoft.Win32;
-using System.Diagnostics;
using Newtonsoft.Json;
-using System.Runtime.InteropServices.ComTypes;
+using File = System.IO.File;
namespace BarrageGrab
{
@@ -219,7 +219,7 @@ namespace BarrageGrab
Logger.LogInfo($"直播伴侣文件改动检测点1已拦截");
}
-
+
checkReg = new Regex(@"if\(\(0,\w.integrityCheckReport\)\(\w\),!\w\.ok\)");
if (checkReg.IsMatch(content))
{
diff --git a/BarrageGrab/Logger.cs b/BarrageGrab/Logger.cs
index d5ee471..8fe068e 100644
--- a/BarrageGrab/Logger.cs
+++ b/BarrageGrab/Logger.cs
@@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using NLog;
using BarrageGrab.Modles.JsonEntity;
-using System.IO;
+using NLog;
namespace BarrageGrab
{
@@ -83,7 +83,7 @@ namespace BarrageGrab
{
var dir = Path.Combine(AppContext.BaseDirectory, "logs", "弹幕日志");
var room = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
- if(room == null) return;
+ if (room == null) return;
var date = DateTime.Now.ToString("yyyy年MM月dd日直播");
var nickName = SafePathString(room?.Owner?.Nickname ?? "-1");
dir = Path.Combine(dir, $"({room.WebRoomId}){nickName}", date, "场次" + msg.RoomId.ToString());
diff --git a/BarrageGrab/Modles/BusinessExecption.cs b/BarrageGrab/Modles/BusinessExecption.cs
index 6771c41..b8aa6e5 100644
--- a/BarrageGrab/Modles/BusinessExecption.cs
+++ b/BarrageGrab/Modles/BusinessExecption.cs
@@ -31,7 +31,7 @@ namespace BarrageGrab.Modles
this.Code = -1;
}
- public BusinessExecption(string msg,object data) : base(msg)
+ public BusinessExecption(string msg, object data) : base(msg)
{
this.ErrorTarget = data;
}
diff --git a/BarrageGrab/Modles/JsonEntity/BarrageMessages.cs b/BarrageGrab/Modles/JsonEntity/BarrageMessages.cs
index 9aeaaee..a7d23fc 100644
--- a/BarrageGrab/Modles/JsonEntity/BarrageMessages.cs
+++ b/BarrageGrab/Modles/JsonEntity/BarrageMessages.cs
@@ -8,8 +8,8 @@ namespace BarrageGrab.Modles.JsonEntity
public enum PackMsgType
{
[Description("无")]
- 无 = 0,
- [Description("消息")]
+ 无 = 0,
+ [Description("消息")]
弹幕消息 = 1,
[Description("点赞")]
点赞消息 = 2,
@@ -71,8 +71,8 @@ namespace BarrageGrab.Modles.JsonEntity
///
/// 消息类型
///
- public PackMsgType Type { get; set; }
-
+ public PackMsgType Type { get; set; }
+
///
/// 进程名
///
@@ -88,7 +88,7 @@ namespace BarrageGrab.Modles.JsonEntity
}
- public BarrageMsgPack(string data, PackMsgType type,string processName)
+ public BarrageMsgPack(string data, PackMsgType type, string processName)
{
Data = data;
Type = type;
@@ -304,8 +304,8 @@ namespace BarrageGrab.Modles.JsonEntity
///
/// 抖币价格
///
- public int DiamondCount { get; set; }
-
+ public int DiamondCount { get; set; }
+
///
/// 该礼物是否可连击
///
diff --git a/BarrageGrab/Modles/JsonEntity/Command.cs b/BarrageGrab/Modles/JsonEntity/Command.cs
index b25b4d3..8b3e6b7 100644
--- a/BarrageGrab/Modles/JsonEntity/Command.cs
+++ b/BarrageGrab/Modles/JsonEntity/Command.cs
@@ -16,7 +16,7 @@ namespace BarrageGrab.Modles.JsonEntity
///
/// 空指令
///
- None = 0,
+ None = 0,
///
/// 安全关闭程序
diff --git a/BarrageGrab/Modles/RoomInfo.cs b/BarrageGrab/Modles/RoomInfo.cs
index ceae585..f778e9c 100644
--- a/BarrageGrab/Modles/RoomInfo.cs
+++ b/BarrageGrab/Modles/RoomInfo.cs
@@ -4,8 +4,8 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
namespace BarrageGrab.Modles
{
@@ -659,7 +659,7 @@ namespace BarrageGrab.Modles
}
-
+
info = dto;
return Tuple.Create(0, "succ");
@@ -710,7 +710,7 @@ namespace BarrageGrab.Modles
SecUid = roomOwner["sec_uid"].ToString(),
HeadUrl = roomOwner["avatar_thumb"]["url_list"].Values()?.FirstOrDefault() ?? "",
FollowStatus = roomOwner["follow_info"]["follow_status"].Value()
- };
+ };
}
info = dto;
diff --git a/BarrageGrab/ObjectExtension.cs b/BarrageGrab/ObjectExtension.cs
index 9bf9569..3876996 100644
--- a/BarrageGrab/ObjectExtension.cs
+++ b/BarrageGrab/ObjectExtension.cs
@@ -31,13 +31,13 @@ namespace BarrageGrab
///
///
///
- public static string ToJson(this object obj,bool format = false)
+ public static string ToJson(this object obj, bool format = false)
{
if (obj is string)
{
return obj.ToString();
}
- return JsonConvert.SerializeObject(obj, format?Formatting.Indented:Formatting.None);
+ return JsonConvert.SerializeObject(obj, format ? Formatting.Indented : Formatting.None);
}
///
@@ -136,7 +136,7 @@ namespace BarrageGrab
}
return cookies;
}
-
+
///
/// 追加另一个字典
///
@@ -159,11 +159,11 @@ namespace BarrageGrab
else
{
res.Add(item.Key, item.Value);
- }
+ }
}
return res;
}
-
+
///
/// 转换为Cookie对象列表
diff --git a/BarrageGrab/Program.cs b/BarrageGrab/Program.cs
index 8752188..3cca68f 100644
--- a/BarrageGrab/Program.cs
+++ b/BarrageGrab/Program.cs
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
-using System.Net.Sockets;
using System.Net;
+using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
-using System.IO;
-using Jint.Runtime;
using System.Windows.Forms;
+using Jint.Runtime;
namespace BarrageGrab
{
@@ -37,18 +37,18 @@ namespace BarrageGrab
catch (Exception ex)
{
Logger.LogError(ex, $"程序初始化错误,{ex.Message}");
- MessageBox.Show(ex.Message, "程序初始化错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(ex.Message, "程序初始化错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
exited = true;
}
while (!exited)
- {
+ {
Thread.Sleep(500);
}
if (!AppRuntime.WsServer.IsDisposed)
{
- AppRuntime.WsServer.Dispose();
+ AppRuntime.WsServer.Dispose();
}
Logger.PrintColor("服务器已关闭...");
diff --git a/BarrageGrab/Properties/AssemblyInfo.cs b/BarrageGrab/Properties/AssemblyInfo.cs
index 966c8a5..e0669c2 100644
--- a/BarrageGrab/Properties/AssemblyInfo.cs
+++ b/BarrageGrab/Properties/AssemblyInfo.cs
@@ -1,5 +1,5 @@
-using System.Resources;
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
diff --git a/BarrageGrab/Proxy/ISystemProxy.cs b/BarrageGrab/Proxy/ISystemProxy.cs
index 8626e7e..a3edcb1 100644
--- a/BarrageGrab/Proxy/ISystemProxy.cs
+++ b/BarrageGrab/Proxy/ISystemProxy.cs
@@ -1,6 +1,6 @@
using System;
-using System.Reflection;
using System.Collections.Generic;
+using System.Reflection;
using BarrageGrab.Proxy.ProxyEventArgs;
namespace BarrageGrab.Proxy
@@ -42,5 +42,5 @@ namespace BarrageGrab.Proxy
/// 开始监听
///
void Start();
- }
+ }
}
\ No newline at end of file
diff --git a/BarrageGrab/Proxy/ProxyEventArgs/HttpResponseEventArgs.cs b/BarrageGrab/Proxy/ProxyEventArgs/HttpResponseEventArgs.cs
index 82f1b5c..25a5b5d 100644
--- a/BarrageGrab/Proxy/ProxyEventArgs/HttpResponseEventArgs.cs
+++ b/BarrageGrab/Proxy/ProxyEventArgs/HttpResponseEventArgs.cs
@@ -30,7 +30,7 @@ namespace BarrageGrab.Proxy.ProxyEventArgs
///
/// 域名
///
- public string HostName { get; set; }
+ public string HostName { get; set; }
///
/// 有效载荷
diff --git a/BarrageGrab/Proxy/ProxyEventArgs/SystemProxyChangeEventArgs.cs b/BarrageGrab/Proxy/ProxyEventArgs/SystemProxyChangeEventArgs.cs
index 2a00689..67cc2c5 100644
--- a/BarrageGrab/Proxy/ProxyEventArgs/SystemProxyChangeEventArgs.cs
+++ b/BarrageGrab/Proxy/ProxyEventArgs/SystemProxyChangeEventArgs.cs
@@ -6,11 +6,11 @@ using System.Threading.Tasks;
namespace BarrageGrab.Proxy.ProxyEventArgs
{
- public class SystemProxyChangeEventArgs:EventArgs
+ public class SystemProxyChangeEventArgs : EventArgs
{
///
/// True 以开启:False: 已关闭
///
- public bool Open { get; set; }
+ public bool Open { get; set; }
}
}
diff --git a/BarrageGrab/Proxy/SystemProxy.cs b/BarrageGrab/Proxy/SystemProxy.cs
index 0920319..1bd20d6 100644
--- a/BarrageGrab/Proxy/SystemProxy.cs
+++ b/BarrageGrab/Proxy/SystemProxy.cs
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
-using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.Win32;
-using System.Diagnostics;
using BarrageGrab.Proxy.ProxyEventArgs;
+using Microsoft.Win32;
namespace BarrageGrab.Proxy
{
@@ -42,7 +42,7 @@ namespace BarrageGrab.Proxy
public abstract void Start();
- public abstract void SetUpstreamProxy(string addr);
+ public abstract void SetUpstreamProxy(string addr);
//https://live.douyin.com/webcast/gift/list/ [礼物数据接口]
@@ -109,7 +109,7 @@ namespace BarrageGrab.Proxy
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1);
registry.SetValue("ProxyServer", $"127.0.0.1:{ProxyPort}");
-
+
OnProxyStatus?.Invoke(this, new SystemProxyChangeEventArgs()
{
Open = true
@@ -128,7 +128,7 @@ namespace BarrageGrab.Proxy
{
Open = false
});
- }
+ }
public static bool ProxyIsOpen()
{
diff --git a/BarrageGrab/Proxy/TitaniumProxy.cs b/BarrageGrab/Proxy/TitaniumProxy.cs
index 10217fb..dd2b1af 100644
--- a/BarrageGrab/Proxy/TitaniumProxy.cs
+++ b/BarrageGrab/Proxy/TitaniumProxy.cs
@@ -1,31 +1,31 @@
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
+using System.IO.Compression;
using System.Linq;
using System.Net;
+using System.Net.Http;
using System.Net.Security;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Policy;
+using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BarrageGrab.Modles;
using BarrageGrab.Modles.JsonEntity;
using BarrageGrab.Proxy.ProxyEventArgs;
-using Newtonsoft.Json.Linq;
+using BrotliSharpLib;
using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using NLog.LayoutRenderers;
using Titanium.Web.Proxy;
using Titanium.Web.Proxy.EventArguments;
using Titanium.Web.Proxy.Http;
using Titanium.Web.Proxy.Models;
using Titanium.Web.Proxy.StreamExtended.Network;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography;
using HtmlDocument = HtmlAgilityPack.HtmlDocument;
-using System.Net.Http;
-using System.Text;
-using BrotliSharpLib;
-using System.IO.Compression;
-using System.Collections.Concurrent;
-using System.Security.Policy;
-using NLog.LayoutRenderers;
namespace BarrageGrab.Proxy
{
@@ -37,7 +37,7 @@ namespace BarrageGrab.Proxy
List rinfoRequestings = new List();
const string SCRIPT_HOST = "lf-cdn-tos.bytescm.com";
- const string LIVE_HOST = "live.douyin.com";
+ const string LIVE_HOST = "live.douyin.com";
const string DOUYIN_HOST = "www.douyin.com";
const string USER_INFO_PATH = "/webcast/user/me/";
const string BARRAGE_POOL_PATH = "/webcast/im/fetch";
@@ -90,17 +90,18 @@ namespace BarrageGrab.Proxy
proxyServer.CertificateManager.CertificateValidDays = 365 * 10;
proxyServer.CertificateManager.SaveFakeCertificates = true;
+ proxyServer.CertificateManager.CertificateEngine = Titanium.Web.Proxy.Network.CertificateEngine.DefaultWindows;
+ proxyServer.CertificateManager.OverwritePfxFile = false;
proxyServer.CertificateManager.RootCertificate = GetCert();
if (proxyServer.CertificateManager.RootCertificate == null)
{
Logger.PrintColor("正在进行证书安装,需要信任该证书才可进行https解密,若有提示请确定");
proxyServer.CertificateManager.CreateRootCertificate();
}
-
- //信任证书
- proxyServer.CertificateManager.CreateRootCertificate();
proxyServer.CertificateManager.TrustRootCertificate(true);
+ //https://github.com/justcoding121/titanium-web-proxy/issues/828
+
proxyServer.ServerCertificateValidationCallback += ProxyServer_ServerCertificateValidationCallback;
//proxyServer.BeforeRequest += ProxyServer_BeforeRequest;
proxyServer.BeforeResponse += ProxyServer_BeforeResponse;
@@ -628,12 +629,12 @@ namespace BarrageGrab.Proxy
WEBCAST_AMEMV_HOST , //直播伴侣开播请求地址
"*-webcast-platform.bytetos.com", //新的脚本地址
"*webcast*" //所有带webcast的域名
- };
+ };
if (decryptSsls.Contains(hostname))
{
return true;
- }
+ }
if (hostname.WildcardMatchAny(decryptSsls))
{
@@ -654,7 +655,7 @@ namespace BarrageGrab.Proxy
var processid = args.HttpClient.ProcessId.Value;
List messageData = new List();
-
+
try
{
foreach (var frame in args.WebSocketDecoderReceive.Decode(e.Buffer, e.Offset, e.Count))
diff --git a/BarrageGrab/WsBarrageServer.cs b/BarrageGrab/WsBarrageServer.cs
index 3bc11dc..c8731ba 100644
--- a/BarrageGrab/WsBarrageServer.cs
+++ b/BarrageGrab/WsBarrageServer.cs
@@ -1,23 +1,23 @@
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
+using System.Drawing;
+using System.Dynamic;
+using System.IO;
+using System.IO.Compression;
using System.Linq;
using System.Net;
+using System.Net.Http;
using System.Net.WebSockets;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
-using Fleck;
-using Newtonsoft.Json;
using BarrageGrab.Modles;
-using Newtonsoft.Json.Linq;
-using System.Net.Http;
-using System.IO.Compression;
-using System.IO;
using BarrageGrab.Modles.JsonEntity;
using BarrageGrab.Modles.ProtoEntity;
-using System.Drawing;
-using System.Collections.Concurrent;
-using System.Dynamic;
+using Fleck;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using static BarrageGrab.Modles.ProtoEntity.Image;
using static BarrageGrab.Modles.WebCastGift;
@@ -220,10 +220,10 @@ namespace BarrageGrab
if (isAdmin)
{
- text+= " [管理员]";
+ text += " [管理员]";
}
- if(isAnchor)
+ if (isAnchor)
{
text += " [主播]";
}
@@ -286,7 +286,7 @@ namespace BarrageGrab
{
if (msg == null) return;
var roomInfo = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
- if (roomInfo != null && roomInfo.Owner!=null)
+ if (roomInfo != null && roomInfo.Owner != null)
{
msg.Onwer = new RoomAnchorInfo()
{
diff --git a/BarrageGrab/WssBarrageGrab.cs b/BarrageGrab/WssBarrageGrab.cs
index 70162f7..8525b71 100644
--- a/BarrageGrab/WssBarrageGrab.cs
+++ b/BarrageGrab/WssBarrageGrab.cs
@@ -5,10 +5,10 @@ using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using ProtoBuf;
+using BarrageGrab.Modles.ProtoEntity;
using BarrageGrab.Proxy;
using BarrageGrab.Proxy.ProxyEventArgs;
-using BarrageGrab.Modles.ProtoEntity;
+using ProtoBuf;
namespace BarrageGrab
{
diff --git a/BarrageGrab/WssBarrageService.csproj b/BarrageGrab/WssBarrageService.csproj
index 98ae325..99f91ce 100644
--- a/BarrageGrab/WssBarrageService.csproj
+++ b/BarrageGrab/WssBarrageService.csproj
@@ -70,9 +70,6 @@
..\packages\Portable.BouncyCastle.1.8.8\lib\net40\BouncyCastle.Crypto.dll
-
- ..\packages\BouncyCastle.Cryptography.2.0.0\lib\net461\BouncyCastle.Cryptography.dll
-
..\packages\BrotliSharpLib.0.3.3\lib\net451\BrotliSharpLib.dll
@@ -206,11 +203,11 @@
+
-
..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll