Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Net;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Windows.Forms;
- using System.IO;
- using System.Diagnostics;
- using System.Web;
- namespace VoteBot
- {
- class Votifier
- {
- public static void Main()
- {
- Logger(Post("http://icraftsmp.net/premiumshop/scripts/login-script.php", "Username=olimoli123&Password=oi212134143212121"));
- }
- public static string Post(string url, string data)
- {
- string vystup = null;
- try
- {
- //Our postvars
- byte[] buffer = Encoding.ASCII.GetBytes(data);
- //Initialisation, we use localhost, change if appliable
- HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url);
- //Our method is post, otherwise the buffer (postvars) would be useless
- WebReq.Method = "POST";
- //We use form contentType, for the postvars.
- WebReq.ContentType = "application/x-www-form-urlencoded";
- //The length of the buffer (postvars) is used as contentlength.
- WebReq.ContentLength = buffer.Length;
- //We open a stream for writing the postvars
- Stream PostData = WebReq.GetRequestStream();
- //Now we write, and afterwards, we close. Closing is always important!
- PostData.Write(buffer, 0, buffer.Length);
- PostData.Close();
- //Get the response handle, we have no true response yet!
- HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
- //Let's show some information about the response
- Console.WriteLine(WebResp.StatusCode);
- Console.WriteLine(WebResp.Server);
- //Now, we read the response (the string), and output it.
- Stream Answer = WebResp.GetResponseStream();
- StreamReader _Answer = new StreamReader(Answer);
- vystup = _Answer.ReadToEnd();
- MessageBox.Show(WebResp.StatusDescription);
- //Congratulations, you just requested your first POST page, you
- //can now start logging into most login forms, with your application
- //Or other examples.
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- return vystup.Trim() + "\n";
- }
- public static string Logger(string LogThis)
- {
- string vystup = null;
- try
- {
- // Create a writer and open the file:
- StreamWriter log;
- if (!File.Exists("logfile.txt"))
- {
- log = new StreamWriter("logfile.txt");
- }
- else
- {
- log = File.AppendText("logfile.txt");
- }
- // Write to the file:
- log.WriteLine(DateTime.Now);
- log.WriteLine(LogThis);
- log.WriteLine();
- // Close the stream:
- log.Close();
- }
- catch (NullReferenceException ex)
- {
- MessageBox.Show(ex.Message);
- }
- return vystup;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement