Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var mobileHeaders = {
  2.     "X-Requested-With": "com.valvesoftware.android.steam.community",
  3.     Referer: "https://steamcommunity.com/mobilelogin?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client",
  4.     "User-Agent": "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; Google Nexus 4 - 4.1.1 - API 16 - 768x1280 Build/JRO03S) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
  5.     Accept: "text/javascript, text/html, application/xml, text/xml, */*"
  6. };
  7.  
  8. this._setCookie(Request.cookie("mobileClientVersion=0 (2.1.3)"));
  9.  
  10. this._setCookie(Request.cookie("mobileClient=android"));
  11.  
  12. this.httpRequestPost("https://steamcommunity.com/login/getrsakey/", {
  13.     form: {
  14.         username: details.accountName
  15.     },
  16.     headers: mobileHeaders,
  17.     json: true
  18. }, function(a, b, c) {
  19.     if (a) {
  20.         deleteMobileCookies();
  21.         callback(a);
  22.         return;
  23.     }
  24.     if (!c.publickey_mod || !c.publickey_exp) {
  25.         deleteMobileCookies();
  26.         callback(new Error("Invalid RSA key received"));
  27.         return;
  28.     }
  29.     var d = new RSA();
  30.     d.setPublic(c.publickey_mod, c.publickey_exp);
  31.     self.httpRequestPost({
  32.         uri: "https://steamcommunity.com/login/dologin/",
  33.         json: true,
  34.         form: {
  35.             captcha_text: details.captcha || "",
  36.             captchagid: self._captchaGid,
  37.             emailauth: details.authCode || "",
  38.             emailsteamid: "",
  39.             password: hex2b64(d.encrypt(details.password)),
  40.             remember_login: "true",
  41.             rsatimestamp: c.timestamp,
  42.             twofactorcode: details.twoFactorCode || "",
  43.             username: details.accountName,
  44.             oauth_client_id: "DE45CD61",
  45.             oauth_scope: "read_profile write_profile read_client write_client",
  46.             loginfriendlyname: "#login_emailauth_friendlyname_mobile",
  47.             donotcache: Date.now()
  48.         },
  49.         headers: mobileHeaders
  50.     }, function(a, b, c) {
  51.         deleteMobileCookies();
  52.         if (a) {
  53.             callback(a);
  54.             return;
  55.         }
  56.         var d;
  57.         if (!c.success && c.emailauth_needed) {
  58.             d = new Error("SteamGuard");
  59.             d.emaildomain = c.emaildomain;
  60.             callback(d);
  61.         } else if (!c.success && c.requires_twofactor) callback(new Error("SteamGuardMobile")); else if (!c.success && c.captcha_needed && c.message.match(/Please verify your humanity/)) {
  62.             d = new Error("CAPTCHA");
  63.             d.captchaurl = "https://steamcommunity.com/login/rendercaptcha/?gid=" + c.captcha_gid;
  64.             self._captchaGid = c.captcha_gid;
  65.             callback(d);
  66.         } else if (!c.success) callback(new Error(c.message || "Unknown error")); else if (!c.oauth) callback(new Error("Malformed response")); else {
  67.             var e = generateSessionID();
  68.             var f = JSON.parse(c.oauth);
  69.             self._setCookie(Request.cookie("sessionid=" + e));
  70.             self.steamID = new SteamID(f.steamid);
  71.             self.oAuthToken = f.oauth_token;
  72.             var g = self._jar.getCookieString("https://steamcommunity.com").split(";").map(function(a) {
  73.                 return a.trim();
  74.             });
  75.             var h = null;
  76.             for (var i = 0; i < g.length; i++) {
  77.                 var j = g[i].split("=");
  78.                 if (j[0] == "steamMachineAuth" + self.steamID) {
  79.                     h = self.steamID.toString() + "||" + decodeURIComponent(j[1]);
  80.                     break;
  81.                 }
  82.             }
  83.             self.setCookies(g);
  84.             callback(null, e, g, h, f.oauth_token);
  85.         }
  86.     }, "steamcommunity");
  87. }, "steamcommunity");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement