Skip to content

Instantly share code, notes, and snippets.

@syxme
Last active September 29, 2024 19:45
Show Gist options
  • Save syxme/386ee427ac8ae7e3365491cd5be56f18 to your computer and use it in GitHub Desktop.
Save syxme/386ee427ac8ae7e3365491cd5be56f18 to your computer and use it in GitHub Desktop.
WA Token Android
const SIGNATURE = "MIIDMjCCAvCgAwIBAgIETCU2pDALBgcqhkjOOAQDBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRhIENsYXJhMRYwFAYDVQQKEw1XaGF0c0FwcCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEUMBIGA1UEAxMLQnJpYW4gQWN0b24wHhcNMTAwNjI1MjMwNzE2WhcNNDQwMjE1MjMwNzE2WjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEUMBIGA1UEBxMLU2FudGEgQ2xhcmExFjAUBgNVBAoTDVdoYXRzQXBwIEluYy4xFDASBgNVBAsTC0VuZ2luZWVyaW5nMRQwEgYDVQQDEwtCcmlhbiBBY3RvbjCCAbgwggEsBgcqhkjOOAQBMIIBHwKBgQD9f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8VIwvMspK5gqLrhAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jrqgvlXTAs9B4JnUVlXjrrUWU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1kW6jfwv6ITVi8ftiegEkO8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GFAAKBgQDRGYtLgWh7zyRtQainJfCpiaUbzjJuhMgo4fVWZIvXHaSHBU1t5w//S0lDK2hiqkj8KpMWGywVov9eZxZy37V26dEqr/c2m5qZ0E+ynSu7sqUD7kGx/zeIcGT0H+KAVgkGNQCo5Uc0koLRWYHNtYoIvt5R3X6YZylbPftF/8ayWTALBgcqhkjOOAQDBQADLwAwLAIUAKYCp0d6z4QQdyN74JDfQ2WCyi8CFDUM4CaNB+ceVXdKtOrNTQcc0e+t";
const KEYX = "eQV5aq/Cg63Gsq1sshN9T3gh+UUp0wIw0xgHYT1bnCjEqOJQKCRrWxdAe2yvsDeCJL+Y4G3PRD2HUF7oUgiGo8vGlNJOaux26k+A2F3hj8A="//Outdated in new versions
let versions = [
{ver:"2.23.13.77",MD5_CLASSES:"XYxiaPZOpzfsQ0lWuhResg=="},
{ver:"2.23.16.4",MD5_CLASSES:"86QacNhsCQITsvSoS8PQFQ=="},
{ver:"2.23.17.75",MD5_CLASSES:"gYynaiJZas6yUO5qG8pssw=="},
{ver:"2.23.20.13",MD5_CLASSES:"gkjz2RPaXkvpz01wTuqiDw=="},
]
const cur = versions[1]//gre(versions)
const VERSION = cur.ver
const MD5_CLASSES = cur.MD5_CLASSES
const getToken = function (msisdn){
msisdn = String(msisdn)+""
let keyDecoded = Buffer.from(KEYX, 'base64');
let sigDecoded = Buffer.from(SIGNATURE, 'base64');
let clsDecoded = Buffer.from(MD5_CLASSES, 'base64');
let data = Buffer.concat([sigDecoded,clsDecoded,Buffer.from(msisdn)])
let opad = Buffer.alloc(64)
let ipad = Buffer.alloc(64)
for (let i = 0; i < 64; i++) {
opad[i] = 0x5C ^ keyDecoded[i]
ipad[i] = 0x36 ^ keyDecoded[i]
}
let hash = crypto.createHash('sha1')
let subHash = crypto.createHash('sha1')
subHash.update(Buffer.concat([ipad,data]))
hash.update(Buffer.concat([opad,subHash.digest()]))
return hash.digest("base64")
}
const crypto = require('crypto')
const fs = require("fs");
const buff = fs.readFileSync("./classes.dex");// Download apk and extract classes.dex
const hash = crypto.createHash("md5").update(buff).digest().toString("base64");
console.log(hash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment