Пример #1
0
        void ClickSubmit(object o)
        {
            try
            {
                HtmlDocument doc = webBrowser1.Document;
                BrowserBot   bsb = new BrowserBot(doc);
                HtmlElement  el  = bsb.GetByNameAttr("captcha_response_field");
                bsb.SetValue(el, o as string);

                el = bsb.GetById("submit");
                bsb.Click(el);
            }
            catch (Exception e)
            {
            }
        }
Пример #2
0
        void ClickSubmit(object o)
        {
            try
            {
                HtmlDocument doc = webBrowser1.Document;
                BrowserBot bsb = new BrowserBot(doc);
                HtmlElement el = bsb.GetByNameAttr("captcha_response_field");
                bsb.SetValue(el, o as string);

                el = bsb.GetById("submit");
                bsb.Click(el);
            }
            catch (Exception e)
            {

            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            BrowserBot bb     = new BrowserBot(webBrowser1.Document);
            string     cookie = webBrowser1.Document.Cookie;

            HtmlElement el;

            el = bb.GetById("firstName");
            bb.SetValue(el, GetString());

            el = bb.GetById("lastName");
            bb.SetValue(el, GetString());

            _lastEmail = GetString() + "@asdasd.ru";
            el         = bb.GetById("email");
            bb.SetValue(el, _lastEmail);

            el = bb.GetById("city");
            bb.SetValue(el, GetString());

            _lastUser = GetString();
            el        = bb.GetById("username");
            bb.SetValue(el, _lastUser);

            _lastPwd = GetString() + "7";
            el       = bb.GetById("password");
            bb.SetValue(el, _lastPwd);

            el = bb.GetById("passwordConfirm");
            bb.SetValue(el, _lastPwd);

            HtmlElementCollection elc = webBrowser1.Document.GetElementsByTagName("img");

            foreach (HtmlElement item in elc)
            {
                string classAttr = new Regex(@"class=([^\s]*)").Match(item.OuterHtml).Groups[1].Value;
                if (classAttr == "oCaptchaImage")
                {
                    Uri           uri = new Uri(item.GetAttribute("src"));
                    DownloaderObj obj = new DownloaderObj(uri, null);
                    Downloader.DownloadSync(obj);
                    byte[] b = obj.Data;

                    Antigate.PostImage(b, ImgType.Jpg);
                }
            }



            #region GoogleAccounts

            /*
             * el = bb.FindById("GmailAddress");
             * bb.SetValue(el, Path.GetRandomFileName());
             *
             * string password = Path.GetRandomFileName();
             * el = bb.FindById("Passwd");
             * bb.SetValue(el, password);
             * el = bb.FindById("PasswdAgain");
             * bb.SetValue(el, password);
             *
             * el = bb.FindById("BirthDay");
             * int day = _rand.Next(1, 28);
             * bb.SetValue(el, day.ToString());
             *
             * el = bb.FindById("BirthMonth");
             * int month = _rand.Next(1, 13);
             * bb.SetComboBoxValue(el, month.ToString());
             *
             * el = bb.FindById("BirthYear");
             * int year = 1970 + _rand.Next(0, 30);
             * bb.SetValue(el, year.ToString());
             *
             * el = bb.FindById("Gender");
             * int gender = _rand.Next(0, 3);
             * string genderVal = string.Empty;
             * if (gender == 0)
             *  genderVal = "FEMALE";
             * else if (gender == 1)
             *          genderVal = "MALE";
             *  else if (gender == 2)
             *          genderVal = "OTHER";
             * bb.SetValue(el, genderVal);
             *
             * el = bb.FindById("CountryCode");
             * Regex country = new Regex("<OPTION value=(?<country>[^>]*)>");
             * MatchCollection contries = country.Matches(el.OuterHtml);
             * int i = _rand.Next(0, contries.Count);
             * bb.SetValue(el, contries[i].Groups["country"].Value);
             *
             * el = bb.FindById("HomepageSet");
             * el.OuterHtml = el.OuterHtml.Replace("CHECKED", "UNCHECKED");
             *
             * //el = bb.FindById("recaptcha_response_field");
             * //string capcha = "";
             * //bb.SetValue(el, capcha);
             *
             * el = bb.FindById("TermsOfService");
             * bb.SetCheckRadioBox(el, true);
             *
             * el = bb.FindById("submitbutton");
             * bb.Click(el);
             */
            #endregion
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            BrowserBot bb = new BrowserBot(webBrowser1.Document);
            string cookie = webBrowser1.Document.Cookie;

            HtmlElement el;
            el = bb.GetById("firstName");
            bb.SetValue(el, GetString());

            el = bb.GetById("lastName");
            bb.SetValue(el, GetString());

            _lastEmail = GetString() + "@asdasd.ru";
            el = bb.GetById("email");
            bb.SetValue(el, _lastEmail);

            el = bb.GetById("city");
            bb.SetValue(el, GetString());

            _lastUser = GetString();
            el = bb.GetById("username");
            bb.SetValue(el, _lastUser);

            _lastPwd = GetString() + "7";
            el = bb.GetById("password");
            bb.SetValue(el, _lastPwd);

            el = bb.GetById("passwordConfirm");
            bb.SetValue(el, _lastPwd);

            HtmlElementCollection elc = webBrowser1.Document.GetElementsByTagName("img");
            foreach (HtmlElement item in elc)
            {
                string classAttr = new Regex(@"class=([^\s]*)").Match(item.OuterHtml).Groups[1].Value;
                if (classAttr == "oCaptchaImage")
                {
                    Uri uri = new Uri(item.GetAttribute("src"));
                    DownloaderObj obj = new DownloaderObj(uri, null);
                    Downloader.DownloadSync(obj);
                    byte[] b = obj.Data;

                    Antigate.PostImage(b, ImgType.Jpg);
                }
            }

            #region GoogleAccounts
            /*
             el = bb.FindById("GmailAddress");
            bb.SetValue(el, Path.GetRandomFileName());

            string password = Path.GetRandomFileName();
            el = bb.FindById("Passwd");
            bb.SetValue(el, password);
            el = bb.FindById("PasswdAgain");
            bb.SetValue(el, password);

            el = bb.FindById("BirthDay");
            int day = _rand.Next(1, 28);
            bb.SetValue(el, day.ToString());

            el = bb.FindById("BirthMonth");
            int month = _rand.Next(1, 13);
            bb.SetComboBoxValue(el, month.ToString());

            el = bb.FindById("BirthYear");
            int year = 1970 + _rand.Next(0, 30);
            bb.SetValue(el, year.ToString());

            el = bb.FindById("Gender");
            int gender = _rand.Next(0, 3);
            string genderVal = string.Empty;
            if (gender == 0)
                genderVal = "FEMALE";
            else if (gender == 1)
                genderVal = "MALE";
            else if (gender == 2)
                genderVal = "OTHER";
            bb.SetValue(el, genderVal);

            el = bb.FindById("CountryCode");
            Regex country = new Regex("<OPTION value=(?<country>[^>]*)>");
            MatchCollection contries = country.Matches(el.OuterHtml);
            int i = _rand.Next(0, contries.Count);
            bb.SetValue(el, contries[i].Groups["country"].Value);

            el = bb.FindById("HomepageSet");
            el.OuterHtml = el.OuterHtml.Replace("CHECKED", "UNCHECKED");

            //el = bb.FindById("recaptcha_response_field");
            //string capcha = "";
            //bb.SetValue(el, capcha);

            el = bb.FindById("TermsOfService");
            bb.SetCheckRadioBox(el, true);

            el = bb.FindById("submitbutton");
            bb.Click(el);
             */
            #endregion
        }