Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using SteamKit2;
  7.  
  8. namespace Steam_Acc_Report
  9. {
  10. class Program
  11. {
  12. static string user, pass;
  13.  
  14. static SteamClient steamClient;
  15. static CallbackManager manager;
  16. static SteamUser steamUser;
  17. static bool isRunning;
  18. static void Main(string[] args)
  19. {
  20. Console.Title = "Steam Report Bot";
  21. Console.WriteLine("Steam Report Bot");
  22.  
  23. Console.Write("Username: ");
  24. user = Console.ReadLine();
  25. Console.Write("Password: ");
  26. pass = Console.ReadLine();
  27.  
  28. SteamLogin();
  29.  
  30. }
  31.  
  32. static void SteamLogin()
  33. {
  34. steamClient = new SteamClient();
  35. manager = new CallbackManager(steamClient);
  36. steamUser = steamClient.GetHandler<SteamUser>();
  37. new Callback<SteamClient.ConnectedCallback>(OnConnected, manager);
  38. new Callback<SteamUser.LoggedOnCallback>(OnLoggedOn, manager);
  39. steamClient.Connect();
  40.  
  41. isRunning = true;
  42. Console.WriteLine("Attempting to connect");
  43. while (isRunning)
  44. {
  45. manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
  46. }
  47. Console.ReadKey();
  48.  
  49. }
  50.  
  51. static void OnConnected(SteamClient.ConnectedCallback callback)
  52. {
  53. if(callback.Result != EResult.OK)
  54. {
  55. Console.WriteLine("Cannot connect to Steam: {0}", callback.Result);
  56. isRunning = false;
  57. return;
  58.  
  59. }
  60. Console.WriteLine("Connected to Steam! \n Logging in {0}... \n", user);
  61. steamUser.LogOn(new SteamUser.LogOnDetails { Username = user, Password = pass,});
  62. }
  63.  
  64. static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
  65. {
  66. if(callback.Result != EResult.AccountLogonDenied)
  67. {
  68. Console.WriteLine("Account has steamguard :( \n");
  69. return;
  70. }
  71. if (callback.Result != EResult.OK)
  72. {
  73. Console.WriteLine("Unable to login to steam {0} \n", callback.Result);
  74. isRunning = false;
  75. return;
  76.  
  77. }
  78. Console.WriteLine("{0} Successfully logged in!", user);
  79. Console.ReadKey();
  80. Environment.Exit(0);
  81. }
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement