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 @@ @@ -20,6 +20,7 @@
- BUGFIX: The user can disable permanently recursive torrent download
- BUGFIX: Peer Exchange status is now correctly reported
- 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 number of torrents in transfers tab label
- COSMETIC: Simplified program preferences

8
src/bittorrent.cpp

@ -95,6 +95,7 @@ Bittorrent::Bittorrent() @@ -95,6 +95,7 @@ Bittorrent::Bittorrent()
version << VERSION_MINOR;
version << VERSION_BUGFIX;
version << VERSION_TYPE;
#ifdef CLIENT_USURPATION
QString peer_id = Preferences::getPeerID();
if(peer_id.size() != 2) peer_id = "qB";
if(peer_id != "qB") {
@ -110,6 +111,9 @@ Bittorrent::Bittorrent() @@ -110,6 +111,9 @@ Bittorrent::Bittorrent()
version.replace(i, ver.toInt());
}
}
#else
const QString peer_id = "qB";
#endif
// Construct session
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;
@ -407,6 +411,7 @@ void Bittorrent::configureSession() { @@ -407,6 +411,7 @@ void Bittorrent::configureSession() {
}
// * Session settings
session_settings sessionSettings;
#ifdef CLIENT_USURPATION
QString peer_id = Preferences::getPeerID();
if(peer_id.size() != 2) peer_id = "qB";
if(peer_id == "UT") {
@ -429,6 +434,9 @@ void Bittorrent::configureSession() { @@ -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;
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 { @@ -208,12 +208,14 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
Preferences::setLSDEnabled(m["lsd"].toBool());
if(m.contains("encryption"))
Preferences::setEncryptionSetting(m["encryption"].toInt());
#ifdef CLIENT_USURPATION
if(m.contains("peer_id"))
Preferences::setPeerID(m["peer_id"].toString());
if(m.contains("peer_version"))
Preferences::setClientVersion(m["peer_version"].toString());
if(m.contains("peer_build"))
Preferences::setClientBuild(m["peer_build"].toString());
#endif
// Proxy
if(m.contains("proxy_type"))
Preferences::setPeerProxyType(m["proxy_type"].toInt());
@ -295,9 +297,11 @@ QVariantMap EventManager::getGlobalPreferences() const { @@ -295,9 +297,11 @@ QVariantMap EventManager::getGlobalPreferences() const {
data["pex"] = Preferences::isPeXEnabled();
data["lsd"] = Preferences::isLSDEnabled();
data["encryption"] = Preferences::getEncryptionSetting();
#ifdef CLIENT_USURPATION
data["peer_id"] = Preferences::getPeerID();
data["peer_version"] = Preferences::getClientVersion();
data["peer_build"] = Preferences::getClientBuild();
#endif
// Proxy
data["proxy_type"] = Preferences::getPeerProxyType();
data["proxy_ip"] = Preferences::getPeerProxyIp();

11
src/options_imp.cpp

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

3
src/src.pro

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

4
src/ui/options.ui

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

22
src/webui/preferences_content.html

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

Loading…
Cancel
Save