From c732d1c0e6b13acbbc16facb59adb174118b1674 Mon Sep 17 00:00:00 2001 From: Knine Date: Thu, 25 May 2023 00:40:33 +0800 Subject: [PATCH] LJWT --- .../package.json" | 6 +- .../src/crypto/jsbn.js" | 6 ++ .../src/crypto/rsa.js" | 6 ++ .../src/main.js" | 82 ++++++++++++++++++- 4 files changed, 95 insertions(+), 5 deletions(-) diff --git "a/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/package.json" "b/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/package.json" index 2e52972..0583b10 100644 --- "a/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/package.json" +++ "b/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/package.json" @@ -3,10 +3,14 @@ "version": "1.0.0", "description": "", "main": "index.js", + "type": "module", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "node src/main.js" }, "author": "", - "license": "ISC" + "license": "ISC", + "dependencies": { + "node-fetch": "^3.3.1" + } } diff --git "a/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/crypto/jsbn.js" "b/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/crypto/jsbn.js" index 3c80ca9..d3bbf07 100644 --- "a/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/crypto/jsbn.js" +++ "b/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/crypto/jsbn.js" @@ -36,6 +36,7 @@ // Basic JavaScript BN library - subset useful for RSA encryption. +global.navigator={ userAgent: 'node.js', }; // Bits per digit var dbits; @@ -1237,3 +1238,8 @@ BigInteger.prototype.isProbablePrime = bnIsProbablePrime; // long longValue() // static BigInteger valueOf(long val) + + +export { + BigInteger +} \ No newline at end of file diff --git "a/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/crypto/rsa.js" "b/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/crypto/rsa.js" index a924a5a..de5b2af 100644 --- "a/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/crypto/rsa.js" +++ "b/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/crypto/rsa.js" @@ -1,3 +1,6 @@ + +import {BigInteger} from "./jsbn.js" + var RSAPublicKey = function($modulus_hex, $encryptionExponent_hex) { this.modulus = new BigInteger( $modulus_hex, 16); this.encryptionExponent = new BigInteger( $encryptionExponent_hex, 16); @@ -105,3 +108,6 @@ var RSA = { } }; +export { + RSA +} diff --git "a/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/main.js" "b/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/main.js" index 6766d01..1620ad4 100644 --- "a/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/main.js" +++ "b/steam/2023-05-21--\345\215\217\350\256\256\345\256\236\347\216\260\347\275\221\351\241\265\347\231\273\345\275\225/src/main.js" @@ -1,12 +1,86 @@ // ReferenceError: navigator is not defined global.navigator={ userAgent: 'node.js', }; -require("./crypto/jsbn.js") -require("./crypto/rsa.js") +("./crypto/jsbn.js") +import {RSA} from "./crypto/rsa.js" -function main() { +function main(usr, pwd, results) { + pwd = pwd.replace( /[^\x00-\x7F]/g, '' ); // remove non-standard-ASCII characters + let m_strUsernameCanonical = usr.replace( /[^\x00-\x7F]/g, '' ); // remove non-standard-ASCII characters + var pubKey = RSA.getPublicKey(results.publickey_mod, results.publickey_exp); + var username = m_strUsernameCanonical; + var encryptedPassword = RSA.encrypt(pwd, pubKey); + var rgParameters = { + password: encryptedPassword, + username: username, + // twofactorcode: authCode, + // emailauth: form.elements['emailauth'] ? form.elements['emailauth'].value : '', + // loginfriendlyname: form.elements['loginfriendlyname'] ? form.elements['loginfriendlyname'].value : '', + // captchagid: this.m_gidCaptcha, + captcha_text: '', + // emailsteamid: this.m_steamidEmailAuth, + rsatimestamp: results.timestamp, + remember_login: 'true' + }; + console.log(pubKey, rgParameters) } -main() +// ReferenceError: fetch is not defined +// failed, reason: unable to verify the first certificate +import fetch from 'node-fetch' +fetch("https://api.steampowered.com/IAuthenticationService/GetPasswordRSAPublicKey/v1?origin=https:%2F%2Fstore.steampowered.com&input_json=%7B%22account_name%22:%22111%22%7D", { + "headers": { + "accept": "application/json, text/plain, */*", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", + "sec-ch-ua": "\"Microsoft Edge\";v=\"113\", \"Chromium\";v=\"113\", \"Not-A.Brand\";v=\"24\"", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\"Windows\"", + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "same-site" + }, + "referrer": "https://store.steampowered.com/", + "referrerPolicy": "strict-origin-when-cross-origin", + "body": null, + "method": "GET", + "mode": "cors", + // "credentials": "omit" +}).then(resp => resp.json) +.then(j => console.log(j)) +let results = { + publickey_mod: '123aee', + publickey_exp: '010001', + timestamp: '58350' +} +// main('111', '222', results) console.log("leave") + +/* +{ + "interval": 5, + "extended_error_message": "" +} +*/ +function t() { + fetch("https://api.steampowered.com/IAuthenticationService/BeginAuthSessionViaCredentials/v1", { + "headers": { + "accept": "application/json, text/plain, */*", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", + "content-type": "multipart/form-data; boundary=----WebKitFormBoundaryqdEn9VkmYdIUEwRi", + "sec-ch-ua": "\"Microsoft Edge\";v=\"113\", \"Chromium\";v=\"113\", \"Not-A.Brand\";v=\"24\"", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\"Windows\"", + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "same-site" + }, + "referrer": "https://store.steampowered.com/", + "referrerPolicy": "strict-origin-when-cross-origin", + "body": "------WebKitFormBoundaryqdEn9VkmYdIUEwRi\r\nContent-Disposition: form-data; name=\"input_json\"\r\n\r\n{\"account_name\":\"111\",\"encrypted_password\":\"dviiPhtg5dYHb9Pv4LSdg/5JTvoEdII+Wcwi8KS6DR3NZHBs4oqxej3NY64icVPDZz3nLqJJ1IWCDUsQgqG0KDa3lT6L9Q9BdgX+Rml63rzYa8lBtwS1dzDngfkDqPjVNY+CM8y7NE6SVJFloY5obiCBeIVqC1ldLTl31h01a6yMY5ylWc18mE6zlO3nrqA75f/YiiDgehp/06kEa6N/PTtF/QhvB01iLrGPGJya1JwnPpfvaX/nWTiy0z6XszuNojsw+oIHKml8VPvc1QPNXf1zeWGbfWURIFDTb63YLQ+w9GKJvEoQ2N3CHxTTaBWS+UrUGtJcA2gsBEuJURwHDw==\",\"encryption_timestamp\":\"64904150000\",\"remember_login\":true,\"persistence\":1,\"website_id\":\"Store\",\"device_details\":{\"device_friendly_name\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.50\",\"platform_type\":2},\"language\":6,\"qos_level\":2}\r\n------WebKitFormBoundaryqdEn9VkmYdIUEwRi--\r\n", + "method": "POST", + "mode": "cors", + "credentials": "omit" + }); + +} \ No newline at end of file -- GitLab