Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. // By default equires a JSON file with your steam account data,
  2. // as defined with the PATH variable.
  3. // You can just define the accounts object yourself, just make sure
  4. // to use the correct property names.
  5.  
  6. require('console-stamp')(console, 'HH:MM:ss.l') // npm install console-stamp - or just comment out if you don't need timestamps
  7.  
  8. const SteamUser = require('steam-user') // npm install steam-user
  9. const steamtotp = require('steam-totp') // npm install steam-totp
  10.  
  11. const fs = require('fs')
  12. const rs = require('readline').createInterface({
  13. input: process.stdin,
  14. output: process.stdout
  15. })
  16.  
  17. const PATH = 'steamdata.json'
  18. const GAMES = [730]
  19.  
  20. let data
  21. if (fs.existsSync(PATH)) {
  22. data = JSON.parse(fs.readFileSync(PATH))
  23. } else throw 'Steam account data file not found.'
  24.  
  25. let account = data.main // If you are lazy and don't want to deal with JSON files, just comment some stuff above and add an object with the data here.
  26.  
  27. function hide (client) {
  28. client.gamesPlayed([399220, 399080, 399480])
  29. console.log(`Attempted to hide recent games.`)
  30. }
  31.  
  32. function login (client) {
  33. client.logOn({
  34. accountName: account.name,
  35. password: account.password
  36. })
  37. }
  38.  
  39. let client = new SteamUser()
  40.  
  41. client.setOption('promptSteamGuardCode', false)
  42.  
  43. login(client)
  44.  
  45. client.on('steamGuard', (domain, callback) => {
  46. console.log(`steamGuard event received.`)
  47. if (account.shasec) {
  48. steamtotp.getAuthCode(account.shasec, (err, code, offset, latency) => {
  49. if (err) throw err
  50. console.log(`Got mobile auth code (${code}) with a delay of ${latency} ms.`)
  51. callback(code)
  52. })
  53. } else {
  54. rs.question(`${domain ? 'Email' : 'Mobile'} code: `, code => callback(code))
  55. }
  56. })
  57.  
  58. client.on('loggedOn', details => {
  59. console.log(`Logged on from ${details.public_ip}.`)
  60. hide(client)
  61. setInterval(hide, 2*60*1000, client)
  62. })
  63.  
  64. client.on('error', err => {
  65. let i = (err.message === 'RateLimitExceeded' ? 30*60*1000 : 2*60*1000)
  66. console.log(`Error '${err.message}' catched, retrying in ${(i/1000)/60} minutes.`)
  67.  
  68. client.logOff()
  69. setTimeout(login, i, client)
  70. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement