Guest User

Untitled

a guest
Oct 20th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using TumblrSpammer.Tumblr;
  7. using System.Threading.Tasks;
  8.  
  9. namespace TumblrSpammer
  10. {
  11. class TumblrSpammer
  12. {
  13.  
  14. private TextWriter urlsWriter;
  15. private TextWriter emailsWriter;
  16.  
  17. private int done = 0;
  18.  
  19. public TumblrSpammer()
  20. {
  21. Action<object> doWork = (object obj) =>
  22. {
  23.  
  24. WorkerPreferences prefs = (WorkerPreferences)obj;
  25.  
  26. try
  27. {
  28. TumblrAccount account = new TumblrAccount();
  29.  
  30. if (account.Login(prefs.Email, prefs.Password))
  31. {
  32. Console.WriteLine("Successfully logged into " + prefs.Email + " posting..");
  33. account.PostText(prefs.Msg.Title, prefs.Msg.Body, prefs.Msg.Tags);
  34.  
  35. lock (urlsWriter)
  36. {
  37. urlsWriter.WriteLine(account.TumblrURL);
  38. urlsWriter.Flush();
  39. }
  40.  
  41. // snag them mobile emails
  42. foreach (string email in account.GetMobileEmails())
  43. {
  44. lock (emailsWriter)
  45. {
  46. emailsWriter.WriteLine(email);
  47. }
  48. }
  49.  
  50. lock (emailsWriter)
  51. {
  52. emailsWriter.Flush();
  53. }
  54.  
  55. }
  56. else
  57. {
  58. Console.WriteLine("login on account "+prefs.Email+" failed! wrong username / password");
  59. }
  60. }
  61. catch (Exception e)
  62. {
  63. Console.WriteLine("Couldn't post on account "+prefs.Email+" due to error.");
  64. }
  65.  
  66. done++;
  67.  
  68. };
  69.  
  70. urlsWriter = new StreamWriter("urls.txt");
  71. emailsWriter = new StreamWriter("emails.txt");
  72.  
  73. string row;
  74. string[] parts;
  75. TextReader tr = new StreamReader("accounts.txt");
  76.  
  77. Message[] msgs = Messages.GetMessages();
  78.  
  79. Random r = new Random();
  80.  
  81. int total = 0;
  82. while ((row = tr.ReadLine()) != null)
  83. {
  84. parts = row.Split(':');
  85. if (parts.Length < 2) continue;
  86.  
  87. WorkerPreferences prefs = new WorkerPreferences();
  88. prefs.Email = parts[0];
  89. prefs.Password = parts[1];
  90.  
  91. prefs.Msg = msgs[r.Next(0, msgs.Length)];
  92.  
  93. Task.Factory.StartNew(doWork, prefs);
  94. total++;
  95. }
  96.  
  97. // block until done
  98. while (done != total) continue;
  99.  
  100. Console.WriteLine("Done Nigguh");
  101.  
  102. emailsWriter.Close();
  103. urlsWriter.Close();
  104.  
  105. tr.Close();
  106.  
  107. }
  108.  
  109. }
  110.  
  111. }
Add Comment
Please, Sign In to add comment