Randomly choose an SDL server and recognize malicious domain without prefix
This commit is contained in:
@@ -155,9 +155,21 @@ void ConnectionLoader::doAutoConnect()
|
|||||||
QString response = litelib_process_response(resp);
|
QString response = litelib_process_response(resp);
|
||||||
|
|
||||||
if (response.toUpper().trimmed() != "OK") {
|
if (response.toUpper().trimmed() != "OK") {
|
||||||
QString resp = "Error when connecting to " + config->server + ": " + response;
|
config->server = Settings::getRandomServer();
|
||||||
showError(resp);
|
|
||||||
return;
|
resp = litelib_initialize_existing(
|
||||||
|
config->dangerous,
|
||||||
|
config->server.toStdString().c_str()
|
||||||
|
);
|
||||||
|
response = litelib_process_response(resp);
|
||||||
|
|
||||||
|
if (response.toUpper().trimmed() != "OK") {
|
||||||
|
QString resp = "Error when connecting to " + config->server + ": " + response;
|
||||||
|
showError(resp);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
qDebug() << __func__ << ": Successfully connected to random server: " << config->server << " !!!";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug() << __func__ << ": Successfully connected to " << config->server << " !!!";
|
qDebug() << __func__ << ": Successfully connected to " << config->server << " !!!";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2040,7 +2040,7 @@ void Controller::shutdownhushd()
|
|||||||
connD.topIcon->setMovie(movie2);
|
connD.topIcon->setMovie(movie2);
|
||||||
movie2->start();
|
movie2->start();
|
||||||
connD.status->setText(QObject::tr("Please wait for SilentDragonLite to exit"));
|
connD.status->setText(QObject::tr("Please wait for SilentDragonLite to exit"));
|
||||||
connD.statusDetail->setText(QObject::tr("Waiting for hushd to exit"));
|
connD.statusDetail->setText(QObject::tr("Please wait for SilentDragonLite to exit"));
|
||||||
} else {
|
} else {
|
||||||
QMovie *movie1 = new QMovie(":/img/res/silentdragonlite-animated-startup.gif");;
|
QMovie *movie1 = new QMovie(":/img/res/silentdragonlite-animated-startup.gif");;
|
||||||
movie1->setScaledSize(size);
|
movie1->setScaledSize(size);
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ Config Settings::getSettings() {
|
|||||||
|
|
||||||
// this domain is stolen and malicious!
|
// this domain is stolen and malicious!
|
||||||
// More info: https://git.hush.is/hush/fraud/#gilardh
|
// More info: https://git.hush.is/hush/fraud/#gilardh
|
||||||
auto malicious = "https://lite.myhush.org";
|
auto malicious = "lite.myhush.org";
|
||||||
auto server = s.value("connection/server").toString();
|
auto server = s.value("connection/server").toString();
|
||||||
bool sticky = s.value("connection/stickyServer").toBool();
|
bool sticky = s.value("connection/stickyServer").toBool();
|
||||||
bool torOnly = s.value("connection/torOnly").toBool();
|
bool torOnly = s.value("connection/torOnly").toBool();
|
||||||
|
|
||||||
// Users that have old configs generated from old SDLs will have this hostname
|
// Users that have old configs generated from old SDLs will have this hostname
|
||||||
if(server == malicious) {
|
if(server == malicious or server == (QString("https://") + malicious)) {
|
||||||
qDebug() << "Replacing malicious SDL server with " << server;
|
qDebug() << "Replacing malicious SDL server with " << server;
|
||||||
server = "https://lite.hush.is";
|
server = getRandomServer();
|
||||||
s.setValue("connection/server", server);
|
s.setValue("connection/server", server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,24 +294,27 @@ void Settings::saveRestoreTableHeader(QTableView* table, QDialog* d, QString tab
|
|||||||
|
|
||||||
QString Settings::getRandomServer() {
|
QString Settings::getRandomServer() {
|
||||||
qDebug() << __func__;
|
qDebug() << __func__;
|
||||||
|
// The more servers from different TLDs, the better
|
||||||
|
QList<QString> servers = {
|
||||||
|
"https://lite.hush.is",
|
||||||
|
"https://devo.crabdance.com",
|
||||||
|
//"https://thisisdown1.example.com",
|
||||||
|
//"https://thisisdown2.example.com",
|
||||||
|
//"https://thisisdown3.example.com",
|
||||||
|
//"https://thisisdown4.example.com",
|
||||||
|
//"https://thisisdown5.example.com",
|
||||||
|
"https://lite.hush.community",
|
||||||
|
};
|
||||||
|
|
||||||
// we don't need cryptographic random-ness, but we want
|
// we don't need cryptographic random-ness, but we want
|
||||||
// clients to never get "stuck" with the same server, which
|
// clients to never get "stuck" with the same server, which
|
||||||
// prevents various attacks
|
// prevents various attacks
|
||||||
QList<QString> servers;
|
int x = rand() % servers.size();
|
||||||
//TODO: This should be a much larger list which we randomly choose from
|
|
||||||
servers[0] = "https://lite.hush.is";
|
|
||||||
servers[1] = "https://devo.crabdance.com";
|
|
||||||
servers[2] = "https://lite.hush.community";
|
|
||||||
//servers[3] = "https://hush.leto.net";
|
|
||||||
//servers[4] = "https://milktoast.attackingzcash.com";
|
|
||||||
|
|
||||||
// start at a random place in the list
|
|
||||||
int x = rand() % servers.size();
|
|
||||||
auto server = servers[x];
|
auto server = servers[x];
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
|
|
||||||
// We try every server,in order, starting from a random place in the list
|
// We try every server,in order, starting from a random place in the list
|
||||||
while (tries <= servers.size() ) {
|
while (tries < servers.size() ) {
|
||||||
qDebug() << "Checking if lite server " << server << " is a alive, try=" << tries;
|
qDebug() << "Checking if lite server " << server << " is a alive, try=" << tries;
|
||||||
char* resp = litelib_initialize_existing(false, server.toStdString().c_str());
|
char* resp = litelib_initialize_existing(false, server.toStdString().c_str());
|
||||||
QString response = litelib_process_response(resp);
|
QString response = litelib_process_response(resp);
|
||||||
@@ -321,8 +324,9 @@ QString Settings::getRandomServer() {
|
|||||||
qDebug() << "Choosing lite server " << server;
|
qDebug() << "Choosing lite server " << server;
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
server = servers[++x % servers.size()];
|
x++;
|
||||||
|
x = x % servers.size();
|
||||||
|
server = servers[x];
|
||||||
tries++;
|
tries++;
|
||||||
}
|
}
|
||||||
return server;
|
return server;
|
||||||
|
|||||||
Reference in New Issue
Block a user