Advertisement
Guest User

Untitled

a guest
Oct 19th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.03 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.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Text.RegularExpressions;
  11. using System.Net;
  12. using System.Security.Cryptography;
  13. using System.IO;
  14. using System.Timers;
  15.  
  16. namespace FxpBot
  17. {
  18. public partial class Form1 : Form
  19. {
  20. public Form1()
  21. {
  22. InitializeComponent();
  23.  
  24. //Setting topic timer
  25. topictimer.Tick += new EventHandler(timer1_Tick);
  26. topictimer.Interval = 7000;
  27. topictimer.Enabled = false;
  28.  
  29.  
  30. //Setting message timer
  31. messagetimer.Tick += Messagetimer_Tick;
  32. messagetimer.Interval = 25000;
  33. messagetimer.Enabled = false;
  34.  
  35.  
  36. }
  37.  
  38. private void Messagetimer_Tick(object sender, EventArgs e)
  39. {
  40. messagetimerfunction();
  41. }
  42.  
  43. //--- ---
  44. //MESSAGE TIMER
  45. public void messagetimerfunction()//Message function code
  46. {
  47. //No error so far
  48.  
  49. //Declaring local variables
  50. string currentuser;
  51. string currentpassword;
  52. string currentverify;
  53.  
  54. //Start user loop
  55.  
  56. for (int i = 0; i < listrowsnum; i++)
  57. {//STARTING EACH USER LOOP
  58.  
  59. //Setting user and pass variables
  60. currentuser = listrows[i, 0];
  61. currentpassword = listrows[i, 1];
  62. currentverify = listrows[i, 2];
  63. string[] currentuserdetails;
  64. CookieCollection currentindexcookies;
  65. CookieCollection currentcookies;
  66. string messagetimerforumid = "21";
  67.  
  68. currentindexcookies = GoToFXP();
  69. currentcookies = GetLoginCookies(currentindexcookies, currentuser, currentpassword, 0);
  70.  
  71. if (currentcookies == null)//If couldn't log in
  72. {
  73.  
  74. //Skip user and remove from list
  75. listrows[i, 2] = "0";//Mark user as a wrong user
  76. messagelog.Text += currentuser + " could not log in successfully, going to the next user.\n";
  77. continue;//Only then skip
  78.  
  79. }
  80. else//If could log in only then dare to commit the TOKENID function
  81. {
  82. currentuserdetails = GetTokenAndID(currentcookies, messagetimerforumid);
  83.  
  84.  
  85. }
  86.  
  87.  
  88.  
  89.  
  90. if (currentverify == "0")//If user has been marked as unsuccesful
  91. {
  92. continue;//Skip to next user
  93. }
  94.  
  95. else if (currentuserdetails.Length == 1)//Means couldn't get token and id, user is in ban or just doesn't work
  96. {
  97. //Skip user and remove from list
  98. listrows[i, 2] = "0";//Mark user as a wrong user
  99. messagelog.Text += currentuser + " is probably banned or something went wrong, going to the next user.\n";
  100. continue;//Only then skip
  101. }
  102.  
  103.  
  104. else//If hasn't got into any trouble so far continue to attempt to spam
  105. {
  106. TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
  107. int secondsSinceEpoch = (int)t.TotalSeconds;
  108.  
  109. int currentmessagestatus = PostMessage(currentcookies, currentuserdetails[0], currentuserdetails[1], messagevictim.Text, messagetitle.Text, messagecontent.Text + secondsSinceEpoch);
  110.  
  111. if (currentmessagestatus == 2)//If succeeded
  112. {
  113. messagesnumberint++;//Update topics number
  114. messagesnumber.Text = topicsnumberint.ToString();//Update and print the topics number textbox
  115.  
  116. messagelog.Text += currentuser + " has sent a message successfully.\n";
  117.  
  118. }
  119.  
  120. }
  121.  
  122. }//ENDING EACH USER LOOP
  123.  
  124.  
  125.  
  126. messagelog.Text += "-----------------------\n";//Print signs and a new line to indicate this run of the timer has ended
  127.  
  128. }
  129. //END MESSAGE TIMER
  130. //--- ---
  131.  
  132.  
  133. private void timer1_Tick(object sender, EventArgs e)
  134. {
  135. topictimerfunction();
  136. }
  137.  
  138. System.Windows.Forms.Timer topictimer = new System.Windows.Forms.Timer();
  139. System.Windows.Forms.Timer messagetimer = new System.Windows.Forms.Timer();
  140.  
  141. //--- ---
  142. //TOPIC TIMER
  143. public void topictimerfunction()
  144. {
  145.  
  146. //No error so far
  147.  
  148. //Declaring local variables
  149. string currentuser;
  150. string currentpassword;
  151. string currentverify;
  152. //Start user loop
  153.  
  154. for (int i = 0; i < listrowsnum; i++)
  155. {//STARTING EACH USER LOOP
  156.  
  157. //Setting user and pass variables
  158. currentuser = listrows[i, 0];
  159. currentpassword = listrows[i, 1];
  160. currentverify = listrows[i, 2];
  161. string[] currentuserdetails;
  162. CookieCollection currentindexcookies;
  163. CookieCollection currentcookies;
  164.  
  165. currentindexcookies = GoToFXP();
  166. currentcookies = GetLoginCookies(currentindexcookies, currentuser, currentpassword, 1);
  167.  
  168.  
  169. if (currentcookies == null)//If couldn't log in
  170. {
  171.  
  172. //Skip user and remove from list
  173. listrows[i, 2] = "0";//Mark user as a wrong user
  174. topiclog.Text += currentuser + " could not log in successfully, going to the next user.\n";
  175. continue;//Only then skip
  176.  
  177. }
  178. else//If could log in only then dare to commit the TOKENID function
  179. {
  180.  
  181. currentuserdetails = GetTokenAndID(currentcookies, forumid.Text);
  182.  
  183. }
  184.  
  185.  
  186.  
  187.  
  188. if (currentverify == "0")//If user has been marked as unsuccesful
  189. {
  190. continue;//Skip to next user
  191. }
  192.  
  193. else if (currentuserdetails.Length == 1)//Means couldn't get token and id, user is in ban or just doesn't work
  194. {
  195. //Skip user and remove from list
  196. listrows[i, 2] = "0";//Mark user as a wrong user
  197. topiclog.Text += currentuser + " is probably banned or something went wrong, going to the next user.\n";
  198. continue;//Only then skip
  199. }
  200.  
  201.  
  202. else//If hasn't got into any trouble so far continue to attempt to spam
  203. {
  204. TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
  205. int secondsSinceEpoch = (int)t.TotalSeconds;
  206.  
  207. int currenttopicstatus = PostTopic(currentcookies, currentuserdetails[0], currentuserdetails[1], forumid.Text, topictitlebox.Text, topiccontentbox.Text + secondsSinceEpoch);
  208.  
  209. if (currenttopicstatus == 5)//If succeeded
  210. {
  211. topicsnumberint++;//Update topics number
  212. topicsnumber.Text = topicsnumberint.ToString();//Update and print the topics number textbox
  213.  
  214. topiclog.Text += currentuser + " has opened a topic successfully.\n";
  215.  
  216. }
  217. else if (currenttopicstatus == 3)
  218. {
  219. topiclog.Text += currentuser + " has to wait a few more seconds.\n";
  220. }
  221. else
  222. {
  223. topiclog.Text += currentuser + " could not open a topic for some reason.\n";
  224. }
  225.  
  226. }
  227.  
  228. }//ENDING EACH USER LOOP
  229.  
  230.  
  231.  
  232. topiclog.Text += "-----------------------\n";//Print signs and a new line to indicate this run of the timer has ended
  233.  
  234. }
  235. //END TOPIC TIMER
  236. //--- ---
  237.  
  238. //Pre aranging variables
  239. string[,] listrows = new string[100, 3];//username, password, is user verified
  240.  
  241. int listrowsnum = 0;
  242. int topicsnumberint = 0;
  243. int messagesnumberint = 0;
  244. int istopicrunning = 0;
  245. bool doeshavetowait15 = false;
  246. int lastwait15minutes;
  247. int ismessagerunning = 0;
  248.  
  249. public static bool IsOdd(int value)
  250. {
  251. return value % 2 != 0;
  252. }
  253.  
  254. public bool IsTextUserValid()
  255. {
  256. listrowsnum = 0;
  257. string currentusertext = usertext.Text;
  258.  
  259.  
  260. MatchCollection matches;
  261. Regex pattern = new Regex(@"([a-zA-Z0-9_א-ת ]{3,})");
  262. matches = pattern.Matches(currentusertext);
  263. if (IsOdd(matches.Count) == true || matches.Count == 0)//If matches are not even it means users number isn't equal to passwords number, invalid
  264. {
  265. return false;
  266. }
  267.  
  268. int p = 0;
  269. for (int i = 0; i < matches.Count; i++)
  270. {
  271.  
  272. if (IsOdd(i) == false)//If the current match is username
  273. {
  274. listrows[p, 0] = matches[i].Value;//Set username
  275. listrows[p, 2] = "1";//Set user verify mode to 1 = true
  276.  
  277. }
  278. //If the current match is password
  279. else
  280. {
  281. listrows[p, 1] = matches[i].Value;
  282. p++;//Add 1 to p, adding only every user, NOT every match
  283. listrowsnum++;//Adding 1 to rowsnum
  284. }
  285. }
  286.  
  287. return true;
  288. }
  289.  
  290. public string GetMD5(string input)
  291.  
  292. {
  293.  
  294. // step 1, calculate MD5 hash from input
  295.  
  296. MD5 md5 = System.Security.Cryptography.MD5.Create();
  297.  
  298. byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
  299.  
  300. byte[] hash = md5.ComputeHash(inputBytes);
  301.  
  302. // step 2, convert byte array to hex string
  303.  
  304. StringBuilder sb = new StringBuilder();
  305.  
  306. for (int i = 0; i < hash.Length; i++)
  307.  
  308. {
  309.  
  310. sb.Append(hash[i].ToString("X2"));
  311.  
  312. }
  313.  
  314. return sb.ToString();
  315.  
  316. }
  317.  
  318. public bool IsNumeric(string number)
  319. {
  320. int n;
  321. bool IsNumericBool = int.TryParse(number, out n);
  322. return IsNumericBool;
  323. }
  324. public CookieCollection GoToFXP()
  325. {
  326. //Creating the request
  327. HttpWebRequest indexrequest = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/");
  328.  
  329. //Setting headers
  330. indexrequest.Host = "www.fxp.co.il";
  331. indexrequest.KeepAlive = true;
  332. indexrequest.Method = "GET";
  333. indexrequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
  334. indexrequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
  335. indexrequest.Headers.Add("Accept-Language", "he-IL,he;q=0.8,en-US;q=0.6,en;q=0.4");
  336. indexrequest.AutomaticDecompression = DecompressionMethods.GZip;
  337. indexrequest.Timeout = 2000;
  338.  
  339. indexrequest.CookieContainer = new CookieContainer();
  340.  
  341. //Setting the content length
  342. string index_get_data = "";
  343. var indexdata = Encoding.UTF8.GetBytes(index_get_data);
  344.  
  345. //Setting content length header
  346. indexrequest.ContentLength = indexdata.Length;
  347.  
  348.  
  349. try
  350. {
  351. var indexresponse = (HttpWebResponse)indexrequest.GetResponse();
  352.  
  353. string indexsresponsestring = new StreamReader(indexresponse.GetResponseStream()).ReadToEnd();
  354.  
  355. return indexresponse.Cookies;
  356. }
  357. catch (WebException e)
  358. {
  359. return StringCookiesToCollection(GetIndexPreCookies());
  360. }
  361.  
  362. }
  363.  
  364. public string GetIndexPreCookies()
  365. {
  366. return "visid_incap_12480=5W1466LVTC+kkk91qKgPzpo8BlgAAAAAQUIPAAAAAAAgtF/gOHddXrl6Zj7d/G+U; expires=Wed, 18 Oct 2017 08:49:58 GMT; path=/; Domain=.fxp.co.il; nlbi_12480=FzpGQfydv2iC1QiJz82m+gAAAACPxABoP6uvNp0pRuNBzg2v; path=/; Domain=.fxp.co.il; incap_ses_264_12480=WzI+VTIzETqNxW6cz+upA5o8BlgAAAAAJ5iKTFgCBVhCQljl4VRRUQ==; path=/; Domain=.fxp.co.il";
  367. }
  368.  
  369. public bool DoesContain(string text, string pattern)
  370. {
  371. Regex regexpattern = new Regex(pattern);
  372. if (regexpattern.IsMatch(text))
  373. {
  374. return true;
  375. }
  376. else
  377. {
  378. return false;
  379. }
  380. }
  381. public CookieCollection StringCookiesToCollection(string cookies)
  382. {
  383. //New cookie collection
  384. CookieCollection currentcookiecollection = new CookieCollection();
  385.  
  386. //Preparing premade cookies
  387. string precookie = cookies;
  388. //Split by ';' and add
  389. string[] splittedprecookie = precookie.Split(' ');
  390.  
  391. //Add each cookie
  392. for (int i = 0; i < splittedprecookie.Length; i++)
  393. {
  394. string[] cookienameandvalue = splittedprecookie[i].Split(new char[] { '=' }, 2);
  395.  
  396. string[] cookievaluesplitted = cookienameandvalue[1].Split(';');//ERROR HERE
  397. string cookievalue = cookievaluesplitted[0];
  398.  
  399. currentcookiecollection.Add(new Cookie(cookienameandvalue[0], cookievalue));
  400.  
  401. }
  402.  
  403. return currentcookiecollection;
  404.  
  405. }
  406.  
  407. public String CookiesCollectionToString(CookieCollection cookies)
  408. {
  409. CookieCollection currentcookiecollection = cookies;
  410. string returnstring = "";
  411.  
  412. string subbix = "; ";
  413.  
  414. for (int i = 0; i < currentcookiecollection.Count; i++)
  415. {
  416. returnstring += currentcookiecollection[i].Name + "=" + currentcookiecollection[i].Value;
  417.  
  418. if (i != currentcookiecollection.Count - 1)//If isn't the last cookie
  419. {
  420. returnstring += subbix;
  421. }
  422.  
  423. }
  424.  
  425. return returnstring;
  426.  
  427. }
  428.  
  429. public CookieCollection GetPreCookies()
  430. {
  431. //New cookie collection
  432. CookieCollection currentcookiecollection = new CookieCollection();
  433.  
  434. //Preparing premade cookies
  435. string precookie = "nlbi_12480=9aLtOa+ZdD9l/Ntjz82m+gAAAAA2y1kCrOr0eM6ak1UjUdLg; _dy_ses_load_seq=56172%3A1476699223915; _dy_csc_ses=t; _dy_c_exps=; _ga=GA1.3.1206978354.1476699225; _gat=1; visid_incap_12480=IEvkSQwWRVSBvmGOBiTxXlakBFgAAAAAQUIPAAAAAABPLCtvscoWjj+mHiOv0B4k; incap_ses_418_12480=tW0sQHm+VFvUVDYxJgnNBVakBFgAAAAA9M1u887c4olbrj7D/06LCA==; visid_incap_152115=9GubNMrsSXGFup6CDsnMw1ekBFgAAAAAQUIPAAAAAABggPiDgk8j0th24B0vh00w; incap_ses_418_152115=q8BGaHHi9yWJVTYxJgnNBVekBFgAAAAARpbTZRl594HRZziK43zkBA==; _dyid=2112188372742349912; _dyfs=true; _dycst=dk.w.c.ws.frv1.frs.; _dy_geo=IT.EU.IT_17.IT_17_Marco; _dy_df_geo=Italy..Marco; _dy_toffset=-2; _dyus_8767177=0%7C0%7C0%7C0%7C0%7C0.0.1476699226167.1476699226167.0.0%7C290%7C43%7C9%7C116%7C1%7C0%7C0%7C0%7C0%7C0%7C0%7C1%7C0%7C0%7C0%7C0%7C0%7C1%7C0%7C0%7C0%7C0%7C0";
  436.  
  437. //Split by ';' and add
  438. string[] splittedprecookie = precookie.Split(' ');
  439.  
  440. //Add each cookie
  441. for (int i = 0; i < splittedprecookie.Length; i++)
  442. {
  443. string[] cookienameandvalue = splittedprecookie[i].Split(new char[] { '=' }, 2);
  444.  
  445. string[] cookievaluesplitted = cookienameandvalue[1].Split(';');
  446. string cookievalue = cookievaluesplitted[0];
  447.  
  448. currentcookiecollection.Add(new Cookie(cookienameandvalue[0], cookievalue));
  449.  
  450. }
  451.  
  452. return currentcookiecollection;
  453.  
  454. }
  455.  
  456.  
  457.  
  458. public CookieCollection GetLoginCookies(CookieCollection cookies, string LoginUser, string LoginPassword, int isittopic)
  459. {
  460. //Preparing variables
  461. LoginPassword = GetMD5(LoginPassword);
  462.  
  463. //Setting post content
  464. string login_data = "vb_login_username=" + LoginUser + "&vb_login_password_hint=%D7%A1%D7%99%D7%A1%D7%9E%D7%94&vb_login_password=&s=&securitytoken=guest&do=login&cookieuser=1&vb_login_md5password=ac30be895d5f219e7ab29f3678237b7c&vb_login_md5password_utf=ac30be895d5f219e7ab29f3678237b7c";
  465.  
  466. //Creating the request
  467. HttpWebRequest loginrequest = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/login.php?do=login");
  468.  
  469. //Setting headers
  470. loginrequest.Host = "www.fxp.co.il";
  471. loginrequest.KeepAlive = true;
  472. loginrequest.Method = "POST";
  473. loginrequest.CookieContainer = new CookieContainer();
  474. loginrequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
  475. loginrequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
  476. loginrequest.Referer = "https://www.fxp.co.il/login.php?do=login";
  477. loginrequest.ContentType = "application/x-www-form-urlencoded";
  478. loginrequest.Credentials = CredentialCache.DefaultCredentials;
  479. loginrequest.ServicePoint.Expect100Continue = false;
  480.  
  481.  
  482.  
  483.  
  484. loginrequest.Headers.Add("Upgrade-Insecure-Requests", "1");
  485. loginrequest.Headers.Add("Cache-Control", "max-age=0");
  486. loginrequest.Headers.Add("Origin", "https://www.fxp.co.il");
  487. loginrequest.Headers.Add("Accept-Language", "he-IL,he;q=0.8,en-US;q=0.6,en;q=0.4");
  488. loginrequest.AutomaticDecompression = DecompressionMethods.GZip;
  489.  
  490. //Add new cookie container
  491. loginrequest.CookieContainer = new CookieContainer();
  492. loginrequest.CookieContainer.Add(new Uri("https://www.fxp.co.il"), GetPreCookies());
  493.  
  494.  
  495. byte[] loginbytearray = Encoding.ASCII.GetBytes(login_data);
  496. loginrequest.ContentLength = loginbytearray.Length;
  497. Stream newStream = loginrequest.GetRequestStream(); //open connection
  498. newStream.Write(loginbytearray, 0, loginbytearray.Length); // Send the data.
  499. newStream.Close();
  500.  
  501. HttpWebResponse loginresponse = (HttpWebResponse)loginrequest.GetResponse();
  502. string htmlloginresponse;
  503. using (StreamReader sr = new StreamReader(loginresponse.GetResponseStream()))
  504. {
  505. htmlloginresponse = sr.ReadToEnd();
  506. }
  507.  
  508.  
  509. if (htmlloginresponse.Contains("אנא המתן 15 דקות לפני הנסיון הבא") == true || DoesContain(htmlloginresponse, "אנא המתן 15 דקות לפני הנסיון הבא") == true)
  510. {
  511. //Prepare time variables
  512. TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
  513. int secondsSinceEpoch = (int)t.TotalSeconds;
  514.  
  515. //If 15 minutes block is on set variable to true
  516. lastwait15minutes = secondsSinceEpoch;
  517. doeshavetowait15 = true;
  518.  
  519. if (isittopic == 1)//If the function calling GetCookies is for topic posting, act as for topic timer
  520. {
  521. //Stop the timer and exit with a message
  522. //Stop topic timer
  523. istopicrunning = 0;
  524. topictimer.Stop();
  525. topictimer.Enabled = false;
  526. topicsnumberint = 0;
  527. topicsnumber.Text = "0";
  528. topicsbutton.Text = "Spam topics";
  529.  
  530. topiclog.Text += "A 15 minutes waiting error occured, the attack stopped, wait for 15 more minutes.\n----------\n";
  531. }
  532. else//Else act as for message timer
  533. {
  534. //Stop the timer and exit with a message
  535. //Stop message timer
  536. ismessagerunning = 0;
  537. messagetimer.Stop();
  538. messagetimer.Enabled = false;
  539. messagesnumberint = 0;
  540. messagesnumber.Text = "0";
  541. messagebutton.Text = "Spam messages";
  542.  
  543. messagelog.Text += "A 15 minutes waiting error occured, the attack stopped, wait for 15 more minutes.\n----------\n";
  544. }
  545.  
  546.  
  547. return null;
  548.  
  549. }
  550.  
  551. if (htmlloginresponse.Contains("שם משתמש או סיסמה שגויים") == true)//Wrong pasword and username
  552. {
  553.  
  554. return null;
  555. }
  556.  
  557. return loginresponse.Cookies;
  558. }
  559.  
  560. public string Between(string value, string a, string b)
  561. {
  562. int posA = value.IndexOf(a);
  563. int posB = value.LastIndexOf(b);
  564. if (posA == -1)
  565. {
  566. return "";
  567. }
  568. if (posB == -1)
  569. {
  570. return "";
  571. }
  572. int adjustedPosA = posA + a.Length;
  573. if (adjustedPosA >= posB)
  574. {
  575. return "";
  576. }
  577. return value.Substring(adjustedPosA, posB - adjustedPosA);
  578. }
  579.  
  580. public CookieCollection SplitCookie(CookieCollection cookies)
  581. {
  582. CookieCollection newcookie = new CookieCollection();
  583. string[] getcookies = CookiesCollectionToString(cookies).Split(' ');
  584. string[] twocookieparts;
  585.  
  586. for (int i = 0; i < 8; i++)
  587. {
  588. twocookieparts = getcookies[i].Split(';');
  589. twocookieparts = twocookieparts[0].Split(new char[] { '=' }, 2);
  590. newcookie.Add(new Cookie(twocookieparts[0], twocookieparts[1]));
  591.  
  592. }
  593.  
  594. return newcookie;
  595.  
  596. }
  597.  
  598. public string[] GetTokenAndID(CookieCollection cookies, string forumidint)
  599. {
  600.  
  601.  
  602. //Creating the login request
  603. HttpWebRequest detailsrequest = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/newthread.php?do=newthread&f=" + forumidint);
  604.  
  605.  
  606. //Setting the attributes of the login request
  607. string details_post_data = "";
  608.  
  609. var detailsdata = Encoding.UTF8.GetBytes(details_post_data);
  610.  
  611. detailsrequest.Host = "www.fxp.co.il";
  612. detailsrequest.KeepAlive = true;
  613. detailsrequest.Method = "GET";
  614. detailsrequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36";
  615. detailsrequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
  616. detailsrequest.Referer = "https://www.fxp.co.il/newthread.php?do=newthread&f=" + forumidint;
  617. detailsrequest.ContentType = "application/x-www-form-urlencoded";
  618. detailsrequest.ContentLength = detailsdata.Length;
  619.  
  620. detailsrequest.Headers.Add("Upgrade-Insecure-Requests", "1");
  621. detailsrequest.Headers.Add("Cache-Control", "max-age=0");
  622. detailsrequest.Headers.Add("Origin", "https://www.fxp.co.il");
  623. detailsrequest.Headers.Add("Accept-Language", "he-IL,he;q=0.8,en-US;q=0.6,en;q=0.4");
  624. detailsrequest.CookieContainer = new CookieContainer();
  625. detailsrequest.CookieContainer.Add(new Uri("https://www.fxp.co.il"), GetPreCookies());
  626. detailsrequest.CookieContainer.Add(new Uri("https://www.fxp.co.il"), SplitCookie(cookies));
  627.  
  628.  
  629.  
  630. //Prepare return array variable
  631. string[] detailsarray = new string[2];
  632.  
  633. //Html details response
  634. var detailsresponse = (HttpWebResponse)detailsrequest.GetResponse();
  635. string detailsresponsestring = new StreamReader(detailsresponse.GetResponseStream()).ReadToEnd();
  636.  
  637. //Find security token by GetBetweenString
  638. detailsarray[0] = Between(detailsresponsestring, "securitytoken\" value=\"", ">");
  639. string[] splitdetails = detailsarray[0].Split('"');
  640. detailsarray[0] = splitdetails[0];
  641.  
  642. //Setting user id, currently no need in actual id
  643. detailsarray[1] = "1";
  644.  
  645. //Checks if user is in ban
  646. if (detailsresponsestring.Contains("הושעת מהאתר מהסיבה הבאה:"))
  647. {
  648. string[] isinban = new string[1];
  649. isinban[0] = "ERRORBAN";
  650. return isinban;//If is in ban returns array of only one variable
  651. }
  652.  
  653.  
  654. return detailsarray;
  655.  
  656. }
  657.  
  658.  
  659.  
  660. public int PostTopic(CookieCollection cookies, string currentsecuritytoken, string currentuserid, string forumidint, string topictitle, string topiccontent)
  661. {
  662.  
  663. //Creating the login request
  664. HttpWebRequest topicrequest = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/newthread.php?do=postthread&f=" + forumidint);
  665.  
  666.  
  667. //Setting the attributes of the login request
  668. string topic_post_data = "prefixid=dis&subject=" + topictitle + "&message_backup=" + topiccontent + "&message=" + topiccontent + "&wysiwyg=1&s=&securitytoken=" + currentsecuritytoken + "&f=" + forumidint + "&do=postthread&posthash=&poststarttime=&loggedinuser=" + currentuserid.ToString() + "&sbutton=%D7%A6%D7%95%D7%A8+%D7%90%D7%A9%D7%9B%D7%95%D7%9C+%D7%97%D7%93%D7%A9&signature=1&parseurl=1";
  669.  
  670. var topicdata = Encoding.UTF8.GetBytes(topic_post_data);
  671.  
  672. topicrequest.Host = "www.fxp.co.il";
  673. topicrequest.KeepAlive = true;
  674. topicrequest.Method = "POST";
  675. topicrequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36";
  676. topicrequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
  677. topicrequest.Referer = "https://www.fxp.co.il/newthread.php?do=newthread&f=" + forumidint;
  678. topicrequest.ContentType = "application/x-www-form-urlencoded";
  679. topicrequest.ContentLength = topicdata.Length;
  680.  
  681. topicrequest.Headers.Add("Upgrade-Insecure-Requests", "1");
  682. topicrequest.Headers.Add("Cache-Control", "max-age=0");
  683. topicrequest.Headers.Add("Origin", "https://www.fxp.co.il");
  684. topicrequest.Headers.Add("Accept-Language", "he-IL,he;q=0.8,en-US;q=0.6,en;q=0.4");
  685.  
  686. topicrequest.CookieContainer = new CookieContainer();
  687. topicrequest.CookieContainer.Add(new Uri("https://www.fxp.co.il"), GetPreCookies());
  688. topicrequest.CookieContainer.Add(new Uri("https://www.fxp.co.il"), SplitCookie(cookies));
  689.  
  690.  
  691. topicrequest.Headers.Add("Accept-Language", "he-IL,he;q=0.8,en-US;q=0.6,en;q=0.4");
  692. topicrequest.AutomaticDecompression = DecompressionMethods.GZip;
  693.  
  694.  
  695. using (Stream stream = topicrequest.GetRequestStream())
  696. {
  697. stream.Write(topicdata, 0, topicdata.Length);
  698. }
  699.  
  700. //Html topic response
  701. var topicresponse = (HttpWebResponse)topicrequest.GetResponse();
  702. string topicresponsestring = new StreamReader(topicresponse.GetResponseStream()).ReadToEnd();
  703. //Got banned = 0, other error = 1, succeded = 2, 3 = has to wait more seconds, 5 = succeeded
  704.  
  705. if(topicresponsestring.Contains("<div class=\"postbody\">") == true)
  706. {
  707.  
  708. return 5;
  709. }
  710.  
  711.  
  712.  
  713.  
  714. //Check if has to wait seconds
  715. if (topicresponsestring.Contains("המערכת דורשת זמן המתנה בין פרסום הודעות/אשכולות") == true)//Check if seconds waiting error occured
  716. {
  717. return 3;
  718.  
  719. }
  720.  
  721. //Check if is in ban
  722. //Checks if "הושעת מהאתר מהסיבה הבאה:" is printed, if so it means the user is banned
  723.  
  724. Regex topicbannedpattern = new Regex("הושעת מהאתר מהסיבה הבאה:");
  725. MatchCollection topicbannedmatches = topicbannedpattern.Matches(topicresponsestring);
  726.  
  727. if (topicbannedmatches.Count > 0)//If the ban message does appear
  728. {
  729. return 0;//The user is in ban, return 0
  730. }
  731.  
  732. return 2;//Otherwise return 2 as success
  733. }
  734.  
  735.  
  736. public int PostMessage(CookieCollection cookies, string currentsecuritytoken, string currentuserid, string messagevictim, string messagetitle, string messagecontent)
  737. {
  738. //Creating the login request
  739. HttpWebRequest messagerequest = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/private.php?do=insertpm&pmid=");
  740.  
  741. //Setting the attributes of the login request
  742. string message_post_data = "recipients=" + messagevictim + "&title=" + messagetitle + "&message_backup=" + messagecontent + "&message=" + messagecontent + "&wysiwyg=1&s=&securitytoken=" + currentsecuritytoken + "&do=insertpm&pmid=&forward=&sbutton=%D7%A9%D7%9C%D7%97+%D7%94%D7%95%D7%93%D7%A2%D7%94&savecopy=1&signature=1&parseurl=1&s=&securitytoken=" + currentsecuritytoken + "&do=insertpm&pmid=&forward=";
  743. var messagedata = Encoding.UTF8.GetBytes(message_post_data);
  744.  
  745. messagerequest.Host = "www.fxp.co.il";
  746. messagerequest.KeepAlive = true;
  747. messagerequest.Method = "POST";
  748. messagerequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36";
  749. messagerequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
  750. messagerequest.Referer = "https://www.fxp.co.il/private.php?do=newpm&u=" + currentuserid;
  751. messagerequest.ContentType = "application/x-www-form-urlencoded";
  752. messagerequest.ContentLength = messagedata.Length;
  753.  
  754. messagerequest.Headers.Add("Upgrade-Insecure-Requests", "1");
  755. messagerequest.Headers.Add("Cache-Control", "max-age=0");
  756. messagerequest.Headers.Add("Origin", "https://www.fxp.co.il");
  757. messagerequest.Headers.Add("Accept-Language", "he-IL,he;q=0.8,en-US;q=0.6,en;q=0.4");
  758. messagerequest.CookieContainer = new CookieContainer();
  759. messagerequest.CookieContainer.Add(new Uri("https://www.fxp.co.il"), GetPreCookies());
  760. messagerequest.CookieContainer.Add(new Uri("https://www.fxp.co.il"), SplitCookie(cookies));
  761.  
  762. using (Stream stream = messagerequest.GetRequestStream())
  763. {
  764. stream.Write(messagedata, 0, messagedata.Length);
  765. }
  766.  
  767. //Html message response
  768. var messageresponse = (HttpWebResponse)messagerequest.GetResponse();
  769. string messageresponsestring = new StreamReader(messageresponse.GetResponseStream()).ReadToEnd();
  770. //Got banned = 0, other error = 1, succeded = 2, 3 = has to wait more seconds
  771.  
  772. //Check if has to wait seconds
  773. if (messageresponsestring.Contains("שניות בין שליחת הודעות פרטיות") == true)//Check if seconds waiting error occured
  774. {
  775. string waitnumber = Between(messageresponsestring, "לפחות ", " שניות");
  776. //System.Threading.Thread.Sleep(3000);
  777.  
  778. }
  779.  
  780. //Check if is in ban
  781. //Checks if "הושעת מהאתר מהסיבה הבאה:" is printed, if so it means the user is banned
  782.  
  783. Regex messagebannedpattern = new Regex("הושעת מהאתר מהסיבה הבאה:");
  784. MatchCollection messagebannedmatches = messagebannedpattern.Matches(messageresponsestring);
  785.  
  786. if (messagebannedmatches.Count > 0)//If the ban message does appear
  787. {
  788. return 0;//The user is in ban, return 0
  789. }
  790.  
  791. return 2;//Otherwise return 2 as success
  792. }
  793.  
  794.  
  795. public bool IsValidVictim(string victim)
  796. {
  797. Regex victimpattern = new Regex("[a-zA-Z0-9_א-ת ]{3,}");
  798.  
  799. if (victimpattern.IsMatch(victim) == true)
  800. {
  801. return true;
  802. }
  803. else
  804. {
  805. return false;
  806. }
  807. }
  808.  
  809.  
  810. private void button2_Click(object sender, EventArgs e)//Messagebutton event
  811. {
  812. //Check if is topicloop is running
  813. if (ismessagerunning == 0)
  814. {
  815.  
  816. //Prepare time variables to check 15 minutes block error
  817. TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
  818. int secondsSinceEpoch = (int)t.TotalSeconds;
  819. int secondsleft = 900 - (secondsSinceEpoch - lastwait15minutes);
  820.  
  821. if (secondsSinceEpoch >= (lastwait15minutes + 900))//If can set doeshavetowait15 to false
  822. {
  823. doeshavetowait15 = false;//If 15 minutes passed reset it to false
  824. }
  825.  
  826.  
  827. if (doeshavetowait15 == true)//If user has to wait because of 15 minutes login error
  828. {
  829. MessageBox.Show("Since you have tried to log in too many times or an error occured, you have to wait 15 minutes.You have left " + secondsleft);
  830. }
  831. else if (IsTextUserValid() == false)//Check if user text is invalid
  832. {
  833. MessageBox.Show("The user text inserted isn't valid.");
  834. }
  835. else if (messagecontent.Text.Length < 2 || messagetitle.Text.Length < 1)//Check if message title and content are too short
  836. {
  837. MessageBox.Show("The message title must have at least 1 character, and the message content must have at least 2 characters.");
  838. }
  839. else if (IsValidVictim(messagevictim.Text) == false)//Check if message victim is invalid
  840. {
  841. MessageBox.Show("The message recipient inserted isn't valid.");
  842. }
  843. else//If everything is ok only then begin the loop
  844. {
  845.  
  846. messagetimerfunction();//Call the function immidietly otherwise it'll wait 30 seconds
  847.  
  848. ismessagerunning = 1;//Set to is activated
  849. messagetimer.Enabled = true;
  850. messagetimer.Start();//Start message timer and activate it
  851. messagebutton.Text = "Stop messages";
  852.  
  853.  
  854.  
  855.  
  856.  
  857. }
  858. }
  859. else//If it's already running
  860. {
  861. //Stop message timer
  862. ismessagerunning = 0;
  863. messagetimer.Stop();
  864. messagetimer.Enabled = false;
  865. messagesnumberint = 0;
  866. messagesnumber.Text = "0";
  867. messagebutton.Text = "Spam messages";
  868.  
  869. }
  870.  
  871.  
  872. }
  873.  
  874. private void topicsbutton_Click(object sender, EventArgs e)
  875. {
  876.  
  877. //Check if is topicloop is running
  878. if (istopicrunning == 0)
  879. {
  880.  
  881. //Prepare time variables to check 15 minutes block error
  882. TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
  883. int secondsSinceEpoch = (int)t.TotalSeconds;
  884. int secondsleft = 900 - (secondsSinceEpoch - lastwait15minutes);
  885.  
  886. if (secondsSinceEpoch >= (lastwait15minutes + 900))//If can set doeshavetowait15 to false
  887. {
  888. doeshavetowait15 = false;//If 15 minutes passed reset it to false
  889. }
  890.  
  891.  
  892. if (doeshavetowait15 == true)//If user has to wait because of 15 minutes login error
  893. {
  894. MessageBox.Show("Since you have tried to log in too many times or an error occured, you have to wait 15 minutes.You have left " + secondsleft);
  895. }
  896. else if (IsTextUserValid() == false)//Check if user text is invalid
  897. {
  898. MessageBox.Show("The user text inserted isn't valid.");
  899. }
  900. else if (topiccontentbox.Text.Length < 2 || topictitlebox.Text.Length < 1)//Check if topic and content are too short
  901. {
  902. MessageBox.Show("The topic title must have at least 1 character, and the topic content must have at least 2 characters.");
  903. }
  904. else if (IsNumeric(forumid.Text) == false)//Check if forum id is invalid
  905. {
  906. MessageBox.Show("The forum id inserted isn't valid.");
  907. }
  908. else//If everything is ok only then begin the loop
  909. {
  910.  
  911. topictimerfunction();//Call the function immidietly otherwise it'll wait 7 seconds
  912.  
  913. istopicrunning = 1;//Set to is activated
  914. topictimer.Enabled = true;
  915. topictimer.Start();//Start topic timer and activate it
  916. topicsbutton.Text = "Stop topics";
  917.  
  918.  
  919.  
  920.  
  921.  
  922. }
  923. }
  924. else//If it's already running
  925. {
  926. //Stop topic timer
  927. istopicrunning = 0;
  928. topictimer.Stop();
  929. topictimer.Enabled = false;
  930. topicsnumberint = 0;
  931. topicsnumber.Text = "0";
  932. topicsbutton.Text = "Spam topics";
  933.  
  934. }
  935.  
  936.  
  937.  
  938. }
  939.  
  940. private void button2_Click_1(object sender, EventArgs e)
  941. {
  942. messagelog.Text = "";
  943. }
  944.  
  945. private void button1_Click(object sender, EventArgs e)
  946. {
  947. topiclog.Text = "";
  948. }
  949. }
  950. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement