From df2b4c583c9b1e1e5bcd191a8e7b4731722ed147 Mon Sep 17 00:00:00 2001 From: Zephyris-Pro <200662396+Zephyris-Pro@users.noreply.github.com> Date: Thu, 10 Jul 2025 13:16:29 +0200 Subject: [PATCH 1/2] Add qBittorrent (5.1.2) --- Source/RatioMaster/RM.Designer.cs | 3 ++- Source/RatioMaster/RM.cs | 8 ++++++++ Source/RatioMaster/TorrentClientFactory.cs | 23 ++++++++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Source/RatioMaster/RM.Designer.cs b/Source/RatioMaster/RM.Designer.cs index 87eaac1..6c2dd10 100644 --- a/Source/RatioMaster/RM.Designer.cs +++ b/Source/RatioMaster/RM.Designer.cs @@ -769,7 +769,8 @@ internal void InitializeComponent() "BitSpirit", "Deluge", "KTorrent", - "Gnome BT"}); + "Gnome BT", + "qBittorrent"}); this.cmbClient.Location = new System.Drawing.Point(197, 20); this.cmbClient.Name = "cmbClient"; this.cmbClient.Size = new System.Drawing.Size(139, 21); diff --git a/Source/RatioMaster/RM.cs b/Source/RatioMaster/RM.cs index 947d940..9590bfc 100644 --- a/Source/RatioMaster/RM.cs +++ b/Source/RatioMaster/RM.cs @@ -527,6 +527,14 @@ internal void cmbClient_SelectedIndexChanged(object sender, EventArgs e) break; } + case "qBittorrent": + { + cmbVersion.Items.Add("5.1.2"); + cmbVersion.SelectedItem = "5.1.2"; + if (customPeersNum.Text == "0" || customPeersNum.Text == "") customPeersNum.Text = "200"; + break; + } + default: { cmbClient.SelectedItem = DefaultClient; diff --git a/Source/RatioMaster/TorrentClientFactory.cs b/Source/RatioMaster/TorrentClientFactory.cs index b5e2138..743fbdd 100644 --- a/Source/RatioMaster/TorrentClientFactory.cs +++ b/Source/RatioMaster/TorrentClientFactory.cs @@ -16,7 +16,7 @@ public static TorrentClient GetClient(string name) client.HttpProtocol = "HTTP/1.1"; client.HashUpperCase = true; client.Key = GenerateIdString("numeric", 5, false, false); - client.Headers = "Host: {host}\r\nConnection: close\r\nAccpet: */*\r\nAccept-Encoding: gzip\r\nUser-Agent: BitComet/1.20.3.25\r\nPragma: no-cache\r\nCache-Control: no-cache\r\n"; + client.Headers = "Host: {host}\r\nConnection: close\r\nAccept: */*\r\nAccept-Encoding: gzip\r\nUser-Agent: BitComet/1.20.3.25\r\nPragma: no-cache\r\nCache-Control: no-cache\r\n"; client.PeerID = "-BC0120-" + GenerateIdString("random", 12, true, true); client.Query = "info_hash={infohash}&peer_id={peerid}&port={port}&natmapped=1&localip={localip}&port_type=wan&uploaded={uploaded}&downloaded={downloaded}&left={left}&numwant={numwant}&compact=1&no_peer_id=1&key={key}{event}"; client.DefNumWant = 200; @@ -34,7 +34,7 @@ public static TorrentClient GetClient(string name) client.HttpProtocol = "HTTP/1.1"; client.HashUpperCase = true; client.Key = GenerateIdString("numeric", 5, false, false); - client.Headers = "Host: {host}\r\nConnection: close\r\nAccpet: */*\r\nAccept-Encoding: gzip\r\nUser-Agent: BitComet/1.3.7.17\r\nPragma: no-cache\r\nCache-Control: no-cache\r\n"; + client.Headers = "Host: {host}\r\nConnection: close\r\nAccept: */*\r\nAccept-Encoding: gzip\r\nUser-Agent: BitComet/1.3.7.17\r\nPragma: no-cache\r\nCache-Control: no-cache\r\n"; client.PeerID = "-BC0103-" + GenerateIdString("random", 12, true, true); client.Query = "info_hash={infohash}&peer_id={peerid}&port={port}&natmapped=1&localip={localip}&port_type=wan&uploaded={uploaded}&downloaded={downloaded}&left={left}&numwant={numwant}&compact=1&no_peer_id=1&key={key}{event}"; client.DefNumWant = 200; @@ -719,6 +719,25 @@ public static TorrentClient GetClient(string name) break; } #endregion + #region qBittorrent + case "qBittorrent 5.1.2": + { + client.Name = "qBittorrent 5.1.2"; + client.HttpProtocol = "HTTP/1.1"; + client.HashUpperCase = false; + client.Key = GenerateIdString("numeric", 8, false, false); + client.Headers = "User-Agent: qBittorrent/5.1.2\r\nAccept-Encoding: gzip\r\nAccept: */*\r\nHost: {host}\r\nConnection: close\n\r"; + client.PeerID = "-qB5120-" + GenerateIdString("alphanumeric", 12, false, false); + client.Query = "info_hash={infohash}&peer_id={peerid}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&corrupt=0&key={key}{event}&numwant={numwant}&compact=1&no_peer_id=1&supportcrypto=1&redundant=0"; + client.DefNumWant = 200; + client.Parse = true; + client.SearchString = "&peer_id=-qB5120-"; + client.ProcessName = "qbittorent"; + client.StartOffset = 0; + client.MaxOffset = 100000000; + break; + } + #endregion default: { client.Name = "uTorrent 3.3.2"; From 8489cba7779c66d67fb92d2c45d7f816ee05e3a7 Mon Sep 17 00:00:00 2001 From: Zephyris <200662396+Zephyris-Pro@users.noreply.github.com> Date: Thu, 10 Jul 2025 13:39:25 +0200 Subject: [PATCH 2/2] Noticed changes in qBittorrent key and peerID generation --- Source/RatioMaster/TorrentClientFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/RatioMaster/TorrentClientFactory.cs b/Source/RatioMaster/TorrentClientFactory.cs index 743fbdd..b8754e6 100644 --- a/Source/RatioMaster/TorrentClientFactory.cs +++ b/Source/RatioMaster/TorrentClientFactory.cs @@ -725,9 +725,9 @@ public static TorrentClient GetClient(string name) client.Name = "qBittorrent 5.1.2"; client.HttpProtocol = "HTTP/1.1"; client.HashUpperCase = false; - client.Key = GenerateIdString("numeric", 8, false, false); + client.Key = GenerateIdString("hex", 8, false, true); client.Headers = "User-Agent: qBittorrent/5.1.2\r\nAccept-Encoding: gzip\r\nAccept: */*\r\nHost: {host}\r\nConnection: close\n\r"; - client.PeerID = "-qB5120-" + GenerateIdString("alphanumeric", 12, false, false); + client.PeerID = "-qB5120-" + GenerateIdString("random", 12, false, false); client.Query = "info_hash={infohash}&peer_id={peerid}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&corrupt=0&key={key}{event}&numwant={numwant}&compact=1&no_peer_id=1&supportcrypto=1&redundant=0"; client.DefNumWant = 200; client.Parse = true;