seishun / node-steam

Interface directly with Steam servers from Node.js
MIT License
1.01k stars 180 forks source link

Steam Guard Sentry with MySQL Support #418

Closed muleyo closed 6 years ago

muleyo commented 6 years ago

Hello,

got a little problem with sentry over here.

SQL Query:

db.connect(err => { if (err) { console.error("[mysql] Can't connect to server:\n%s", err.stack); return process.exit(); } console.log('[mysql] Connected successfully'); });

db.query('SELECT * FROM hourboost', (err, rows) => { if (err) return console.error('[mysql] Failed to run query:\n%s', err.stack);

accounts = []; rows.forEach(row => { console.log(row); accounts.push([row.username, row.password, row.games, row.steamguard, row.sentry]); }); console.log('Loaded %s account(s)', accounts.length);

Sentry Store into DB:

  steamUser.on('updateMachineAuth', sentryData => {
    if (account[4] !== null) return;
    const sentry = sentryData.bytes.toString('base64');
    db.query('UPDATE hourboost SET sentry = ? WHERE username = ?', [sentry, account[0]], (err, rows, fields) => {
      if (err) return console.error('[mysql] Failed to update account:\n%s', err.stack);
    });
    console.log('Added Sentry to account!');
  });

That's how it should login with the sentry. But for some reason, it always requires a new SteamGuard-Code.. :S

setTimeout(() => {
  console.log('[%s] - Logging in.', account[0]);
  steamClient.connect();
  const sentry = account[4] === null ? null : new Buffer(account[4], 'base64');
  steamClient.on('connected', () => {
    steamUser.logOn({
      account_name: account[0],
      password: account[1],
      auth_code: account[3],
      sha_sentryfile: account[4]
    });
  });
muleyo commented 6 years ago

Fixed it by myself.

Here's the script: https://github.com/Triniayo/steam-hourboost-mysql