From 7ff6d8cf366f1ebe10a8830f7da44c93b29bec2f Mon Sep 17 00:00:00 2001 From: Mark Deepwell Date: Sun, 25 Apr 2021 09:04:19 -0700 Subject: [PATCH 1/3] Add unrecognized client names #1363 This is based off of PR#1526 by azy5030 to add in: Torrent Web, BiglyBT, and FrostWire. I made the additional change requested by livings124. In addition this also adds support for: HTTP Seed, aria2 (#532), and BitLord. --- libtransmission/clients.c | 40 +++++++++++++++++++++++++++ tests/libtransmission/clients-test.cc | 13 +++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/libtransmission/clients.c b/libtransmission/clients.c index e06d0a8fc..7581c8c03 100644 --- a/libtransmission/clients.c +++ b/libtransmission/clients.c @@ -291,6 +291,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) { four_digits(buf, buflen, "BitZilla", id + 3); } + else if (strncmp(chid + 1, "BI", 2) == 0) + { + four_digits(buf, buflen, "BiglyBT", id + 3); + } else if (strncmp(chid + 1, "BM", 2) == 0) { four_digits(buf, buflen, "BitMagnet", id + 3); @@ -467,6 +471,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) { four_digits(buf, buflen, "FireTorrent", id + 3); } + else if (strncmp(chid + 1, "WW", 2) == 0) + { + four_digits(buf, buflen, "WebTorrent", id + 3); + } else if (strncmp(chid + 1, "XL", 2) == 0) { four_digits(buf, buflen, "Xunlei", id + 3); @@ -500,6 +508,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) { three_digits(buf, buflen, "Electric Sheep", id + 3); } + else if (strncmp(chid + 1, "FW", 2) == 0) + { + three_digits(buf, buflen, "FrostWire", id + 3); + } else if (strncmp(chid + 1, "HL", 2) == 0) { three_digits(buf, buflen, "Halite", id + 3); @@ -622,6 +634,10 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) { tr_snprintf(buf, buflen, "Baidu Netdisk"); } + else if (strncmp(chid + 1, "WS", 2) == 0) + { + no_version(buf, buflen, "HTTP Seed"); + } if (!tr_str_is_empty(buf)) { @@ -647,6 +663,11 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) tr_snprintf(buf, buflen, "\xc2\xb5Torrent Embedded %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1), strint(id + 5, 2), getMnemonicEnd(id[7])); } + else if (strncmp(chid + 1, "UW", 2) == 0) + { + tr_snprintf(buf, buflen, "\xc2\xb5Torrent Web %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1), strint(id + 5, + 1), getMnemonicEnd(id[6])); + } if (!tr_str_is_empty(buf)) { @@ -788,6 +809,25 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) { two_major_two_minor(buf, buflen, "Tixati", id + 3); } + else if (strncmp(chid, "A2", 2) == 0) + { + if (id[4] == '-' && id[6] == '-' && id[8] == '-') + { + tr_snprintf(buf, buflen, "aria2 %c.%c.%c", id[3], id[5], id[7]); + } + else if (id[4] == '-' && id[7] == '-' && id[9] == '-') + { + tr_snprintf(buf, buflen, "aria2 %c.%c%c.%c", id[3], id[5], id[6], id[8]); + } + else + { + no_version(buf, buflen, "aria2"); + } + } + else if (strncmp(chid, "-BL", 3) == 0) + { + tr_snprintf(buf, buflen, "BitLord %c.%c.%c-%c%c", id[3], id[4], id[5], id[6], id[7]); + } /* Shad0w-style */ if (tr_str_is_empty(buf)) diff --git a/tests/libtransmission/clients-test.cc b/tests/libtransmission/clients-test.cc index b158aa7e1..5122add05 100644 --- a/tests/libtransmission/clients-test.cc +++ b/tests/libtransmission/clients-test.cc @@ -21,7 +21,7 @@ TEST(Client, clientForId) char const* expected_client; }; - auto const tests = std::array{ + auto const tests = std::array{ LocalTest{ "-BT791B-", "BitTorrent 7.9.1 (Beta)" }, { "-BT791\0-", "BitTorrent 7.9.1" }, { "-FC1013-", "FileCroc 1.0.1.3" }, @@ -60,7 +60,16 @@ TEST(Client, clientForId) { "-I\05O\x08\x03\x01-", "-I%05O%08%03%01-" }, { "\x65\x78\x62\x63\x00\x38\x7A\x44\x63\x10\x2D\x6E\x9A\xD6\x72\x3B\x33\x9F\x35\xA9", "BitComet 0.56" }, - { "\x65\x78\x62\x63\x00\x38\x4C\x4F\x52\x44\x32\x00\x04\x8E\xCE\xD5\x7B\xD7\x10\x28", "BitLord 0.56" } + { "\x65\x78\x62\x63\x00\x38\x4C\x4F\x52\x44\x32\x00\x04\x8E\xCE\xD5\x7B\xD7\x10\x28", "BitLord 0.56" }, + + { "-UW110Q-", "\xc2\xb5Torrent Web 1.1.0" }, + { "-FW6830-", "FrostWire 6.8.3" }, + { "-BI2300-", "BiglyBT 2.3.0.0" }, + { "A2-1-18-8-", "aria2 1.18.8" }, + { "A2-1-2-0-", "aria2 1.2.0" }, + { "-BL24632", "BitLord 2.4.6-32" }, + { "-WW0007-", "WebTorrent 0.0.0.7" }, + { "-WS1000-", "HTTP Seed" } }; for (auto const& test : tests) From d57f575892dd426c800a59c2ab2761d19f1f70f9 Mon Sep 17 00:00:00 2001 From: Mark Deepwell Date: Sun, 25 Apr 2021 17:02:50 -0700 Subject: [PATCH 2/3] Retain full BitLord build number --- libtransmission/clients.c | 2 +- tests/libtransmission/clients-test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libtransmission/clients.c b/libtransmission/clients.c index 7581c8c03..866e3052c 100644 --- a/libtransmission/clients.c +++ b/libtransmission/clients.c @@ -826,7 +826,7 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) } else if (strncmp(chid, "-BL", 3) == 0) { - tr_snprintf(buf, buflen, "BitLord %c.%c.%c-%c%c", id[3], id[4], id[5], id[6], id[7]); + tr_snprintf(buf, buflen, "BitLord %c.%c.%c-%c%c%c", id[3], id[4], id[5], id[6], id[7], id[8]); } /* Shad0w-style */ diff --git a/tests/libtransmission/clients-test.cc b/tests/libtransmission/clients-test.cc index 5122add05..6ab5852ae 100644 --- a/tests/libtransmission/clients-test.cc +++ b/tests/libtransmission/clients-test.cc @@ -67,7 +67,7 @@ TEST(Client, clientForId) { "-BI2300-", "BiglyBT 2.3.0.0" }, { "A2-1-18-8-", "aria2 1.18.8" }, { "A2-1-2-0-", "aria2 1.2.0" }, - { "-BL24632", "BitLord 2.4.6-32" }, + { "-BL246326", "BitLord 2.4.6-326" }, // Style used after BitLord 0.59 { "-WW0007-", "WebTorrent 0.0.0.7" }, { "-WS1000-", "HTTP Seed" } }; From c7feedcf455bb311cc9d0a90c92c0fc8668ada4b Mon Sep 17 00:00:00 2001 From: Mark Deepwell Date: Tue, 11 May 2021 21:39:09 -0700 Subject: [PATCH 3/3] Support uTorrent Web with both azureus style and the one without the dash at the end --- libtransmission/clients.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libtransmission/clients.c b/libtransmission/clients.c index 866e3052c..08e2b3b33 100644 --- a/libtransmission/clients.c +++ b/libtransmission/clients.c @@ -234,6 +234,11 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) tr_snprintf(buf, buflen, "\xc2\xb5Torrent Embedded %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1), strint(id + 5, 1), getMnemonicEnd(id[6])); } + else if (strncmp(chid + 1, "UW", 2) == 0) + { + tr_snprintf(buf, buflen, "\xc2\xb5Torrent Web %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1), strint(id + 5, + 1), getMnemonicEnd(id[6])); + } /* */ else if (strncmp(chid + 1, "AZ", 2) == 0) { @@ -666,7 +671,7 @@ char* tr_clientForId(char* buf, size_t buflen, void const* id_in) else if (strncmp(chid + 1, "UW", 2) == 0) { tr_snprintf(buf, buflen, "\xc2\xb5Torrent Web %d.%d.%d%s", strint(id + 3, 1), strint(id + 4, 1), strint(id + 5, - 1), getMnemonicEnd(id[6])); + 2), getMnemonicEnd(id[7])); } if (!tr_str_is_empty(buf))