diff options
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 41 | ||||
-rw-r--r-- | protocols/FacebookRM/src/version.h | 2 |
2 files changed, 32 insertions, 11 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index ad9928c9e4..66e931bf14 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -744,6 +744,8 @@ bool facebook_client::login(const char *username, const char *password) if (!cookies["datr"].empty()) parent->setString(FACEBOOK_KEY_DEVICE_ID, cookies["datr"].c_str()); + bool scanComputerRequest = false; + if (resp.code == HTTP_CODE_FOUND && resp.headers.find("Location") != resp.headers.end()) { std::string location = resp.headers["Location"]; @@ -817,23 +819,37 @@ bool facebook_client::login(const char *username, const char *password) } else if (resp.data.find("name=\"submit[OK]\"") != std::string::npos) { - + // TODO: not sure this branch could happen anymore inner_data = "submit[OK]=OK"; inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\""); inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"")); resp = flap(REQUEST_SETUP_MACHINE, &inner_data); + } + else if (resp.data.find("name=\"submit[Get%20Started]\"") != std::string::npos) { + // Facebook things that computer was infected by malware and needs cleaning + parent->debugLogA("!!! Facebook requires computer scan."); + scanComputerRequest = true; - if (resp.data.find("security-essentials") != std::string::npos) { - // Computer was probably infected by malware and needs cleaning (actually this may happen because Miranda doesn't support FB's captcha) - inner_data = "submit[Continue]=Continue"; - inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\""); - inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"")); + // Step 1: Get started + inner_data = "submit[Get%20Started]=Get%20Started"; + inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\""); + inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"")); - // Mark that used cleaned his computer already, because he must confirm it anyway to be able to continue - inner_data += "&confirm=1"; + resp = flap(REQUEST_SETUP_MACHINE, &inner_data); - resp = flap(REQUEST_SETUP_MACHINE, &inner_data); - } + // Step 2: Download F-Secure Online Scanner (we're not really downloading anything) + inner_data = "submit[Download]=Download"; + inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\""); + inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"")); + + resp = flap(REQUEST_SETUP_MACHINE, &inner_data); + + // Step 3: Skip scanning and try to do Complete login + inner_data = "submit[Complete%20Login]=Complete%20Login"; + inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\""); + inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"")); + + resp = flap(REQUEST_SETUP_MACHINE, &inner_data); } } } @@ -858,6 +874,11 @@ bool facebook_client::login(const char *username, const char *password) return handle_error("login", FORCE_QUIT); } + if (scanComputerRequest) { + // FIXME: remove this message when someone confirm that it works... + client_notify(TranslateT("Facebook required computer cleaning and plugin correctly skipped it. Please report this to the plugin developer!")); + } + // Get and notify error message std::string error = utils::text::source_get_value(&resp.data, 4, "login_error_box", "<div", ">", "</div>"); if (error.empty()) diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h index 103b6a9a5b..bcf56532d2 100644 --- a/protocols/FacebookRM/src/version.h +++ b/protocols/FacebookRM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 10
-#define __BUILD_NUM 5
+#define __BUILD_NUM 6
#include <stdver.h>
|