Пример #1
0
        public IWebDriver createNewJSDriver(C_Proxy proxy = null)
        {
            IWebDriver _driver;
            var        driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            driverService.LoadImages = false; //reduce ram usage

            if (proxy != null)
            {
                if (proxy.auth)
                {
                    driverService.ProxyType           = "socks5";
                    driverService.ProxyAuthentication = String.Format("{0}:{1}", proxy.username, proxy.password);
                }
                else
                {
                    driverService.ProxyType = "http";
                }

                driverService.Proxy           = proxy.address;
                driverService.IgnoreSslErrors = true;
            }

            var driverOptions = new PhantomJSOptions();

            driverOptions.AddAdditionalCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36");

            _driver = new PhantomJSDriver(driverService, driverOptions);
            return(_driver);
        }
Пример #2
0
        public bool Login(Profile profile, DataGridViewCell cell, C_Proxy proxy)
        {
            cell.Value = "Connecting to login page...";
            IWebDriver _driver = profile._driver;

            _driver = createNewJSDriver(proxy);
            _driver.Navigate().GoToUrl("https://cp." + Properties.Settings.Default.locale + "/web/eCom/" + marketsList[Properties.Settings.Default.code] + "/loadsignin?target=account");

            if (ElementDisplayed(_driver, By.Id("username"), 40))
            {
                //executing javascript is much faster than sending keys
                ((IJavaScriptExecutor)_driver).ExecuteScript(String.Format("document.getElementById('username').value='{0}'", profile.Email));
                ((IJavaScriptExecutor)_driver).ExecuteScript(String.Format("document.getElementById('password').value='{0}'", profile.Password));
                ((IJavaScriptExecutor)_driver).ExecuteScript("document.getElementById('rememberme').click()");
                ((IJavaScriptExecutor)_driver).ExecuteScript("document.getElementById('signinSubmit').click()");
                cell.Value = "Logging in...";
            }
            else
            {
                cell.Value = "Error while connecting to login page";
                cell.Style = new DataGridViewCellStyle {
                    ForeColor = System.Drawing.Color.Red
                };
                _driver.Quit();
                return(false);
            }


            if (LoggedIn(_driver, 60))
            {
                cell.Value = "Logged in!";
                System.Threading.Thread.Sleep(500);

                profile.loggedin = true;
                foreach (OpenQA.Selenium.Cookie cookie in _driver.Manage().Cookies.AllCookies)
                {
                    if (cookie.Domain.Contains("adidas"))
                    {
                        profile.Cookies.Add(new C_Cookie {
                            name = cookie.Name, value = cookie.Value, domain = cookie.Domain, expiry = cookie.Expiry
                        });
                    }
                }
                _driver.Quit();
                return(true);
            }
            else
            {
                profile.loggedin = false;
                cell.Value       = _driver.FindElement(By.CssSelector(".errorcommon.errorcommonshow")).Text;
                cell.Style       = new DataGridViewCellStyle {
                    ForeColor = System.Drawing.Color.Red
                };
                _driver.Quit();
                return(false);
            }
        }
Пример #3
0
        private void updateProxyRows(C_Proxy proxy, int index)
        {
            DataGridViewRow row = dataGridView2.Rows[index];

            row.Cells[0].Value = proxy.address;
            row.Cells[1].Value = proxy.refresh.ToString();
            row.Cells[2].Value = proxy.auth.ToString();
            row.Cells[3].Value = proxy.username;
        }
Пример #4
0
        private string cartSplash(Profile profile, DataGridViewCell cell, DataGridViewRowCollection rows)
        {
            cell.Value = "Waiting for HMAC...(check settings page)";
            C_Proxy   proxy   = null;
            C_Session session = null;

            if (!proxy_running && profile.splashmode == 1)
            {
                Task.Run(() => runProxyList(profile, rows));

                while (proxylist.FirstOrDefault(s => proxy.passed) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                cell.Value = "GOT HMAC!";

                proxy = proxylist.FirstOrDefault(s => proxy.passed && s.hmac_cookie.expiry > DateTime.Now);
            }
            else if (!sessions_running && profile.splashmode == 2)
            {
                for (int i = 0; i < Properties.Settings.Default.sessions_count; i++)
                {
                    sessionlist.Add(new C_Session {
                        refresh = false
                    });
                }
                for (int i = 0; i < Properties.Settings.Default.r_sessions_count; i++)
                {
                    sessionlist.Add(new C_Session {
                        refresh = true
                    });
                }

                rows.Clear();

                foreach (C_Session s in sessionlist)
                {
                    rows.Add(new string[] { "session", s.refresh.ToString(), "False", null, null, null, null, null, null });
                }

                Task.Run(() => runSessionList(profile, rows));

                while (sessionlist.FirstOrDefault(x => x.passed == true) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                cell.Value = "GOT HMAC!";

                session = sessionlist.FirstOrDefault(s => s.passed && s.hmac_cookie.expiry > DateTime.Now);
            }

            return(cartNoSplash(profile, cell, proxy, session));
        }
Пример #5
0
        private void runProxy(Profile profile, int index, DataGridViewRow row)
        {
            C_Proxy proxy = proxylist[index];

            proxy.index = index;

            row.Cells[8].Value = "Setting up...";

            string pipename = Process.GetCurrentProcess().Id.ToString() + "_proxy_" + index.ToString();

            var pipe = new NamedPipeServerStream(pipename, PipeDirection.InOut, 1);

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo           = new ProcessStartInfo();
            process.StartInfo.FileName  = "3s_atc - browser.exe";
            process.StartInfo.Arguments = profile.SplashUrl + " " + pipename + " " + Properties.Settings.Default.splashidentifier + " " + Properties.Settings.Default.productpageidentifier + " " + Properties.Settings.Default.refresh_interval.ToString();
            process.Start();

            pipe.WaitForConnection();

            proxy.pid = process.Id;
            proxy.hideShow();

            try
            {
                StreamWriter writer = new StreamWriter(pipe);

                if (gmail_loggedin)
                {
                    string gmailCookiesData = SerializeCefCookies(gmail_cookies);
                    writer.WriteLine(gmailCookiesData);
                    writer.Flush();
                }

                string proxyData = SerializeProxy(proxy);
                writer.WriteLine(proxyData);
                writer.Flush();

                StreamReader reader = new StreamReader(pipe);

                while (true)
                {
                    string str = reader.ReadLine();
                    if (!String.IsNullOrEmpty(str))
                    {
                        parseMessage(index, str, row, false, true);
                    }
                }
            }

            catch (IOException exception)
            {
                MessageBox.Show(String.Format("Session {0} error: {1}\n", index.ToString(), exception.Message));
            }
        }
Пример #6
0
        private void editProxy_Click(Object sender, System.EventArgs e)
        {
            int            index          = currentMouseOverRow2;
            C_Proxy        proxy          = helpers.proxylist[index];
            Form_ProxyEdit form_proxyedit = new Form_ProxyEdit(proxy, this.helpers);

            form_proxyedit.StartPosition = FormStartPosition.CenterParent;
            form_proxyedit.ShowDialog();

            updateProxyRows(proxy, index);
        }
Пример #7
0
        public void guestMode_Cart(Profile profile, DataGridViewRowCollection rows)
        {
            C_Proxy   proxy   = null;
            C_Session session = null;

            if (!proxy_running && profile.splashmode == 1)
            {
                Task.Run(() => runProxyList(profile, rows));

                while (proxylist.FirstOrDefault(s => proxy.passed) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                proxy = proxylist.FirstOrDefault(s => proxy.passed && s.hmac_cookie.expiry > DateTime.Now);
                MessageBox.Show("proxy_" + proxy.index.ToString() + " : on product page! Right click on the session and show the window in order to purchase the shoe!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (!sessions_running && profile.splashmode == 2)
            {
                for (int i = 0; i < Properties.Settings.Default.sessions_count; i++)
                {
                    sessionlist.Add(new C_Session {
                        refresh = false
                    });
                }
                for (int i = 0; i < Properties.Settings.Default.r_sessions_count; i++)
                {
                    sessionlist.Add(new C_Session {
                        refresh = true
                    });
                }

                rows.Clear();

                foreach (C_Session s in sessionlist)
                {
                    rows.Add(new string[] { "session_" + s.index.ToString(), s.refresh.ToString(), "False", null, null, null, null, null, null });
                }

                Task.Run(() => runSessionList(profile, rows));

                while (sessionlist.FirstOrDefault(x => x.passed == true) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                session = sessionlist.FirstOrDefault(s => s.passed == true);
                MessageBox.Show("session_" + session.index.ToString() + " : on product page! Right click on the session and show the window in order to purchase the shoe!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #8
0
        private string SerializeProxy(C_Proxy data)
        {
            System.Xml.Serialization.XmlSerializer xsSubmit = new System.Xml.Serialization.XmlSerializer(typeof(C_Proxy));
            var xml = "";

            using (var sww = new StringWriter())
            {
                using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(sww))
                {
                    xsSubmit.Serialize(writer, data);
                    xml = sww.ToString();
                }
            }

            return(xml);
        }
Пример #9
0
        public bool login(Profile profile, DataGridViewCell cell, C_Proxy proxy)
        {
            if (!cell.Value.ToString().ToLower().Contains("login") && !profile.loggedin)
            {
                cell.Value = "Logging in...";

                while (loggingin_emails.Find(x => x == profile.Email) != null && profiles.FirstOrDefault(x => x.Email == profile.Email && x.loggedin) == null)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                return(Login(profile, cell, proxy));
            }

            return(false);
        }
Пример #10
0
        public Form_ProxyEdit(C_Proxy proxy, Helpers helpers)
        {
            InitializeComponent();

            this.proxy   = proxy;
            this.helpers = helpers;

            textBox_Address.Text = proxy.address;

            if (proxy.auth)
            {
                textBox_Username.Text = proxy.username;
                textBox_Password.Text = proxy.password;
            }

            checkBox_Auth.Checked   = proxy.auth;
            checkBox_Bypass.Checked = proxy.refresh;
        }
Пример #11
0
        private string cartSplash(Profile profile, DataGridViewCell cell, DataGridViewRowCollection rows)
        {
            if (!proxy_running)
            {
                Task.Factory.StartNew(() => runProxyList(profile, rows));
            }

            cell.Value = "Waiting for HMAC...(check settings page)";

            while (passedSplash.Count == 0)
            {
                System.Threading.Thread.Sleep(1000);
            }

            cell.Value = "GOT HMAC!";

            C_Proxy proxy = passedSplash.FirstOrDefault(s => s.hmac_expiration > DateTime.Now);

            return(cartNoSplash(profile, cell, proxy));
        }
Пример #12
0
        public IWebDriver createNewJSDriver(C_Proxy proxy = null)
        {
            IWebDriver _driver;
            var        driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;

            if (proxy != null)
            {
                if (proxy.auth)
                {
                    driverService.ProxyAuthentication = String.Format("{0}:{1}", proxy.username, proxy.password);
                }

                driverService.Proxy           = proxy.address;
                driverService.ProxyType       = "http";
                driverService.IgnoreSslErrors = true;
            }

            _driver = new PhantomJSDriver(driverService);

            return(_driver);
        }
Пример #13
0
        private string webRequestPost(Profile profile, string url, Dictionary <string, string> post, C_Proxy proxy = null)
        {
            string postData = "";

            foreach (string key in post.Keys)
            {
                postData += HttpUtility.UrlEncode(key) + "="
                            + HttpUtility.UrlEncode(post[key]) + "&";
            }

            HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(url);

            webRequest.Method    = "POST";
            webRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36";

            if (proxy != null)
            {
                WebProxy webproxy = new WebProxy(proxy.address);

                if (proxy.auth)
                {
                    webproxy.Credentials = new NetworkCredential(proxy.username, proxy.password);
                }

                webRequest.Proxy = webproxy;
            }

            byte[] data = Encoding.ASCII.GetBytes(postData);

            webRequest.ContentType   = "application/x-www-form-urlencoded";
            webRequest.ContentLength = data.Length;

            CookieContainer cookies = new CookieContainer();

            if (proxy != null)
            {
                foreach (C_Cookie cookie in proxy.cookies)
                {
                    cookies.Add(new System.Net.Cookie(cookie.name, cookie.value)
                    {
                        Domain = cookie.domain
                    });
                }
            }

            foreach (C_Cookie cookie in profile.Cookies)
            {
                cookies.Add(new System.Net.Cookie(cookie.name, cookie.value)
                {
                    Domain = cookie.domain
                });
            }

            webRequest.CookieContainer = cookies;

            Stream requestStream = webRequest.GetRequestStream();

            requestStream.Write(data, 0, data.Length);
            requestStream.Close();

            HttpWebResponse myHttpWebResponse = (HttpWebResponse)webRequest.GetResponse();

            Stream       responseStream = myHttpWebResponse.GetResponseStream();
            StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default);

            string pageContent = myStreamReader.ReadToEnd();

            myStreamReader.Close();
            responseStream.Close();
            myHttpWebResponse.Close();

            return(pageContent);
        }
Пример #14
0
        private string cartNoSplash(Profile profile, DataGridViewCell cell, C_Proxy proxy = null)
        {
            Dictionary <string, string> post = new Dictionary <string, string>();

            string atcURL;

            if (profile.clientid && !String.IsNullOrWhiteSpace(profile.ClientID))
            {
                atcURL = "http://www." + Properties.Settings.Default.locale + "/on/demandware.store/Sites-adidas-" + Properties.Settings.Default.code + "-Site/" + marketsList[Properties.Settings.Default.code] + "/Cart-MiniAddProduct?clientId=" + profile.ClientID;
            }
            else
            {
                atcURL = "http://www." + Properties.Settings.Default.locale + "/on/demandware.store/Sites-adidas-" + Properties.Settings.Default.code + "-Site/" + marketsList[Properties.Settings.Default.code] + "/Cart-MiniAddProduct";
            }

            string result = null;

            if (proxy != null)
            {
                profile.Sitekey   = proxy.sitekey; profile.captcha = true;
                profile.ClientID  = proxy.clientid; profile.clientid = true;
                profile.Duplicate = proxy.duplicate; profile.duplicate = true;
            }

            if (Login(profile, cell, proxy))
            {
                if (profile.captcha && !String.IsNullOrWhiteSpace(profile.Sitekey))
                {
                    cell.Value = "SOLVE CAPTCHA!";
                    cell.Style = new DataGridViewCellStyle {
                        ForeColor = Color.Red
                    };

                    while (captchas.FirstOrDefault(s => s.sitekey.Contains(profile.Sitekey) && s.expiration > DateTime.Now) == null)
                    {
                        System.Threading.Thread.Sleep(1000);
                    }

                    C_Captcha captcha = captchas.FirstOrDefault(s => s.sitekey.Contains(profile.Sitekey) && s.expiration > DateTime.Now);
                    post.Add("g-recaptcha-response", captcha.response);

                    if (profile.duplicate && !String.IsNullOrWhiteSpace(profile.Duplicate))
                    {
                        post.Add(profile.Duplicate, captcha.response);
                    }

                    captchas.Remove(captcha);
                }

                cell.Value = "Checking sizes...";
                cell.Style = new DataGridViewCellStyle {
                    ForeColor = Color.Empty
                };

                string size = getFirstAvailableSize(profile.Sizes, profile.ProductID);
                if (size == null)
                {
                    return("No sizes available");
                }

                cell.Value = "Adding to cart...";
                post.Add("pid", size); post.Add("masterPid", profile.ProductID); post.Add("Quantity", "1"); post.Add("request", "ajax"); post.Add("responseformat", "json"); post.Add("sessionSelectedStoreID", "null"); post.Add("layer", "Add To Bag overlay");
                result = webRequestPost(profile, atcURL, post, proxy);
            }

            return(result);
        }
Пример #15
0
        void proxyRun(Profile profile, C_Proxy proxy, int i, DataGridViewRowCollection rows)
        {
            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;

            if (proxy.auth)
            {
                driverService.ProxyAuthentication = String.Format("{0}:{1}", proxy.username, proxy.password);
            }

            driverService.Proxy = proxy.address;
            //driverService.ProxyType = "http";

            rows[i].Cells[7].Value = "Setting up...";

            IWebDriver _driver;

            _driver = new PhantomJSDriver(driverService);
            _driver.Navigate().GoToUrl(profile.SplashUrl);

            if (ElementDisplayed(_driver, By.CssSelector(".message.message-1.hidden"), 60))
            {
                rows[i].Cells[7].Value = "On splash page...";

                while (_driver.FindElements(By.Id("captcha")).Count <= 0)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                rows[i].Cells[7].Value = "Splash page passed!";
                rows[i].Cells[7].Style = new DataGridViewCellStyle {
                    ForeColor = System.Drawing.Color.Green
                };

                string cookie_name = _driver.Manage().Cookies.AllCookies.FirstOrDefault(s => s.Value.Contains("hmac")).Name;
                proxy.hmac             = _driver.Manage().Cookies.AllCookies.FirstOrDefault(s => s.Value.Contains("hmac")).Value;
                proxy.hmac_expiration  = _driver.Manage().Cookies.AllCookies.FirstOrDefault(s => s.Value.Contains("hmac")).Expiry;
                rows[i].Cells[3].Value = proxy.hmac;
                proxy.sitekey          = _driver.FindElement(By.Id("captcha")).GetAttribute("data-sitekey");
                rows[i].Cells[4].Value = proxy.sitekey;
                proxy.clientid         = _driver.FindElement(By.Id("flashproductform")).GetAttribute("action").Split(new string[] { "clientId=" }, StringSplitOptions.None)[1];
                rows[i].Cells[5].Value = proxy.clientid;
                proxy.duplicate        = getDuplicate(_driver.PageSource, _driver.FindElement(By.XPath("//link[@rel='canonical']")).GetAttribute("href"));
                rows[i].Cells[6].Value = proxy.duplicate;

                rows[i].Cells[7].Value = "HMAC and Sitekey retrieved!";
                foreach (OpenQA.Selenium.Cookie cookie in _driver.Manage().Cookies.AllCookies)
                {
                    if (cookie.Domain.Contains("adidas"))
                    {
                        proxy.cookies.Add(new C_Cookie {
                            name = cookie.Name, value = cookie.Value, domain = cookie.Domain, expiry = cookie.Expiry
                        });
                    }
                }

                passedSplash.Add(proxy);

                if (proxy.auth)
                {
                    File.AppendAllText("logs.txt", String.Format("Proxy --- Address : {0} --- Username: {1} --- Password: {2} / Cookie --- Name: {3} --- Value : {4} / Sitekey: {5} / Client ID : {6} / Duplicate : {7}", proxy.address, proxy.username, proxy.password, cookie_name, proxy.hmac, proxy.sitekey, proxy.clientid, proxy.duplicate) + Environment.NewLine);
                }
                else
                {
                    File.AppendAllText("logs.txt", String.Format("Proxy --- Address : {0} / Cookie --- Name: {1} --- Value : {2} / Sitekey: {3} / Client ID : {4} / Duplicate : {5}", proxy.address, cookie_name, proxy.hmac, proxy.sitekey, proxy.clientid, proxy.duplicate) + Environment.NewLine);
                }

                File.WriteAllText(String.Format("{0}\\{1}_productpage_source.txt", AppDomain.CurrentDomain.BaseDirectory, profile.ProductID), _driver.PageSource);
                _driver.Quit();
            }
            else
            {
                rows[i].Cells[7].Value = "Error!";
                rows[i].Cells[7].Style = new DataGridViewCellStyle {
                    ForeColor = System.Drawing.Color.Red
                };

                _driver.Quit();
            }
        }
Пример #16
0
        private string webRequestPost(Profile profile, string url, Dictionary <string, string> post, C_Proxy proxy = null, C_Session session = null)
        {
            string postData = "";

            foreach (string key in post.Keys)
            {
                postData += HttpUtility.UrlEncode(key) + "="
                            + HttpUtility.UrlEncode(post[key]) + "&";
            }

            HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(url);

            webRequest.Method    = "POST";
            webRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36";

            if (profile.splashmode > 0)
            {
                webRequest.Referer = profile.SplashUrl;
            }
            else
            {
                webRequest.Referer = String.Format("http://www.{0}/", Properties.Settings.Default.locale);
            }

            if (proxy != null)
            {
                WebProxy webproxy = new WebProxy(proxy.address);

                if (proxy.auth)
                {
                    webproxy.Credentials = new NetworkCredential(proxy.username, proxy.password);
                }

                webRequest.Proxy = webproxy;
            }

            byte[] data = Encoding.ASCII.GetBytes(postData);

            webRequest.ContentType   = "application/x-www-form-urlencoded";
            webRequest.ContentLength = data.Length;

            CookieContainer cookies = new CookieContainer();

            List <C_Cookie> c_cookies;

            if (profiles.FirstOrDefault(x => x.Email == profile.Email && x.loggedin) != null)
            {
                c_cookies = profiles.FirstOrDefault(x => x.Email == profile.Email).Cookies;
            }
            else
            {
                c_cookies = profile.Cookies;
            }

            foreach (C_Cookie cookie in c_cookies)
            {
                cookies.Add(new System.Net.Cookie(cookie.name, cookie.value)
                {
                    Domain = cookie.domain
                });
            }

            if (proxy != null)
            {
                foreach (C_Cookie cookie in proxy.cookies)
                {
                    cookies.Add(new System.Net.Cookie(cookie.name, cookie.value)
                    {
                        Domain = cookie.domain
                    });
                }
            }
            else if (session != null)
            {
                foreach (C_Cookie cookie in session.cookies)
                {
                    cookies.Add(new System.Net.Cookie(cookie.name, cookie.value)
                    {
                        Domain = cookie.domain
                    });
                }
            }

            webRequest.CookieContainer = cookies;

            Stream requestStream = webRequest.GetRequestStream();

            requestStream.Write(data, 0, data.Length);
            requestStream.Close();

            HttpWebResponse myHttpWebResponse = (HttpWebResponse)webRequest.GetResponse();

            Stream       responseStream = myHttpWebResponse.GetResponseStream();
            StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default);

            string pageContent = myStreamReader.ReadToEnd();

            myStreamReader.Close();
            responseStream.Close();
            myHttpWebResponse.Close();

            return(pageContent);
        }
Пример #17
0
        private bool Login(Profile profile, DataGridViewCell cell, C_Proxy proxy)
        {
            if (profiles.FirstOrDefault(x => x.Email == profile.Email && x.loggedin) != null)
            {
                System.Threading.Thread.Sleep(100);
                cell.Value       = "Logged in!";
                profile.loggedin = true;
                return(true);
            }
            else
            {
                loggingin_emails.Add(profile.Email);
            }

            cell.Value = "Connecting to login page...";

            string url = "https://cp." + Properties.Settings.Default.locale + "/web/eCom/" + marketsList[Properties.Settings.Default.code] + "/loadsignin?target=account";

            string pipename = Process.GetCurrentProcess().Id.ToString() + "_login_" + profile.index.ToString();

            var pipe = new NamedPipeServerStream(pipename, PipeDirection.InOut, 1);

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo             = new ProcessStartInfo();
            process.StartInfo.FileName    = "3s_atc - browser.exe";
            process.StartInfo.Arguments   = url + " " + pipename + " " + profile.Email + " " + profile.Password;
            process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            process.Start();

            pipe.WaitForConnection();

            try
            {
                StreamReader reader = new StreamReader(pipe);

                while (true)
                {
                    string str = reader.ReadLine();
                    if (!String.IsNullOrEmpty(str))
                    {
                        switch (str)
                        {
                        case "loggingin":
                            cell.Value = "Logging in...";
                            break;

                        case "loggedin":
                            cell.Value       = "Logged in!";
                            profile.loggedin = true;
                            loggingin_emails.Remove(profile.Email);
                            break;

                        case "error":
                            cell.Value = "Error while connecting to login page";
                            cell.Style = new DataGridViewCellStyle {
                                ForeColor = System.Drawing.Color.Red
                            };
                            process.Kill();
                            return(false);

                        case "error_unknown":
                            cell.Value = "Unknown error while logging in.";
                            cell.Style = new DataGridViewCellStyle {
                                ForeColor = System.Drawing.Color.Red
                            };
                            process.Kill();
                            break;

                        default:
                            if (str.Contains("xml"))
                            {
                                List <C_Cookie> cookies = DeserializeCookies(str);
                                foreach (C_Cookie c in cookies)
                                {
                                    profile.Cookies.Add(c);
                                }
                                process.Kill();
                                return(true);
                            }
                            else if (str.StartsWith("error:"))
                            {
                                cell.Value = str.Split(new string[] { "error: " }, StringSplitOptions.None)[0];
                                cell.Style = new DataGridViewCellStyle {
                                    ForeColor = System.Drawing.Color.Red
                                };
                                process.Kill();
                                return(false);
                            }
                            break;
                        }
                    }
                }
            }
            catch (IOException exception)
            {
                MessageBox.Show(String.Format("NamedPipe error: {0}\n", exception.Message));
            }

            return(false);
        }