Browse Source

BUGFIX: Removed client spoofing feature to avoid tracker blacklisting

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
3caf473424
  1. 1
      Changelog
  2. 8
      src/bittorrent.cpp
  3. 4
      src/eventmanager.cpp
  4. 11
      src/options_imp.cpp
  5. 3
      src/src.pro
  6. 4
      src/ui/options.ui
  7. 22
      src/webui/preferences_content.html

1
Changelog

@ -20,6 +20,7 @@
- BUGFIX: The user can disable permanently recursive torrent download - BUGFIX: The user can disable permanently recursive torrent download
- BUGFIX: Peer Exchange status is now correctly reported - BUGFIX: Peer Exchange status is now correctly reported
- BUGFIX: Use an INI file instead of the registry on Windows (More reliable) - BUGFIX: Use an INI file instead of the registry on Windows (More reliable)
- BUGFIX: Removed client spoofing feature to avoid tracker blacklisting
- COSMETIC: Display peers country name in tooltip - COSMETIC: Display peers country name in tooltip
- COSMETIC: Display number of torrents in transfers tab label - COSMETIC: Display number of torrents in transfers tab label
- COSMETIC: Simplified program preferences - COSMETIC: Simplified program preferences

8
src/bittorrent.cpp

@ -95,6 +95,7 @@ Bittorrent::Bittorrent()
version << VERSION_MINOR; version << VERSION_MINOR;
version << VERSION_BUGFIX; version << VERSION_BUGFIX;
version << VERSION_TYPE; version << VERSION_TYPE;
#ifdef CLIENT_USURPATION
QString peer_id = Preferences::getPeerID(); QString peer_id = Preferences::getPeerID();
if(peer_id.size() != 2) peer_id = "qB"; if(peer_id.size() != 2) peer_id = "qB";
if(peer_id != "qB") { if(peer_id != "qB") {
@ -110,6 +111,9 @@ Bittorrent::Bittorrent()
version.replace(i, ver.toInt()); version.replace(i, ver.toInt());
} }
} }
#else
const QString peer_id = "qB";
#endif
// Construct session // Construct session
s = new session(fingerprint(peer_id.toLocal8Bit().constData(), version.at(0), version.at(1), version.at(2), version.at(3)), 0); s = new session(fingerprint(peer_id.toLocal8Bit().constData(), version.at(0), version.at(1), version.at(2), version.at(3)), 0);
std::cout << "Peer ID: " << fingerprint(peer_id.toLocal8Bit().constData(), version.at(0), version.at(1), version.at(2), version.at(3)).to_string() << std::endl; std::cout << "Peer ID: " << fingerprint(peer_id.toLocal8Bit().constData(), version.at(0), version.at(1), version.at(2), version.at(3)).to_string() << std::endl;
@ -407,6 +411,7 @@ void Bittorrent::configureSession() {
} }
// * Session settings // * Session settings
session_settings sessionSettings; session_settings sessionSettings;
#ifdef CLIENT_USURPATION
QString peer_id = Preferences::getPeerID(); QString peer_id = Preferences::getPeerID();
if(peer_id.size() != 2) peer_id = "qB"; if(peer_id.size() != 2) peer_id = "qB";
if(peer_id == "UT") { if(peer_id == "UT") {
@ -429,6 +434,9 @@ void Bittorrent::configureSession() {
} }
} }
} }
#else
sessionSettings.user_agent = "qBittorrent "VERSION;
#endif
std::cout << "HTTP user agent is " << sessionSettings.user_agent << std::endl; std::cout << "HTTP user agent is " << sessionSettings.user_agent << std::endl;
addConsoleMessage(tr("HTTP user agent is %1").arg(misc::toQString(sessionSettings.user_agent))); addConsoleMessage(tr("HTTP user agent is %1").arg(misc::toQString(sessionSettings.user_agent)));

4
src/eventmanager.cpp

@ -208,12 +208,14 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
Preferences::setLSDEnabled(m["lsd"].toBool()); Preferences::setLSDEnabled(m["lsd"].toBool());
if(m.contains("encryption")) if(m.contains("encryption"))
Preferences::setEncryptionSetting(m["encryption"].toInt()); Preferences::setEncryptionSetting(m["encryption"].toInt());
#ifdef CLIENT_USURPATION
if(m.contains("peer_id")) if(m.contains("peer_id"))
Preferences::setPeerID(m["peer_id"].toString()); Preferences::setPeerID(m["peer_id"].toString());
if(m.contains("peer_version")) if(m.contains("peer_version"))
Preferences::setClientVersion(m["peer_version"].toString()); Preferences::setClientVersion(m["peer_version"].toString());
if(m.contains("peer_build")) if(m.contains("peer_build"))
Preferences::setClientBuild(m["peer_build"].toString()); Preferences::setClientBuild(m["peer_build"].toString());
#endif
// Proxy // Proxy
if(m.contains("proxy_type")) if(m.contains("proxy_type"))
Preferences::setPeerProxyType(m["proxy_type"].toInt()); Preferences::setPeerProxyType(m["proxy_type"].toInt());
@ -295,9 +297,11 @@ QVariantMap EventManager::getGlobalPreferences() const {
data["pex"] = Preferences::isPeXEnabled(); data["pex"] = Preferences::isPeXEnabled();
data["lsd"] = Preferences::isLSDEnabled(); data["lsd"] = Preferences::isLSDEnabled();
data["encryption"] = Preferences::getEncryptionSetting(); data["encryption"] = Preferences::getEncryptionSetting();
#ifdef CLIENT_USURPATION
data["peer_id"] = Preferences::getPeerID(); data["peer_id"] = Preferences::getPeerID();
data["peer_version"] = Preferences::getClientVersion(); data["peer_version"] = Preferences::getClientVersion();
data["peer_build"] = Preferences::getClientBuild(); data["peer_build"] = Preferences::getClientBuild();
#endif
// Proxy // Proxy
data["proxy_type"] = Preferences::getPeerProxyType(); data["proxy_type"] = Preferences::getPeerProxyType();
data["proxy_ip"] = Preferences::getPeerProxyIp(); data["proxy_ip"] = Preferences::getPeerProxyIp();

11
src/options_imp.cpp

@ -140,7 +140,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// Load week days (scheduler) // Load week days (scheduler)
for(uint i=1; i<=7; ++i) { for(uint i=1; i<=7; ++i) {
#ifdef QT_4_5 #if QT_VERSION >= 0x040500
schedule_days->addItem(QDate::longDayName(i, QDate::StandaloneFormat)); schedule_days->addItem(QDate::longDayName(i, QDate::StandaloneFormat));
#else #else
schedule_days->addItem(QDate::longDayName(i)); schedule_days->addItem(QDate::longDayName(i));
@ -271,6 +271,11 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
adv_layout->addWidget(advancedSettings); adv_layout->addWidget(advancedSettings);
scrollArea_advanced->setLayout(adv_layout); scrollArea_advanced->setLayout(adv_layout);
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton())); connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
#ifndef CLIENT_USURPATION
groupBox_usurpation->setVisible(false);
#endif
// Adapt size // Adapt size
show(); show();
loadWindowState(); loadWindowState();
@ -447,6 +452,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
settings.setValue(QString::fromUtf8("sameDHTPortAsBT"), isDHTPortSameAsBT()); settings.setValue(QString::fromUtf8("sameDHTPortAsBT"), isDHTPortSameAsBT());
settings.setValue(QString::fromUtf8("DHTPort"), getDHTPort()); settings.setValue(QString::fromUtf8("DHTPort"), getDHTPort());
settings.setValue(QString::fromUtf8("LSD"), isLSDEnabled()); settings.setValue(QString::fromUtf8("LSD"), isLSDEnabled());
#ifndef CLIENT_USURPATION
// Peer ID usurpation // Peer ID usurpation
switch(comboPeerID->currentIndex()) { switch(comboPeerID->currentIndex()) {
case 3: // KTorrent case 3: // KTorrent
@ -465,6 +471,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
default: //qBittorrent default: //qBittorrent
Preferences::setPeerID("qB"); Preferences::setPeerID("qB");
} }
#endif
settings.setValue(QString::fromUtf8("Encryption"), getEncryptionSetting()); settings.setValue(QString::fromUtf8("Encryption"), getEncryptionSetting());
Preferences::setMaxRatio(getMaxRatio()); Preferences::setMaxRatio(getMaxRatio());
Preferences::setMaxRatioAction(comboRatioLimitAct->currentIndex()); Preferences::setMaxRatioAction(comboRatioLimitAct->currentIndex());
@ -755,6 +762,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
checkPeX->setChecked(Preferences::isPeXEnabled()); checkPeX->setChecked(Preferences::isPeXEnabled());
checkLSD->setChecked(Preferences::isLSDEnabled()); checkLSD->setChecked(Preferences::isLSDEnabled());
// Peer ID usurpation // Peer ID usurpation
#ifdef CLIENT_USURPATION
QString peer_id = Preferences::getPeerID(); QString peer_id = Preferences::getPeerID();
if(peer_id == "UT") { if(peer_id == "UT") {
// uTorrent // uTorrent
@ -780,6 +788,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
} }
} }
} }
#endif
comboEncryption->setCurrentIndex(Preferences::getEncryptionSetting()); comboEncryption->setCurrentIndex(Preferences::getEncryptionSetting());
// Ratio limit // Ratio limit
floatValue = Preferences::getMaxRatio(); floatValue = Preferences::getMaxRatio();

3
src/src.pro

@ -421,4 +421,7 @@ SOURCES += main.cpp \
} }
} }
# NO CLIENT USURPATION
# DEFINES += CLIENT_USURPATION
DESTDIR = . DESTDIR = .

4
src/ui/options.ui

@ -1570,7 +1570,7 @@ QGroupBox {
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-106</y> <y>0</y>
<width>552</width> <width>552</width>
<height>496</height> <height>496</height>
</rect> </rect>
@ -1748,7 +1748,7 @@ QGroupBox {
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_5"> <widget class="QGroupBox" name="groupBox_usurpation">
<property name="title"> <property name="title">
<string>Client whitelisting workaround</string> <string>Client whitelisting workaround</string>
</property> </property>

22
src/webui/preferences_content.html

@ -75,6 +75,7 @@
</select><br/> </select><br/>
</div> </div>
</fieldset> </fieldset>
<!--
<fieldset> <fieldset>
<legend><b>_(Client whitelisting workaround)</b></legend> <legend><b>_(Client whitelisting workaround)</b></legend>
_(Identify as:) _(Identify as:)
@ -90,6 +91,7 @@
_(Build:) <input type="text" id="peer_build_text" style="width: 5em;" /> _(Build:) <input type="text" id="peer_build_text" style="width: 5em;" />
<br/> <br/>
</fieldset> </fieldset>
-->
</div> </div>
<div id="DownloadsTab" class="PrefTab invisible"> <div id="DownloadsTab" class="PrefTab invisible">
@ -348,9 +350,9 @@
var lsd = 0; var lsd = 0;
if($defined($('lsd_checkbox').get('checked')) && $('lsd_checkbox').get('checked')) if($defined($('lsd_checkbox').get('checked')) && $('lsd_checkbox').get('checked'))
lsd = 1; lsd = 1;
var peer_id = $('peer_id_select').get('value'); //var peer_id = $('peer_id_select').get('value');
var peer_version = $('peer_version_text').get('value'); //var peer_version = $('peer_version_text').get('value');
var peer_build = $('peer_build_text').get('value'); //var peer_build = $('peer_build_text').get('value');
// Downloads // Downloads
var save_path = $("savepath_text").get('value'); var save_path = $("savepath_text").get('value');
var temp_path_enabled = 0 var temp_path_enabled = 0
@ -474,9 +476,9 @@
dict.set('pex', pex); dict.set('pex', pex);
dict.set('lsd', lsd); dict.set('lsd', lsd);
dict.set('encryption', $('encryption_select').get('value')); dict.set('encryption', $('encryption_select').get('value'));
dict.set('peer_id', peer_id); //dict.set('peer_id', peer_id);
dict.set('peer_version', peer_version); //dict.set('peer_version', peer_version);
dict.set('peer_build', peer_build); //dict.set('peer_build', peer_build);
// Downloads // Downloads
dict.set('save_path', save_path); dict.set('save_path', save_path);
dict.set('temp_path_enabled', temp_path_enabled); dict.set('temp_path_enabled', temp_path_enabled);
@ -850,10 +852,10 @@ loadPreferences = function() {
} }
var encryption = pref.encryption.toInt(); var encryption = pref.encryption.toInt();
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', ''); $('encryption_select').getChildren('option')[encryption].setAttribute('selected', '');
$('peer_id_select').set('value', pref.peer_id); //$('peer_id_select').set('value', pref.peer_id);
updateSpoofingSettings(); //updateSpoofingSettings();
$('peer_version_text').set('value', pref.peer_version); //$('peer_version_text').set('value', pref.peer_version);
$('peer_build_text').set('value', pref.peer_build); //$('peer_build_text').set('value', pref.peer_build);
// Downloads // Downloads
var save_path = pref.save_path; var save_path = pref.save_path;
$("savepath_text").set('value', save_path); $("savepath_text").set('value', save_path);

Loading…
Cancel
Save