Advertisement
Guest User

Untitled

a guest
Mar 11th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. // Credits to @sstokic-tgm for Sentry fix
  2. var username;
  3. var password;
  4. var steamCode;
  5.  
  6. var Steam = require("steam");
  7. var fs = require("fs");
  8. var readline = require("readline");
  9.  
  10. var steam = new Steam.SteamClient();
  11.  
  12. var rl = readline.createInterface({
  13. input: process.stdin,
  14. output: process.stdout
  15. });
  16.  
  17. rl.question("Username: ", function(answer) {
  18. username = answer;
  19. rl.question("Password: ", function(answer2) {
  20. password = answer2;
  21. rl.pause();
  22. steam.logOn({
  23. accountName: username,
  24. password: password
  25. });
  26. });
  27. });
  28.  
  29. steam.on("loggedOn", function(result) {
  30. console.log("Logged in");
  31. steam.setPersonaState(Steam.EPersonaState.Online);
  32. setTimeout (function() {
  33. process.exit();
  34. }, 10000);
  35. });
  36.  
  37. steam.on("error", function(error) {
  38. if (error.cause == "logonFail") {
  39. if (error.eresult == 63) {
  40. rl.resume();
  41. rl.question("Steam guard code: ", function(answer) {
  42. steamCode = answer;
  43. rl.close();
  44. steam.logOn({
  45. accountName: username,
  46. password: password,
  47. authCode: steamCode
  48. });
  49. });
  50. } else {
  51. console.log("Logon fail: " + error.eresult);
  52. };
  53. };
  54. });
  55.  
  56. steam.on('sentry', function(data) {
  57. var format = username + ".sentry";
  58. fs.writeFileSync(format, data);
  59. console.log("Sentry file successfully saved!");
  60. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement