TapSwapBot icon indicating copy to clipboard operation
TapSwapBot copied to clipboard

Unknown error while getting Access Token: 400, message='Bad Request', url=URL('https://api.tapswap.ai/api/account/login') | Response text: {"statusCode":400,"message":"invalid_request[1]"}

Open faerhjio0gase opened this issue 1 year ago • 56 comments

Unknown error while getting Access Token: 400, message='Bad Request', url=URL('https://api.tapswap.ai/api/account/login') | Response text: {"statusCode":400,"message":"invalid_request[1]"}

how to fix?

faerhjio0gase avatar Jun 13 '24 14:06 faerhjio0gase

me too!

MrChiz avatar Jun 13 '24 14:06 MrChiz

the chq code has been changed there is no i, j variable avaialbe anymore.

the new code is like this. I don't know how the calculations are done. I hope this helps.

function b(c, d) {
  var e = a();
  return (
    (b = function (f, g) {
      f = f - 0x91;
      var h = e[f];
      return h;
    }),
    b(c, d)
  );
}
(function (c, d) {
  var q = b,
    e = c();
  while (!![]) {
    try {
      var f =
        (-parseInt(q(0x91)) / 0x1) * (-parseInt(q(0x92)) / 0x2) +
        (parseInt(q(0x93)) / 0x3) * (-parseInt(q(0x94)) / 0x4) +
        -parseInt(q(0x95)) / 0x5 +
        (-parseInt(q(0x96)) / 0x6) * (parseInt(q(0x97)) / 0x7) +
        parseInt(q(0x98)) / 0x8 +
        (parseInt(q(0x99)) / 0x9) * (-parseInt(q(0x9a)) / 0xa) +
        (-parseInt(q(0x9b)) / 0xb) * (-parseInt(q(0x9c)) / 0xc);
      if (f === d) break;
      else e["push"](e["shift"]());
    } catch (g) {
      e["push"](e["shift"]());
    }
  }
})(a, 0x9dfe5),
  (function () {
    var e = {};
    (e["tZdDc"] = "getAttribute"),
      (e["eaDMY"] = "innerHTML"),
      (e["vuoQG"] = "_chr_"),
      (e["WsGdu"] = "getElementById"),
      (e["HIoFC"] = "_qu_0"),
      (e["MRUbH"] = "_ww_2");
    var f = e,
      h = ("3|2|10|4|9|5|11|12|6" + "|1|8|0|7")["split"]("|"),
      i = 0x0;
    while (!![]) {
      switch (h[i++]) {
        case "0":
          l %= 0x6a56d;
          continue;
        case "1":
          l *= l;
          continue;
        case "2":
          var j = document;
          continue;
        case "3":
          try {
            eval("document['getElementById'];");
          } catch {
            return 0xc0febabe;
          }
          continue;
        case "4":
          var k = f["tZdDc"];
          continue;
        case "5":
          m[f["eaDMY"]] =
            '<div><div id="_qu_0"' +
            ' _v="79428"><div id=' +
            '"_ZB_1" _v="12897"><' +
            'div id="_ww_2" _v="4' +
            '7434"><div id="_dP_3' +
            '" _v="75893"><div id' +
            '="_SQ_4" _v="28108">' +
            "</div></div></div></" +
            "div></div></div>";
          continue;
        case "6":
          var l = +o;
          continue;
        case "7":
          return l;
        case "8":
          l *= +p;
          continue;
        case "9":
          var m = j[n](f["vuoQG"]);
          continue;
        case "10":
          var n = f["WsGdu"];
          continue;
        case "11":
          var o = j[n](f["HIoFC"])[k]("_v");
          continue;
        case "12":
          var p = j[n](f["MRUbH"])[k]("_v");
          continue;
      }
      break;
    }
  })();
function a() {
  var r = [
    "5830280bKzAqY",
    "79428dwKVnZ",
    "595bFbrVd",
    "6611848Sotjfw",
    "351egXLYB",
    "155190PDoWFb",
    "1859803cTfdbS",
    "168xHDCLn",
    "82835wxVYsa",
    "10NazwBN",
    "1110UcppwP",
    "692DJzhLy",
  ];
  a = function () {
    return r;
  };
  return a();
}

ErfanPY avatar Jun 13 '24 14:06 ErfanPY

the chq code has been changed there is no i, j variable avaialbe anymore.

the new code is like this. I don't know how the calculations are done. I hope this helps.

function b(c, d) {
  var e = a();
  return (
    (b = function (f, g) {
      f = f - 0x91;
      var h = e[f];
      return h;
    }),
    b(c, d)
  );
}
(function (c, d) {
  var q = b,
    e = c();
  while (!![]) {
    try {
      var f =
        (-parseInt(q(0x91)) / 0x1) * (-parseInt(q(0x92)) / 0x2) +
        (parseInt(q(0x93)) / 0x3) * (-parseInt(q(0x94)) / 0x4) +
        -parseInt(q(0x95)) / 0x5 +
        (-parseInt(q(0x96)) / 0x6) * (parseInt(q(0x97)) / 0x7) +
        parseInt(q(0x98)) / 0x8 +
        (parseInt(q(0x99)) / 0x9) * (-parseInt(q(0x9a)) / 0xa) +
        (-parseInt(q(0x9b)) / 0xb) * (-parseInt(q(0x9c)) / 0xc);
      if (f === d) break;
      else e["push"](e["shift"]());
    } catch (g) {
      e["push"](e["shift"]());
    }
  }
})(a, 0x9dfe5),
  (function () {
    var e = {};
    (e["tZdDc"] = "getAttribute"),
      (e["eaDMY"] = "innerHTML"),
      (e["vuoQG"] = "_chr_"),
      (e["WsGdu"] = "getElementById"),
      (e["HIoFC"] = "_qu_0"),
      (e["MRUbH"] = "_ww_2");
    var f = e,
      h = ("3|2|10|4|9|5|11|12|6" + "|1|8|0|7")["split"]("|"),
      i = 0x0;
    while (!![]) {
      switch (h[i++]) {
        case "0":
          l %= 0x6a56d;
          continue;
        case "1":
          l *= l;
          continue;
        case "2":
          var j = document;
          continue;
        case "3":
          try {
            eval("document['getElementById'];");
          } catch {
            return 0xc0febabe;
          }
          continue;
        case "4":
          var k = f["tZdDc"];
          continue;
        case "5":
          m[f["eaDMY"]] =
            '<div><div id="_qu_0"' +
            ' _v="79428"><div id=' +
            '"_ZB_1" _v="12897"><' +
            'div id="_ww_2" _v="4' +
            '7434"><div id="_dP_3' +
            '" _v="75893"><div id' +
            '="_SQ_4" _v="28108">' +
            "</div></div></div></" +
            "div></div></div>";
          continue;
        case "6":
          var l = +o;
          continue;
        case "7":
          return l;
        case "8":
          l *= +p;
          continue;
        case "9":
          var m = j[n](f["vuoQG"]);
          continue;
        case "10":
          var n = f["WsGdu"];
          continue;
        case "11":
          var o = j[n](f["HIoFC"])[k]("_v");
          continue;
        case "12":
          var p = j[n](f["MRUbH"])[k]("_v");
          continue;
      }
      break;
    }
  })();
function a() {
  var r = [
    "5830280bKzAqY",
    "79428dwKVnZ",
    "595bFbrVd",
    "6611848Sotjfw",
    "351egXLYB",
    "155190PDoWFb",
    "1859803cTfdbS",
    "168xHDCLn",
    "82835wxVYsa",
    "10NazwBN",
    "1110UcppwP",
    "692DJzhLy",
  ];
  a = function () {
    return r;
  };
  return a();
}

where i should replace it?

suckarata avatar Jun 13 '24 15:06 suckarata

Hahahaha, the sweetness! Now the code changes every time ;)

Pass your CHQ, to get the CHR! Example: https://insight.toonsway.com/sweetness.php?chq=fbe8f3fee9f4f2f3bdfcb5b4e6ebfcefbdefa0c6baaeaaacafafadadf7e4cef1cdd6bab1baaaa9acafaaaad5fcdccbd6c9bab1baafaba5adadaeadd4c7f5e7e8f5bab1baafa5aaaeaaabc8f3c7d7f4f0bab1baa5eeedf5e4fadbbab1baacaca4afa8aca8c9f9e9d1d0ccbab1baa9afe5c9cdced7f4bab1baaba4a9aaafa4f4daebced5f8bab1baa5c4d9c5daedefbab1baa5acaba8aeafafdbdeedc9cac5bac0a6fca0fbe8f3fee9f4f2f3b5b4e6eff8e9e8eff3bdefa6e0a6eff8e9e8eff3bdfcb5b4a6e0fbe8f3fee9f4f2f3bdffb5feb1f9b4e6ebfcefbdf8a0fcb5b4a6eff8e9e8eff3bdffa0fbe8f3fee9f4f2f3b5fbb1fab4e6fba0fbb0ade5acafffa6ebfcefbdf5a0f8c6fbc0a6eff8e9e8eff3bdf5a6e0b1ffb5feb1f9b4a6e0b5fbe8f3fee9f4f2f3b5feb1f9b4e6ebfcefbdeca0ffb1f8a0feb5b4a6eaf5f4f1f8b5bcbcc6c0b4e6e9efe4e6ebfcefbdfba0edfcefeef8d4f3e9b5ecb5ade5acafffb4b4b2ade5acb6b0edfcefeef8d4f3e9b5ecb5ade5acaffeb4b4b2ade5afb6edfcefeef8d4f3e9b5ecb5ade5acaff9b4b4b2ade5aeb7b5b0edfcefeef8d4f3e9b5ecb5ade5acaff8b4b4b2ade5a9b4b6edfcefeef8d4f3e9b5ecb5ade5acaffbb4b4b2ade5a8b6b0edfcefeef8d4f3e9b5ecb5ade5acaeadb4b4b2ade5abb7b5b0edfcefeef8d4f3e9b5ecb5ade5acaeacb4b4b2ade5aab4b6edfcefeef8d4f3e9b5ecb5ade5acaeafb4b4b2ade5a5b7b5edfcefeef8d4f3e9b5ecb5ade5acaeaeb4b4b2ade5a4b4b6b0edfcefeef8d4f3e9b5ecb5ade5acaea9b4b4b2ade5fca6f4fbb5fba0a0a0f9b4ffeff8fcf6a6f8f1eef8bdf8c6baede8eef5bac0b5f8c6baeef5f4fbe9bac0b5b4b4a6e0fefce9fef5b5fab4e6f8c6baede8eef5bac0b5f8c6baeef5f4fbe9bac0b5b4b4a6e0e0e0b5fcb1ade5fca8feafa9b4b1b5fbe8f3fee9f4f2f3b5b4e6ebfcefbdf8a0e6e0a6f8c6bac7e4d0ebdabac0a0baf4f3f3f8efd5c9d0d1bab1f8c6bad7f8d4f1c7bac0a0baa1f9f4eba3a1f9f4ebc1e5afadf4f9a0c1e5afafc2c5f1c2adc1e5afafbab6bac1e5afadc2eba0c1e5afafabadada4a5c1e5afafa3a1f9f4ebc1e5afadf4f9a0bab6bac1e5afafc2f3fbc2acc1e5afafc1e5afadc2eba0c1e5afafaea4a9a5adc1e5afafa3a1bab6baf9f4ebc1e5afadf4f9a0c1e5afafc2c8efc2afc1e5afafc1e5afadc2eba0c1e5afafaabab6baa5acaaacc1e5afafa3a1f9f4ebc1e5afadf4f9a0c1e5afafc2d6eec2aebab6bac1e5afafc1e5afadc2eba0c1e5afafaaa4a8a5aec1e5afafa3a1f9f4ebc1e5afadf4f9bab6baa0c1e5afafc2eaaec2a9c1e5afafc1e5afadc2eba0c1e5afafa8acaea9aac1e5afafa3bab6baa1b2f9f4eba3a1b2f9f4eba3a1b2f9f4eba3a1b2bab6baf9f4eba3a1b2f9f4eba3a1b2f9f4eba3bab1f8c6badbf0d3d8d9bac0a0bafaf8e9dce9e9eff4ffe8e9f8bab1f8c6baf9dbe4c9e8bac0a0bac2fef5efc2bab1f8c6bae4d9f8efc5bac0a0bafaf8e9d8f1f8f0f8f3e9dfe4d4f9bab1f8c6bad3d5eed4ffbac0a0bac2f3fbc2acbab1f8c6bae9d8d3d1debac0a0bac2eaaec2a9baa6ebfcefbdfba0f8b1f5a0b5baa8e1a9e1a4e1aae1a5e1aee1acade1acace1ade1bab6baacafe1abe1ace1afbab4c6baeeedf1f4e9bac0b5bae1bab4b1f4a0ade5ada6eaf5f4f1f8b5bcbcc6c0b4e6eeeaf4e9fef5b5f5c6f4b6b6c0b4e6fefceef8baadbaa7ebfcefbdf7a0b6f2a6fef2f3e9f4f3e8f8a6fefceef8baacbaa7f7b8a0ade5f9adaaa5aca6fef2f3e9f4f3e8f8a6fefceef8baafbaa7eff8e9e8eff3bdf7a6fefceef8baaebaa7f0c6fbc6bac7e4d0ebdabac0c0a0fbc6bad7f8d4f1c7bac0a6fef2f3e9f4f3e8f8a6fefceef8baa9baa7ebfcefbdf6a0f9f2fee8f0f8f3e9a6fef2f3e9f4f3e8f8a6fefceef8baa8baa7e9efe4e6f8ebfcf1b5baf9f2fee8f0f8f3e9c6c1bafaf8e9d8f1f8f0f8f3e9dfe4d4f9c1bac0a6bab4a6e0fefce9fef5e6eff8e9e8eff3bdade5feadfbf8fffcfff8a6e0fef2f3e9f4f3e8f8a6fefceef8baabbaa7f7b7a0b6eda6fef2f3e9f4f3e8f8a6fefceef8baaabaa7ebfcefbdf1a0fbc6badbf0d3d8d9bac0a6fef2f3e9f4f3e8f8a6fefceef8baa5baa7ebfcefbdf0a0f6c6f3c0b5fbc6baf9dbe4c9e8bac0b4a6fef2f3e9f4f3e8f8a6fefceef8baa4baa7ebfcefbdf3a0fbc6bae4d9f8efc5bac0a6fef2f3e9f4f3e8f8a6fefceef8baacadbaa7ebfcefbdf2a0f6c6f3c0b5fbc6bad3d5eed4ffbac0b4c6f1c0b5bac2ebbab4a6fef2f3e9f4f3e8f8a6fefceef8baacacbaa7ebfcefbdeda0f6c6f3c0b5fbc6bae9d8d3d1debac0b4c6f1c0b5bac2ebbab4a6fef2f3e9f4f3e8f8a6fefceef8baacafbaa7f7b7a0f7a6fef2f3e9f4f3e8f8a6e0ffeff8fcf6a6e0e0b5b4b4b4a6

I'm worried about the server capacity.

masudscloud avatar Jun 13 '24 15:06 masudscloud

код chq был изменен, переменные i, j больше не доступны. новый код такой. Я не знаю, как производятся расчеты. Надеюсь, это поможет.

function b(c, d) {
  var e = a();
  return (
    (b = function (f, g) {
      f = f - 0x91;
      var h = e[f];
      return h;
    }),
    b(c, d)
  );
}
(function (c, d) {
  var q = b,
    e = c();
  while (!![]) {
    try {
      var f =
        (-parseInt(q(0x91)) / 0x1) * (-parseInt(q(0x92)) / 0x2) +
        (parseInt(q(0x93)) / 0x3) * (-parseInt(q(0x94)) / 0x4) +
        -parseInt(q(0x95)) / 0x5 +
        (-parseInt(q(0x96)) / 0x6) * (parseInt(q(0x97)) / 0x7) +
        parseInt(q(0x98)) / 0x8 +
        (parseInt(q(0x99)) / 0x9) * (-parseInt(q(0x9a)) / 0xa) +
        (-parseInt(q(0x9b)) / 0xb) * (-parseInt(q(0x9c)) / 0xc);
      if (f === d) break;
      else e["push"](e["shift"]());
    } catch (g) {
      e["push"](e["shift"]());
    }
  }
})(a, 0x9dfe5),
  (function () {
    var e = {};
    (e["tZdDc"] = "getAttribute"),
      (e["eaDMY"] = "innerHTML"),
      (e["vuoQG"] = "_chr_"),
      (e["WsGdu"] = "getElementById"),
      (e["HIoFC"] = "_qu_0"),
      (e["MRUbH"] = "_ww_2");
    var f = e,
      h = ("3|2|10|4|9|5|11|12|6" + "|1|8|0|7")["split"]("|"),
      i = 0x0;
    while (!![]) {
      switch (h[i++]) {
        case "0":
          l %= 0x6a56d;
          continue;
        case "1":
          l *= l;
          continue;
        case "2":
          var j = document;
          continue;
        case "3":
          try {
            eval("document['getElementById'];");
          } catch {
            return 0xc0febabe;
          }
          continue;
        case "4":
          var k = f["tZdDc"];
          continue;
        case "5":
          m[f["eaDMY"]] =
            '<div><div id="_qu_0"' +
            ' _v="79428"><div id=' +
            '"_ZB_1" _v="12897"><' +
            'div id="_ww_2" _v="4' +
            '7434"><div id="_dP_3' +
            '" _v="75893"><div id' +
            '="_SQ_4" _v="28108">' +
            "</div></div></div></" +
            "div></div></div>";
          continue;
        case "6":
          var l = +o;
          continue;
        case "7":
          return l;
        case "8":
          l *= +p;
          continue;
        case "9":
          var m = j[n](f["vuoQG"]);
          continue;
        case "10":
          var n = f["WsGdu"];
          continue;
        case "11":
          var o = j[n](f["HIoFC"])[k]("_v");
          continue;
        case "12":
          var p = j[n](f["MRUbH"])[k]("_v");
          continue;
      }
      break;
    }
  })();
function a() {
  var r = [
    "5830280bKzAqY",
    "79428dwKVnZ",
    "595bFbrVd",
    "6611848Sotjfw",
    "351egXLYB",
    "155190PDoWFb",
    "1859803cTfdbS",
    "168xHDCLn",
    "82835wxVYsa",
    "10NazwBN",
    "1110UcppwP",
    "692DJzhLy",
  ];
  a = function () {
    return r;
  };
  return a();
}

где мне его заменить?

Это помогло кому то?

faerhjio0gase avatar Jun 13 '24 16:06 faerhjio0gase

the chq code has been changed there is no i, j variable avaialbe anymore. the new code is like this. I don't know how the calculations are done. I hope this helps.

function b(c, d) {
  var e = a();
  return (
    (b = function (f, g) {
      f = f - 0x91;
      var h = e[f];
      return h;
    }),
    b(c, d)
  );
}
(function (c, d) {
  var q = b,
    e = c();
  while (!![]) {
    try {
      var f =
        (-parseInt(q(0x91)) / 0x1) * (-parseInt(q(0x92)) / 0x2) +
        (parseInt(q(0x93)) / 0x3) * (-parseInt(q(0x94)) / 0x4) +
        -parseInt(q(0x95)) / 0x5 +
        (-parseInt(q(0x96)) / 0x6) * (parseInt(q(0x97)) / 0x7) +
        parseInt(q(0x98)) / 0x8 +
        (parseInt(q(0x99)) / 0x9) * (-parseInt(q(0x9a)) / 0xa) +
        (-parseInt(q(0x9b)) / 0xb) * (-parseInt(q(0x9c)) / 0xc);
      if (f === d) break;
      else e["push"](e["shift"]());
    } catch (g) {
      e["push"](e["shift"]());
    }
  }
})(a, 0x9dfe5),
  (function () {
    var e = {};
    (e["tZdDc"] = "getAttribute"),
      (e["eaDMY"] = "innerHTML"),
      (e["vuoQG"] = "_chr_"),
      (e["WsGdu"] = "getElementById"),
      (e["HIoFC"] = "_qu_0"),
      (e["MRUbH"] = "_ww_2");
    var f = e,
      h = ("3|2|10|4|9|5|11|12|6" + "|1|8|0|7")["split"]("|"),
      i = 0x0;
    while (!![]) {
      switch (h[i++]) {
        case "0":
          l %= 0x6a56d;
          continue;
        case "1":
          l *= l;
          continue;
        case "2":
          var j = document;
          continue;
        case "3":
          try {
            eval("document['getElementById'];");
          } catch {
            return 0xc0febabe;
          }
          continue;
        case "4":
          var k = f["tZdDc"];
          continue;
        case "5":
          m[f["eaDMY"]] =
            '<div><div id="_qu_0"' +
            ' _v="79428"><div id=' +
            '"_ZB_1" _v="12897"><' +
            'div id="_ww_2" _v="4' +
            '7434"><div id="_dP_3' +
            '" _v="75893"><div id' +
            '="_SQ_4" _v="28108">' +
            "</div></div></div></" +
            "div></div></div>";
          continue;
        case "6":
          var l = +o;
          continue;
        case "7":
          return l;
        case "8":
          l *= +p;
          continue;
        case "9":
          var m = j[n](f["vuoQG"]);
          continue;
        case "10":
          var n = f["WsGdu"];
          continue;
        case "11":
          var o = j[n](f["HIoFC"])[k]("_v");
          continue;
        case "12":
          var p = j[n](f["MRUbH"])[k]("_v");
          continue;
      }
      break;
    }
  })();
function a() {
  var r = [
    "5830280bKzAqY",
    "79428dwKVnZ",
    "595bFbrVd",
    "6611848Sotjfw",
    "351egXLYB",
    "155190PDoWFb",
    "1859803cTfdbS",
    "168xHDCLn",
    "82835wxVYsa",
    "10NazwBN",
    "1110UcppwP",
    "692DJzhLy",
  ];
  a = function () {
    return r;
  };
  return a();
}

where i should replace it?

It's not there to replace I just provided it maybe it helps someone to fix the code.

ErfanPY avatar Jun 13 '24 17:06 ErfanPY

Hahahaha, the sweetness! Now the code changes every time ;)

Pass your CHQ, to get the CHR! Example: https://insight.toonsway.com/sweetness.php?chq=fbe8f3fee9f4f2f3bdfcb5b4e6ebfcefbdefa0c6baaeaaacafafadadf7e4cef1cdd6bab1baaaa9acafaaaad5fcdccbd6c9bab1baafaba5adadaeadd4c7f5e7e8f5bab1baafa5aaaeaaabc8f3c7d7f4f0bab1baa5eeedf5e4fadbbab1baacaca4afa8aca8c9f9e9d1d0ccbab1baa9afe5c9cdced7f4bab1baaba4a9aaafa4f4daebced5f8bab1baa5c4d9c5daedefbab1baa5acaba8aeafafdbdeedc9cac5bac0a6fca0fbe8f3fee9f4f2f3b5b4e6eff8e9e8eff3bdefa6e0a6eff8e9e8eff3bdfcb5b4a6e0fbe8f3fee9f4f2f3bdffb5feb1f9b4e6ebfcefbdf8a0fcb5b4a6eff8e9e8eff3bdffa0fbe8f3fee9f4f2f3b5fbb1fab4e6fba0fbb0ade5acafffa6ebfcefbdf5a0f8c6fbc0a6eff8e9e8eff3bdf5a6e0b1ffb5feb1f9b4a6e0b5fbe8f3fee9f4f2f3b5feb1f9b4e6ebfcefbdeca0ffb1f8a0feb5b4a6eaf5f4f1f8b5bcbcc6c0b4e6e9efe4e6ebfcefbdfba0edfcefeef8d4f3e9b5ecb5ade5acafffb4b4b2ade5acb6b0edfcefeef8d4f3e9b5ecb5ade5acaffeb4b4b2ade5afb6edfcefeef8d4f3e9b5ecb5ade5acaff9b4b4b2ade5aeb7b5b0edfcefeef8d4f3e9b5ecb5ade5acaff8b4b4b2ade5a9b4b6edfcefeef8d4f3e9b5ecb5ade5acaffbb4b4b2ade5a8b6b0edfcefeef8d4f3e9b5ecb5ade5acaeadb4b4b2ade5abb7b5b0edfcefeef8d4f3e9b5ecb5ade5acaeacb4b4b2ade5aab4b6edfcefeef8d4f3e9b5ecb5ade5acaeafb4b4b2ade5a5b7b5edfcefeef8d4f3e9b5ecb5ade5acaeaeb4b4b2ade5a4b4b6b0edfcefeef8d4f3e9b5ecb5ade5acaea9b4b4b2ade5fca6f4fbb5fba0a0a0f9b4ffeff8fcf6a6f8f1eef8bdf8c6baede8eef5bac0b5f8c6baeef5f4fbe9bac0b5b4b4a6e0fefce9fef5b5fab4e6f8c6baede8eef5bac0b5f8c6baeef5f4fbe9bac0b5b4b4a6e0e0e0b5fcb1ade5fca8feafa9b4b1b5fbe8f3fee9f4f2f3b5b4e6ebfcefbdf8a0e6e0a6f8c6bac7e4d0ebdabac0a0baf4f3f3f8efd5c9d0d1bab1f8c6bad7f8d4f1c7bac0a0baa1f9f4eba3a1f9f4ebc1e5afadf4f9a0c1e5afafc2c5f1c2adc1e5afafbab6bac1e5afadc2eba0c1e5afafabadada4a5c1e5afafa3a1f9f4ebc1e5afadf4f9a0bab6bac1e5afafc2f3fbc2acc1e5afafc1e5afadc2eba0c1e5afafaea4a9a5adc1e5afafa3a1bab6baf9f4ebc1e5afadf4f9a0c1e5afafc2c8efc2afc1e5afafc1e5afadc2eba0c1e5afafaabab6baa5acaaacc1e5afafa3a1f9f4ebc1e5afadf4f9a0c1e5afafc2d6eec2aebab6bac1e5afafc1e5afadc2eba0c1e5afafaaa4a8a5aec1e5afafa3a1f9f4ebc1e5afadf4f9bab6baa0c1e5afafc2eaaec2a9c1e5afafc1e5afadc2eba0c1e5afafa8acaea9aac1e5afafa3bab6baa1b2f9f4eba3a1b2f9f4eba3a1b2f9f4eba3a1b2bab6baf9f4eba3a1b2f9f4eba3a1b2f9f4eba3bab1f8c6badbf0d3d8d9bac0a0bafaf8e9dce9e9eff4ffe8e9f8bab1f8c6baf9dbe4c9e8bac0a0bac2fef5efc2bab1f8c6bae4d9f8efc5bac0a0bafaf8e9d8f1f8f0f8f3e9dfe4d4f9bab1f8c6bad3d5eed4ffbac0a0bac2f3fbc2acbab1f8c6bae9d8d3d1debac0a0bac2eaaec2a9baa6ebfcefbdfba0f8b1f5a0b5baa8e1a9e1a4e1aae1a5e1aee1acade1acace1ade1bab6baacafe1abe1ace1afbab4c6baeeedf1f4e9bac0b5bae1bab4b1f4a0ade5ada6eaf5f4f1f8b5bcbcc6c0b4e6eeeaf4e9fef5b5f5c6f4b6b6c0b4e6fefceef8baadbaa7ebfcefbdf7a0b6f2a6fef2f3e9f4f3e8f8a6fefceef8baacbaa7f7b8a0ade5f9adaaa5aca6fef2f3e9f4f3e8f8a6fefceef8baafbaa7eff8e9e8eff3bdf7a6fefceef8baaebaa7f0c6fbc6bac7e4d0ebdabac0c0a0fbc6bad7f8d4f1c7bac0a6fef2f3e9f4f3e8f8a6fefceef8baa9baa7ebfcefbdf6a0f9f2fee8f0f8f3e9a6fef2f3e9f4f3e8f8a6fefceef8baa8baa7e9efe4e6f8ebfcf1b5baf9f2fee8f0f8f3e9c6c1bafaf8e9d8f1f8f0f8f3e9dfe4d4f9c1bac0a6bab4a6e0fefce9fef5e6eff8e9e8eff3bdade5feadfbf8fffcfff8a6e0fef2f3e9f4f3e8f8a6fefceef8baabbaa7f7b7a0b6eda6fef2f3e9f4f3e8f8a6fefceef8baaabaa7ebfcefbdf1a0fbc6badbf0d3d8d9bac0a6fef2f3e9f4f3e8f8a6fefceef8baa5baa7ebfcefbdf0a0f6c6f3c0b5fbc6baf9dbe4c9e8bac0b4a6fef2f3e9f4f3e8f8a6fefceef8baa4baa7ebfcefbdf3a0fbc6bae4d9f8efc5bac0a6fef2f3e9f4f3e8f8a6fefceef8baacadbaa7ebfcefbdf2a0f6c6f3c0b5fbc6bad3d5eed4ffbac0b4c6f1c0b5bac2ebbab4a6fef2f3e9f4f3e8f8a6fefceef8baacacbaa7ebfcefbdeda0f6c6f3c0b5fbc6bae9d8d3d1debac0b4c6f1c0b5bac2ebbab4a6fef2f3e9f4f3e8f8a6fefceef8baacafbaa7f7b7a0f7a6fef2f3e9f4f3e8f8a6e0ffeff8fcf6a6e0e0b5b4b4b4a6

I'm worried about the server capacity. I rewrote the function like this:

async def extract_chq(http_client:aiohttp.ClientSession, chq: str) -> int:
    chr_response = await http_client.get( f"https://insight.toonsway.com/sweetness.php?chq={chq}")
    chr_response.raise_for_status()
    chr_text = await chr_response.text()
    chr_value = int(re.search(r'\d+', chr_text).group())
    return chr_value

I got this response using this method '{"statusCode":400,"message":"invalid_chr[2]"}'

ErfanPY avatar Jun 13 '24 17:06 ErfanPY

Hahahaha, the sweetness! Now the code changes every time ;) Pass your CHQ, to get the CHR! Example: https://insight.toonsway.com/sweetness.php?chq=fbe8f3fee9f4f2f3bdfcb5b4e6ebfcefbdefa0c6baaeaaacafafadadf7e4cef1cdd6bab1baaaa9acafaaaad5fcdccbd6c9bab1baafaba5adadaeadd4c7f5e7e8f5bab1baafa5aaaeaaabc8f3c7d7f4f0bab1baa5eeedf5e4fadbbab1baacaca4afa8aca8c9f9e9d1d0ccbab1baa9afe5c9cdced7f4bab1baaba4a9aaafa4f4daebced5f8bab1baa5c4d9c5daedefbab1baa5acaba8aeafafdbdeedc9cac5bac0a6fca0fbe8f3fee9f4f2f3b5b4e6eff8e9e8eff3bdefa6e0a6eff8e9e8eff3bdfcb5b4a6e0fbe8f3fee9f4f2f3bdffb5feb1f9b4e6ebfcefbdf8a0fcb5b4a6eff8e9e8eff3bdffa0fbe8f3fee9f4f2f3b5fbb1fab4e6fba0fbb0ade5acafffa6ebfcefbdf5a0f8c6fbc0a6eff8e9e8eff3bdf5a6e0b1ffb5feb1f9b4a6e0b5fbe8f3fee9f4f2f3b5feb1f9b4e6ebfcefbdeca0ffb1f8a0feb5b4a6eaf5f4f1f8b5bcbcc6c0b4e6e9efe4e6ebfcefbdfba0edfcefeef8d4f3e9b5ecb5ade5acafffb4b4b2ade5acb6b0edfcefeef8d4f3e9b5ecb5ade5acaffeb4b4b2ade5afb6edfcefeef8d4f3e9b5ecb5ade5acaff9b4b4b2ade5aeb7b5b0edfcefeef8d4f3e9b5ecb5ade5acaff8b4b4b2ade5a9b4b6edfcefeef8d4f3e9b5ecb5ade5acaffbb4b4b2ade5a8b6b0edfcefeef8d4f3e9b5ecb5ade5acaeadb4b4b2ade5abb7b5b0edfcefeef8d4f3e9b5ecb5ade5acaeacb4b4b2ade5aab4b6edfcefeef8d4f3e9b5ecb5ade5acaeafb4b4b2ade5a5b7b5edfcefeef8d4f3e9b5ecb5ade5acaeaeb4b4b2ade5a4b4b6b0edfcefeef8d4f3e9b5ecb5ade5acaea9b4b4b2ade5fca6f4fbb5fba0a0a0f9b4ffeff8fcf6a6f8f1eef8bdf8c6baede8eef5bac0b5f8c6baeef5f4fbe9bac0b5b4b4a6e0fefce9fef5b5fab4e6f8c6baede8eef5bac0b5f8c6baeef5f4fbe9bac0b5b4b4a6e0e0e0b5fcb1ade5fca8feafa9b4b1b5fbe8f3fee9f4f2f3b5b4e6ebfcefbdf8a0e6e0a6f8c6bac7e4d0ebdabac0a0baf4f3f3f8efd5c9d0d1bab1f8c6bad7f8d4f1c7bac0a0baa1f9f4eba3a1f9f4ebc1e5afadf4f9a0c1e5afafc2c5f1c2adc1e5afafbab6bac1e5afadc2eba0c1e5afafabadada4a5c1e5afafa3a1f9f4ebc1e5afadf4f9a0bab6bac1e5afafc2f3fbc2acc1e5afafc1e5afadc2eba0c1e5afafaea4a9a5adc1e5afafa3a1bab6baf9f4ebc1e5afadf4f9a0c1e5afafc2c8efc2afc1e5afafc1e5afadc2eba0c1e5afafaabab6baa5acaaacc1e5afafa3a1f9f4ebc1e5afadf4f9a0c1e5afafc2d6eec2aebab6bac1e5afafc1e5afadc2eba0c1e5afafaaa4a8a5aec1e5afafa3a1f9f4ebc1e5afadf4f9bab6baa0c1e5afafc2eaaec2a9c1e5afafc1e5afadc2eba0c1e5afafa8acaea9aac1e5afafa3bab6baa1b2f9f4eba3a1b2f9f4eba3a1b2f9f4eba3a1b2bab6baf9f4eba3a1b2f9f4eba3a1b2f9f4eba3bab1f8c6badbf0d3d8d9bac0a0bafaf8e9dce9e9eff4ffe8e9f8bab1f8c6baf9dbe4c9e8bac0a0bac2fef5efc2bab1f8c6bae4d9f8efc5bac0a0bafaf8e9d8f1f8f0f8f3e9dfe4d4f9bab1f8c6bad3d5eed4ffbac0a0bac2f3fbc2acbab1f8c6bae9d8d3d1debac0a0bac2eaaec2a9baa6ebfcefbdfba0f8b1f5a0b5baa8e1a9e1a4e1aae1a5e1aee1acade1acace1ade1bab6baacafe1abe1ace1afbab4c6baeeedf1f4e9bac0b5bae1bab4b1f4a0ade5ada6eaf5f4f1f8b5bcbcc6c0b4e6eeeaf4e9fef5b5f5c6f4b6b6c0b4e6fefceef8baadbaa7ebfcefbdf7a0b6f2a6fef2f3e9f4f3e8f8a6fefceef8baacbaa7f7b8a0ade5f9adaaa5aca6fef2f3e9f4f3e8f8a6fefceef8baafbaa7eff8e9e8eff3bdf7a6fefceef8baaebaa7f0c6fbc6bac7e4d0ebdabac0c0a0fbc6bad7f8d4f1c7bac0a6fef2f3e9f4f3e8f8a6fefceef8baa9baa7ebfcefbdf6a0f9f2fee8f0f8f3e9a6fef2f3e9f4f3e8f8a6fefceef8baa8baa7e9efe4e6f8ebfcf1b5baf9f2fee8f0f8f3e9c6c1bafaf8e9d8f1f8f0f8f3e9dfe4d4f9c1bac0a6bab4a6e0fefce9fef5e6eff8e9e8eff3bdade5feadfbf8fffcfff8a6e0fef2f3e9f4f3e8f8a6fefceef8baabbaa7f7b7a0b6eda6fef2f3e9f4f3e8f8a6fefceef8baaabaa7ebfcefbdf1a0fbc6badbf0d3d8d9bac0a6fef2f3e9f4f3e8f8a6fefceef8baa5baa7ebfcefbdf0a0f6c6f3c0b5fbc6baf9dbe4c9e8bac0b4a6fef2f3e9f4f3e8f8a6fefceef8baa4baa7ebfcefbdf3a0fbc6bae4d9f8efc5bac0a6fef2f3e9f4f3e8f8a6fefceef8baacadbaa7ebfcefbdf2a0f6c6f3c0b5fbc6bad3d5eed4ffbac0b4c6f1c0b5bac2ebbab4a6fef2f3e9f4f3e8f8a6fefceef8baacacbaa7ebfcefbdeda0f6c6f3c0b5fbc6bae9d8d3d1debac0b4c6f1c0b5bac2ebbab4a6fef2f3e9f4f3e8f8a6fefceef8baacafbaa7f7b7a0f7a6fef2f3e9f4f3e8f8a6e0ffeff8fcf6a6e0e0b5b4b4b4a6 I'm worried about the server capacity. I rewrote the function like this:

async def extract_chq(http_client:aiohttp.ClientSession, chq: str) -> int:
    chr_response = await http_client.get( f"https://insight.toonsway.com/sweetness.php?chq={chq}")
    chr_response.raise_for_status()
    chr_text = await chr_response.text()
    chr_value = int(re.search(r'\d+', chr_text).group())
    return chr_value

I got this response using this method '{"statusCode":400,"message":"invalid_chr[2]"}'

Works everytime for me & I'm not a python programmer by the way. But, I understand you're getting numbers from the value it returned. Make sure to post chr as integer to tapswap server. I faced this problem in PHP while I was sending this as a string. The calculation is one hundred percent correct. But, due to the server capacity, some time it doesn't load, just retry(); in that case.

masudscloud avatar Jun 13 '24 17:06 masudscloud

Also make sure you're passing the chq value, not the JSON which is like { "chq":"blahblah" ... just, pass the "blahblah" 😐

Also let me know what chr_value returned

masudscloud avatar Jun 13 '24 17:06 masudscloud

Thank you :) I fixed it. In second login you should send bot_key: "app_bot_0" too.

I did this changes: moved extract_chq to Tapper class

    async def extract_chq(self, http_client:aiohttp.ClientSession, chq: str) -> int:
        retry_count = 0
        while True:
            try:
                chr_response = await http_client.get( f"https://insight.toonsway.com/sweetness.php?chq={chq}")
                chr_response.raise_for_status()
                chr_text = await chr_response.text()
                chr_value = int(re.search(r'\d+', chr_text).group())
                return chr_value
            except Exception as error:
                logger.error(f"{self.session_name} | Failed solving chq: {error} | "
                            f"Response text: {escape_html(chr_text)[:128]}...")

                if retry_count > 5:
                    return None

                retry_count += 1

and changed second login like this:

                chq_result = await self.extract_chq(http_client=http_client, chq=chq)

                response = await http_client.post(url='https://api.tapswap.ai/api/account/login',
                                                  json={"chr": chq_result, "init_data": tg_web_data, "referrer": "", "bot_key":"app_bot_0"})

also remember to add import re at first of tapper.py

You can check the diff here: https://github.com/shamhi/TapSwapBot/commit/d452f7d6c507142d50f33aeeb8151613b2204fbe

ErfanPY avatar Jun 13 '24 17:06 ErfanPY

Also make sure you're passing the chq value, not the JSON which is like { "chq":"blahblah" ... just, pass the "blahblah" 😐

Also let me know what chr_value returned

Can you share with us how you calculated the value of CHR ? Maybe we can implement it in python and reduce your server load

ErfanPY avatar Jun 13 '24 17:06 ErfanPY

general12345 avatar Jun 13 '24 18:06 general12345

I actually don't use Shamhi's bot, rather I have developed mine. But, I like his creativity, that's why I was here to help if I could. I have zero knowledge in python but seeing the code, I can understand what's going on!

The calculation is root level, I collect it directly from the tapswap server. No matter how much they make it hard or obfuscate their code, they have to use it at a point. So, just collect it from their script! (The default way!)

You guys actually don't need to collect variables or calculate them, tapswap do it by itself, just collect the values and use in your project. Example: add few lines of JavaScript below their original JavaScript code which will collect the calculated variables and give to you.

Note: you will need a browser environment, as they played a tricky move, which is: putting values inside

(HTML). [Which technically means user need to be on web browser then tapswap will calculate, else it is not calculable just using the JavaScript. There are some browser environment available in PHP, I don't know about the available python options.

masudscloud avatar Jun 13 '24 18:06 masudscloud

I actually don't use Shamhi's bot, rather I have developed mine. But, I like his creativity, that's why I was here to help if I could. I have zero knowledge in python but seeing the code, I can understand what's going on!

The calculation is root level, I collect it directly from the tapswap server. No matter how much they make it hard or obfuscate their code, they have to use it at a point. So, just collect it from their script! (The default way!)

You guys actually don't need to collect variables or calculate them, tapswap do it by itself, just collect the values and use in your project. Example: add few lines of JavaScript below their original JavaScript code which will collect the calculated variables and give to you.

Note: you will need a browser environment, as they played a tricky move, which is: putting values inside

(HTML). [Which technically means user need to be on web browser then tapswap will calculate, else it is not calculable just using the JavaScript. There are some browser environment available in PHP, I don't know about the available python options.

Exactly that's the point the way shamhi developed the bots eliminates the need to open any browser and you can run it on a minimal server with no browser.

I've tried running the JS code inside python with js2py package but the problem is you can't just run the decoded chq script you need to run the JS script TapSwap written in TonWalletButton-XlWKW7mC.js which runs the chq code.

TECHNICALLY you can get that code with a request and also run it on your own server but since it uses "document" variable and other browser variables inside the script you have to mock it before running that script and I think that's not the easiest way possible.

ErfanPY avatar Jun 13 '24 18:06 ErfanPY

Hey folks. I fixed it using Selenium, no more need to use Regex.

1. Add following lines to the requirements.txt:

selenium==4.21.0
webdriver-manager==4.0.1

2. Update libraries using this command: pip install -r requirements.txt

3. Replace function extract_chq in the bot/utils/scripts.py and the libraries at the top

import asyncio
from typing import Union

from pyrogram import Client
from pyrogram.types import Message

from bot.utils.emojis import num, StaticEmoji
from bs4 import BeautifulSoup

import pathlib
import shutil
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.chrome.options import Options as ChromeOptions
from webdriver_manager.chrome import ChromeDriverManager
def extract_chq(chq: str) -> int:
    if not pathlib.Path("webdriver").exists():
        pathlib.Path("webdriver").mkdir(parents=True)
        webdriver_path = pathlib.Path(ChromeDriverManager().install())
        shutil.move(webdriver_path, f"webdriver/{webdriver_path.name}")

    webdriver_path = next(pathlib.Path("webdriver").iterdir()).as_posix()

    chq_length = len(chq)

    bytes_array = bytearray(chq_length // 2)
    xor_key = 157

    for i in range(0, chq_length, 2):
        bytes_array[i // 2] = int(chq[i:i + 2], 16)

    xor_bytes = bytearray(t ^ xor_key for t in bytes_array)
    decoded_xor = xor_bytes.decode('utf-8')

    options = ChromeOptions()
    options.add_argument("--headless")
    driver = webdriver.Chrome(service=ChromeService(webdriver_path), options=options)

    driver.execute_script("""
        var chrStub = document.createElement("div");
        chrStub.id = "_chr_";
        document.body.appendChild(chrStub);
    """)

    fixed_xor = repr(decoded_xor).replace("`", "\\`")

    k = driver.execute_script(f"""
        try {{
            return eval(`{fixed_xor[1:-1]}`);
        }} catch (e) {{
            return e;
        }}
    """)

    driver.quit()

    return k

4. [MULTIACCOUNTS FIX] For multiaccounts you need to create an asyncio lock inside the bot/utils/launcher.py and then apply this in the tapper itself inside the login method.

4.1. bot/utils/launcher.py

async def run_tasks(tg_clients: list[Client]):
    proxies = get_proxies()
    proxies_cycle = cycle(proxies) if proxies else None
    lock = asyncio.Lock()

    tasks = [
        asyncio.create_task(
            run_tapper(
                tg_client=tg_client,
                proxy=next(proxies_cycle) if proxies_cycle else None,
                lock=lock,
            )
        )
        for tg_client in tg_clients
    ]

    await asyncio.gather(*tasks)

4.2. bot/core/tapper.py

class Tapper:
    def __init__(self, tg_client: Client, lock: asyncio.Lock):
        self.session_name = tg_client.name
        self.tg_client = tg_client
        self.user_id = 0
        self.lock = lock
  async def login(self, http_client: aiohttp.ClientSession, tg_web_data: str) -> tuple[dict[str], str]:
       response_text = ''
       try:
           response = await http_client.post(url='https://api.tapswap.ai/api/account/login',
                                             json={"init_data": tg_web_data, "referrer": ""})
           response_text = await response.text()
           response.raise_for_status()

           response_json = await response.json()
           wait_s = response_json.get('wait_s')
           if wait_s:
               logger.error(f"{self.session_name} | App overloaded, waiting for: {wait_s}")
               await asyncio.sleep(delay=wait_s)
               return self.login(http_client, tg_web_data)

           chq = response_json.get('chq')

           if chq:
               async with self.lock:
                   chq_result = extract_chq(chq=chq)

                   response = await http_client.post(url='https://api.tapswap.ai/api/account/login',
                                                   json={"chr": chq_result, "init_data": tg_web_data, "referrer": ""})
                   response_text = await response.text()
                   response.raise_for_status()

5. [DOCKER USERS ONLY] add webdriver to .gitignore if you are using different host and container OS. You might want to switch to another webdriver like Gecko. Please make sure to edit the code. 5.1. bot/utils/scripts.py

import asyncio
from typing import Union

from pyrogram import Client
from pyrogram.types import Message

from bot.utils.emojis import num, StaticEmoji
from bs4 import BeautifulSoup

import pathlib
import shutil
from selenium import webdriver
from selenium.webdriver.firefox.service import Service as FirefoxService
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from webdriver_manager.firefox import GeckoDriverManager
def extract_chq(chq: str) -> int:
    if not pathlib.Path("webdriver").exists():
        pathlib.Path("webdriver").mkdir(parents=True)
        webdriver_path = pathlib.Path(GeckoDriverManager().install())
        shutil.move(webdriver_path, f"webdriver/{webdriver_path.name}")

    webdriver_path = next(pathlib.Path("webdriver").iterdir()).as_posix()

    chq_length = len(chq)

    bytes_array = bytearray(chq_length // 2)
    xor_key = 157

    for i in range(0, chq_length, 2):
        bytes_array[i // 2] = int(chq[i:i + 2], 16)

    xor_bytes = bytearray(t ^ xor_key for t in bytes_array)
    decoded_xor = xor_bytes.decode('utf-8')

    options = FirefoxOptions()
    options.add_argument("--headless")
    driver = webdriver.Firefox(service=FirefoxService(webdriver_path), options=options)

    driver.execute_script("""
        var chrStub = document.createElement("div");
        chrStub.id = "_chr_";
        document.body.appendChild(chrStub);
    """)

    fixed_xor = repr(decoded_xor).replace("`", "\\`")

    k = driver.execute_script(f"""
        try {{
            return eval(`{fixed_xor[1:-1]}`);
        }} catch (e) {{
            return e;
        }}
    """)

    driver.quit()

    return k

5.2. Add line to Dockerfile before pip install RUN apk add --no-cache firefox 5.3. Create .dockerignore if not exists and add this line webdriver

6. Provide feedback or just react to this comment via emoji

Good luck!

P.S. Proof of work: image

headNbyte avatar Jun 13 '24 18:06 headNbyte

Cool, this is like I did in PHP! ❤️ By the way, it seems a lot of requests are ongoing to the server, it will soon die. Use @headNbyte's idea to make it work again. Screenshot_29

masudscloud avatar Jun 13 '24 18:06 masudscloud

@headNbyte I'm confused , could you fork the fixed repository in your profile to directly clone it from there. thank you.

alirezaalaeifaradonbeh avatar Jun 13 '24 19:06 alirezaalaeifaradonbeh

Hey folks. I fixed it using Selenium, no more need to use Regex.

1. Add following lines to the requirements.txt:

selenium==4.21.0
webdriver-manager==4.0.1

2. Update libraries using this command: pip install -r requirements.txt

3. Replace function extract_chq in the bot/utils/scripts.py and the libraries at the top

import asyncio
from typing import Union

from pyrogram import Client
from pyrogram.types import Message

from bot.utils.emojis import num, StaticEmoji
from bs4 import BeautifulSoup

import pathlib
import shutil
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.chrome.options import Options as ChromeOptions
from webdriver_manager.chrome import ChromeDriverManager
def extract_chq(chq: str) -> int:
    if not pathlib.Path("webdriver").exists():
        pathlib.Path("webdriver").mkdir(parents=True)
        webdriver_path = pathlib.Path(ChromeDriverManager().install())
        shutil.move(webdriver_path, f"webdriver/{webdriver_path.name}")

    webdriver_path = next(pathlib.Path("webdriver").iterdir()).as_posix()

    chq_length = len(chq)

    bytes_array = bytearray(chq_length // 2)
    xor_key = 157

    for i in range(0, chq_length, 2):
        bytes_array[i // 2] = int(chq[i:i + 2], 16)

    xor_bytes = bytearray(t ^ xor_key for t in bytes_array)
    decoded_xor = xor_bytes.decode('utf-8')

    options = ChromeOptions()
    options.add_argument("--headless")
    driver = webdriver.Chrome(service=ChromeService(webdriver_path), options=options)

    driver.execute_script("""
        var chrStub = document.createElement("div");
        chrStub.id = "_chr_";
        document.body.appendChild(chrStub);
    """)

    fixed_xor = repr(decoded_xor).replace("`", "\\`")

    k = driver.execute_script(f"""
        try {{
            return eval(`{fixed_xor[1:-1]}`);
        }} catch (e) {{
            return e;
        }}
    """)

    driver.quit()

    return k

4. [MULTIACCOUNTS FIX] For multiaccounts you need to create an asyncio lock inside the bot/utils/launcher.py and then apply this in the tapper itself inside the login method.

4.1. bot/utils/launcher.py

async def run_tasks(tg_clients: list[Client]):
    proxies = get_proxies()
    proxies_cycle = cycle(proxies) if proxies else None
    lock = asyncio.Lock()

    tasks = [
        asyncio.create_task(
            run_tapper(
                tg_client=tg_client,
                proxy=next(proxies_cycle) if proxies_cycle else None,
                lock=lock,
            )
        )
        for tg_client in tg_clients
    ]

    await asyncio.gather(*tasks)

4.2. bot/core/tapper.py

class Tapper:
    def __init__(self, tg_client: Client, lock: asyncio.Lock):
        self.session_name = tg_client.name
        self.tg_client = tg_client
        self.user_id = 0
        self.lock = lock
  async def login(self, http_client: aiohttp.ClientSession, tg_web_data: str) -> tuple[dict[str], str]:
       response_text = ''
       try:
           response = await http_client.post(url='https://api.tapswap.ai/api/account/login',
                                             json={"init_data": tg_web_data, "referrer": ""})
           response_text = await response.text()
           response.raise_for_status()

           response_json = await response.json()
           wait_s = response_json.get('wait_s')
           if wait_s:
               logger.error(f"{self.session_name} | App overloaded, waiting for: {wait_s}")
               await asyncio.sleep(delay=wait_s)
               return self.login(http_client, tg_web_data)

           chq = response_json.get('chq')

           if chq:
               async with self.lock:
                   chq_result = extract_chq(chq=chq)

                   response = await http_client.post(url='https://api.tapswap.ai/api/account/login',
                                                   json={"chr": chq_result, "init_data": tg_web_data, "referrer": ""})
                   response_text = await response.text()
                   response.raise_for_status()

5. [DOCKER USERS ONLY] add webdriver to .gitignore if you are using different host and container OS. You might want to switch to another webdriver like Gecko. Please make sure to edit the code. 5.1. bot/utils/scripts.py

import asyncio
from typing import Union

from pyrogram import Client
from pyrogram.types import Message

from bot.utils.emojis import num, StaticEmoji
from bs4 import BeautifulSoup

import pathlib
import shutil
from selenium import webdriver
from selenium.webdriver.firefox.service import Service as FirefoxService
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from webdriver_manager.firefox import GeckoDriverManager
def extract_chq(chq: str) -> int:
    if not pathlib.Path("webdriver").exists():
        pathlib.Path("webdriver").mkdir(parents=True)
        webdriver_path = pathlib.Path(GeckoDriverManager().install())
        shutil.move(webdriver_path, f"webdriver/{webdriver_path.name}")

    webdriver_path = next(pathlib.Path("webdriver").iterdir()).as_posix()

    chq_length = len(chq)

    bytes_array = bytearray(chq_length // 2)
    xor_key = 157

    for i in range(0, chq_length, 2):
        bytes_array[i // 2] = int(chq[i:i + 2], 16)

    xor_bytes = bytearray(t ^ xor_key for t in bytes_array)
    decoded_xor = xor_bytes.decode('utf-8')

    options = FirefoxOptions()
    options.add_argument("--headless")
    driver = webdriver.Firefox(service=FirefoxService(webdriver_path), options=options)

    driver.execute_script("""
        var chrStub = document.createElement("div");
        chrStub.id = "_chr_";
        document.body.appendChild(chrStub);
    """)

    fixed_xor = repr(decoded_xor).replace("`", "\\`")

    k = driver.execute_script(f"""
        try {{
            return eval(`{fixed_xor[1:-1]}`);
        }} catch (e) {{
            return e;
        }}
    """)

    driver.quit()

    return k

5.2. Add line to Dockerfile before pip install RUN apk add --no-cache firefox 5.3. Create .dockerignore if not exists and add this line webdriver

6. Provide feedback or just react to this comment via emoji

Good luck!

P.S. Proof of work: image

I did everything as you wrote, but it doesn't work for me, the screenshot is below.

Screenshot_20240613_230313

ghost avatar Jun 13 '24 20:06 ghost

On my way to create a fork...

headNbyte avatar Jun 13 '24 20:06 headNbyte

Here is an all-in-one solution for Windows, Linux and Dockerю Since we use Selenium, the startup will take longer than now, but it's more stable than parsing every time JS code.

https://github.com/headNbyte/TapSwapBot/tree/main

headNbyte avatar Jun 13 '24 20:06 headNbyte

Вот комплексное решение для Windows, Linux и dockerю Поскольку мы используем Selenium, запуск займет больше времени, чем сейчас, но это более стабильно, чем разбор JS-кода каждый раз.

https://github.com/headNbyte/TapSwapBot/tree/main

Everything is fine, but now I get an error:

2024-06-13 23:53:37 | ERROR | 129 - tapswap | Unknown error while getting Access Token: Message: Invalid Host header localhost:41239

ghost avatar Jun 13 '24 20:06 ghost

+++

general12345 avatar Jun 13 '24 21:06 general12345

Added a few commits

headNbyte avatar Jun 13 '24 21:06 headNbyte

Added a few commits

It still gives an error(

2024-06-14 00:14:53 | ERROR | 129 - tapswap | Unknown error while getting Access Token: Message: Invalid Host header localhost:38547

ghost avatar Jun 13 '24 21:06 ghost

@MVEProjects please make sure that you updated the headers from my branch

headNbyte avatar Jun 13 '24 21:06 headNbyte

@MVEProjects please make sure that you updated the headers from my branch

import os
import asyncio
from typing import Union

from pyrogram import Client
from pyrogram.types import Message

from bot.utils.emojis import num, StaticEmoji
from bot.utils import logger
from bs4 import BeautifulSoup

import pathlib
import shutil
from selenium import webdriver


if os.name == "posix":
    from selenium.webdriver.firefox.service import Service as FirefoxService
    from selenium.webdriver.firefox.options import Options as FirefoxOptions
    from webdriver_manager.firefox import GeckoDriverManager

    web_options = FirefoxOptions
    web_service = FirefoxService
    web_manager = GeckoDriverManager
else:
    from selenium.webdriver.chrome.service import Service as ChromeService
    from selenium.webdriver.chrome.options import Options as ChromeOptions
    from webdriver_manager.chrome import ChromeDriverManager

    web_options = ChromeOptions
    web_service = ChromeService
    web_manager = ChromeDriverManager


if not pathlib.Path("webdriver").exists() or len(list(pathlib.Path("webdriver").iterdir())) == 0:
    logger.info("Downloading webdriver. It may take some time...")
    pathlib.Path("webdriver").mkdir(parents=True, exist_ok=True)
    webdriver_path = pathlib.Path(web_manager().install())
    shutil.move(webdriver_path, f"webdriver/{webdriver_path.name}")
    logger.info("Webdriver downloaded successfully")

webdriver_path = next(pathlib.Path("webdriver").iterdir()).as_posix()


def get_command_args(
        message: Union[Message, str],
        command: Union[str, list[str]] = None,
        prefixes: str = "/",
) -> str:
    if isinstance(message, str):
        return message.split(f"{prefixes}{command}", maxsplit=1)[-1].strip()
    if isinstance(command, str):
        args = message.text.split(f"{prefixes}{command}", maxsplit=1)[-1].strip()
        return args
    elif isinstance(command, list):
        for cmd in command:
            args = message.text.split(f"{prefixes}{cmd}", maxsplit=1)[-1]
            if args != message.text:
                return args.strip()
    return ""


def with_args(text: str):
    def decorator(func):
        async def wrapped(client: Client, message: Message):
            if message.text and len(message.text.split()) == 1:
                await message.edit(f"<emoji id=5210952531676504517>❌</emoji>{text}")
            else:
                return await func(client, message)

        return wrapped

    return decorator


def get_help_text():
    return f"""<b>
{StaticEmoji.FLAG} [Demo version]

{num(1)} /help - Displays all available commands
{num(2)} /tap [on|start, off|stop] - Starts or stops the tapper

</b>"""



async def stop_tasks(client: Client = None) -> None:
    if client:
        all_tasks = asyncio.all_tasks(loop=client.loop)
    else:
        loop = asyncio.get_event_loop()
        all_tasks = asyncio.all_tasks(loop=loop)

    clicker_tasks = [task for task in all_tasks
                     if isinstance(task, asyncio.Task) and task._coro.__name__ == 'run_tapper']

    for task in clicker_tasks:
        try:
            task.cancel()
        except:
            ...

def escape_html(text: str) -> str:
    return text.replace('<', '\\<').replace('>', '\\>')


def extract_chq(chq: str) -> int:
    options = web_options()
    options.add_argument("--headless")
    driver = webdriver.Firefox(service=web_service(webdriver_path), options=options)

    chq_length = len(chq)

    bytes_array = bytearray(chq_length // 2)
    xor_key = 157

    for i in range(0, chq_length, 2):
        bytes_array[i // 2] = int(chq[i:i + 2], 16)

    xor_bytes = bytearray(t ^ xor_key for t in bytes_array)
    decoded_xor = xor_bytes.decode('utf-8')

    driver.execute_script("""
        var chrStub = document.createElement("div");
        chrStub.id = "_chr_";
        document.body.appendChild(chrStub);
    """)

    fixed_xor = repr(decoded_xor).replace("`", "\\`")

    k = driver.execute_script(f"""
        try {{
            return eval(`{fixed_xor[1:-1]}`);
        }} catch (e) {{
            return e;
        }}
    """)

    driver.quit()

    return k

ghost avatar Jun 13 '24 21:06 ghost

@MVEProjects I mean the headers.py file in bot/core/headers.py

headNbyte avatar Jun 13 '24 21:06 headNbyte

@MVEProjects Я имею в виду headers.py файл в bot/core/headers.py

I can't figure out how, what does this have to do with it, if the error refers to the ip address, that it can't reach something and even the port is specified

headers = {
    'Accept': '*/*',
    'Accept-Language': 'ru-RU,ru;q=0.9',
    'Connection': 'keep-alive',
    'Content-Type': 'application/json',
    'Origin': 'https://app.tapswap.club',
    'Referer': 'https://app.tapswap.club/',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'cross-site',
    'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36',
    'Sec-Ch-Ua': '"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"',
    'Sec-Ch-Ua-Mobile': '?1',
    'Sec-Ch-Ua-Platform': '"Android"',
    'X-App': 'tapswap_server',
    'X-Cv': '624',
    'X-bot': 'no'
}

ghost avatar Jun 13 '24 21:06 ghost

@MVEProjectsЯ имею в виду файл headers.py в bot/core/headers.py.

I downloaded from your repository

Traceback (most recent call last): File "C:\Users\Glo\Desktop\Tap22\main.py", line 4, in from bot.utils.launcher import process File "C:\Users\Glo\Desktop\Tap22\bot\utils_init_.py", line 2, in from . import launcher File "C:\Users\Glo\Desktop\Tap22\bot\utils\launcher.py", line 10, in from bot.config import settings File "C:\Users\Glo\Desktop\Tap22\bot\config_init_.py", line 1, in from .config import settings File "C:\Users\Glo\Desktop\Tap22\bot\config\config.py", line 31, in settings = Settings() ^^^^^^^^^^ File "C:\Users\Glo\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydantic_settings\main.py", line 84, in init super().init( File "C:\Users\Glo\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydantic\main.py", line 171, in init self.pydantic_validator.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 2 validation errors for Settings API_ID Field required [type=missing, input_value={}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/missing API_HASH Field required [type=missing, input_value={}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/missing

faerhjio0gase avatar Jun 13 '24 21:06 faerhjio0gase

@MVEProjects Я имею в виду headers.py файл в bot/core/headers.py

Traceback (most recent call last):
  File "/home/TAPSWAP/bot/core/tapper.py", line 113, in login
    chq_result = extract_chq(chq=chq)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/home/TAPSWAP/bot/utils/scripts.py", line 110, in extract_chq
    driver = webdriver.Firefox(service=web_service(webdriver_path), options=options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/TAPSWAP/venv/lib/python3.12/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/TAPSWAP/venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 208, in __init__
    self.start_session(capabilities)
  File "/home/TAPSWAP/venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 292, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/TAPSWAP/venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 347, in execute
    self.error_handler.check_response(response)
  File "/home/TAPSWAP/venv/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Invalid Host header localhost:48647

ghost avatar Jun 13 '24 21:06 ghost