Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Net;
- using System.IO;
- using System.Security.Cryptography;
- namespace Kenyaty
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- timer1 = new Timer();
- timer1.Tick += new EventHandler(timer1_Tick);
- timer1.Interval = 1000; // in miliseconds
- }
- public System.Windows.Forms.Timer timer1;
- int messagemodeon = 0;
- public int topicid = 0;
- public string get_md5(string input)
- {
- // step 1, calculate MD5 hash from input
- MD5 md5 = System.Security.Cryptography.MD5.Create();
- byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
- byte[] hash = md5.ComputeHash(inputBytes);
- // step 2, convert byte array to hex string
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < hash.Length; i++)
- {
- sb.Append(hash[i].ToString("X2"));
- }
- return sb.ToString().ToLower();
- }
- public string Between(string value, string a, string b)
- {
- int posA = value.IndexOf(a);
- int posB = value.LastIndexOf(b);
- if (posA == -1)
- {
- return "";
- }
- if (posB == -1)
- {
- return "";
- }
- int adjustedPosA = posA + a.Length;
- if (adjustedPosA >= posB)
- {
- return "";
- }
- return value.Substring(adjustedPosA, posB - adjustedPosA);
- }
- private void button1_Click(object sender, EventArgs e)
- {
- timer1.Enabled = true;
- timer1.Start();
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- //set login user and pass variables
- var vbusername = username.Text;
- var vbpasswordmd5 = get_md5(password.Text);
- //login
- var request = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/login.php?do=login");
- var postData = "securitytoken=guest&do=login&s=&cookieuser=1&vb_login_password=&vb_login_md5password=" + vbpasswordmd5 + "&vb_login_md5password_utf=" + vbpasswordmd5 + "&vb_login_password_hint=סיסמא&vb_login_username=" + username.Text;
- var data = Encoding.ASCII.GetBytes(postData);
- request.Method = "POST";
- request.ContentType = "application/x-www-form-urlencoded";
- request.ContentLength = data.Length;
- request.KeepAlive = true;
- request.Host = "www.fxp.co.il";
- request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
- request.Referer = "https://www.fxp.co.il/";
- request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36";
- request.CookieContainer = new CookieContainer();
- using (var stream = request.GetRequestStream())
- {
- stream.Write(data, 0, data.Length);
- }
- var response = (HttpWebResponse)request.GetResponse();
- var cookieJar1 = response.Cookies;
- var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
- // Get security token
- var request2 = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/newthread.php?do=newthread&f=" + forumid.Text);
- request2.Method = "GET";
- request2.ContentType = "application/x-www-form-urlencoded";
- request2.KeepAlive = true;
- request2.Host = "www.fxp.co.il";
- request2.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
- request2.Referer = "Referer: https://www.fxp.co.il/forumdisplay.php?f=" + forumid.Text;
- request2.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36";
- request2.CookieContainer = new CookieContainer();
- request2.CookieContainer.Add(cookieJar1);
- var response2 = (HttpWebResponse)request2.GetResponse();
- var cookieJar2 = response2.Cookies;
- var responseString2 = new StreamReader(response2.GetResponseStream()).ReadToEnd();
- string[] securitytoken = Between(responseString2, @"securitytoken"" value=""", "\"").Split('"');
- string[] loggeduser = Between(responseString2, @"loggedinuser"" value=""", "\"").Split('"');
- string Asecuritytoken = securitytoken[0];
- string Aloggeduser = loggeduser[0];
- // Open thread OR Send message
- HttpWebRequest request3;
- string postData3;
- if (messagemodeon == 0) {
- request3 = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/newthread.php?do=postthread&f=" + forumid.Text);
- postData3 = "prefixid=dis&subject=" + title.Text + +topicid + "&message_backup=" + content.Text + topicid + "&message=" + content.Text + topicid + "&wysiwyg=1&s=&securitytoken=" + Asecuritytoken + "&f=" + forumid.Text + "&do=postthread&posthash=&poststarttime=&loggedinuser=" + Aloggeduser + "&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";
- }
- else{
- request3 = (HttpWebRequest)WebRequest.Create("https://www.fxp.co.il/private.php?do=insertpm&pmid=" + forumid.Text);
- postData3 = "recipients=" + forumid.Text + "&title=" + title.Text + "&message_backup=" + content.Text + "&message=" + content.Text + "&wysiwyg=1&s=&securitytoken=" + Asecuritytoken + "&do=insertpm&pmid=&forward=&sbutton=%D7%A9%D7%9C%D7%97+%D7%94%D7%95%D7%93%D7%A2%D7%94&savecopy=1&parseurl=1&s=&securitytoken=" + Asecuritytoken + "&do=insertpm&pmid=&forward=";
- }
- var data3 = Encoding.UTF8.GetBytes(postData3);
- request3.Method = "POST";
- request3.ContentType = "application/x-www-form-urlencoded";
- request3.ContentLength = data3.Length;
- request3.KeepAlive = true;
- request3.Host = "www.fxp.co.il";
- request3.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
- request3.Referer = "https://www.fxp.co.il/newthread.php?do=newthread&f=" + forumid.Text;
- request3.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36";
- request3.CookieContainer = new CookieContainer();
- request3.CookieContainer.Add(cookieJar1);
- using (var stream = request3.GetRequestStream())
- {
- stream.Write(data3, 0, data3.Length);
- }
- var response3 = (HttpWebResponse)request3.GetResponse();
- var cookieJar3 = response3.Cookies;
- var responseString3 = new StreamReader(response3.GetResponseStream()).ReadToEnd();
- loginfirstcode.Text = responseString;
- topicid++;
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- timer1.Stop();
- timer1.Enabled = false;
- }
- private void messageMode_CheckedChanged(object sender, EventArgs e)
- {
- if(messagemodeon == 0)
- {
- messagemodeon = 1;
- }
- else
- {
- messagemodeon = 0;
- }
- }
- private void loopTime_Leave(object sender, EventArgs e)
- {
- int n;
- bool isNumeric = int.TryParse(loopTime.Text, out n);
- if (isNumeric == true) {
- timer1.Interval = Int32.Parse(loopTime.Text);
- }
- else
- {
- MessageBox.Show("Changes have not been made.Please enter a valid number.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement