Esempio n. 1
0
        //private void GetAllCaptchasetting()
        //{
        //    try
        //    {

        //        faceboardpro.Domain.Captcha objCaptcha = new faceboardpro.Domain.Captcha();
        //        ICollection<faceboardpro.Domain.Captcha> lstCaptcha = objCaptchaRepositry.GetAllCaptchaSetting(objCaptcha);

        //        foreach (faceboardpro.Domain.Captcha item in lstCaptcha)
        //        {
        //            try
        //            {
        //                string Username = item.Username;
        //                string PassWord = item.Password;
        //                string CaptchaService = item.CaptchaService;
        //                string Status = item.Status;

        //                if (CaptchaService.Contains("DBC"))
        //                {
        //                    txtDbcUserName.Text = Username;
        //                    txtDbcPassword.Text = PassWord;
        //                    CurrentCaptchaUserName = Username;
        //                    CurrentCaptchaPassword = PassWord;
        //                    isExitDBCSetting = true;
        //                    if (Status == "True")
        //                    {
        //                        CurrentCaptchaSetting = "DBC";
        //                        rdbDBC.Checked = true;
        //                    }
        //                }
        //                if (CaptchaService.Contains("Decaptcher"))
        //                {
        //                    txtDecaptchaerUserName.Text = Username;
        //                    txtDecaptcherPassword.Text = PassWord;
        //                    CurrentCaptchaUserName = Username;
        //                    CurrentCaptchaPassword = PassWord;
        //                    isExitDecaptcherSetting = true;
        //                    if (Status == "True")
        //                    {
        //                        CurrentCaptchaSetting = "Decaptcher";
        //                        rdbDecaptcher.Checked = true;
        //                    }
        //                }

        //                if (CaptchaService.Contains("Anigate"))
        //                {
        //                    txtAnigateUserName.Text = Username;
        //                    txtAnigatePassword.Text = PassWord;
        //                    CurrentCaptchaUserName = Username;
        //                    CurrentCaptchaPassword = PassWord;

        //                    isExitAnigateSetting = true;
        //                    if (Status == "True")
        //                    {
        //                        CurrentCaptchaSetting = "Anigate";
        //                        rdbAniGate.Checked = true;
        //                    }
        //                }

        //                if (CaptchaService.Contains("ImageTyperz"))
        //                {
        //                    txtImageTyperzUserName.Text = Username;
        //                    txtImageTypezPassword.Text = PassWord;
        //                    CurrentCaptchaUserName = Username;
        //                    CurrentCaptchaPassword = PassWord;
        //                    isExitImageTypezSetting = true;
        //                    if (Status == "True")
        //                    {
        //                        CurrentCaptchaSetting = "ImageTyperz";
        //                        rdbImageTyperz.Checked = true;
        //                    }
        //                }
        //            }
        //            catch (Exception ex)
        //            {
        //                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
        //    }
        //}

        public string ResolveCaptchaByCaptchaService(byte[] imageBytes)
        {
            string CaptchaReturnValue = string.Empty;
            try
            {

                Captchas.Captcha objcaptcha = new Captchas.Captcha();
                CaptchaFactory objCaptchaDBC = new DBCService();
                CaptchaFactory objCaptchaDeacaptcher = new DecaptcherService();
                CaptchaFactory objCaptchaAnigat = new AnigateService();
                CaptchaFactory objCaptchaImageTyperz = new imagetyperzService();

                if (CurrentCaptchaSetting.Contains("DBC"))
                {
                    objcaptcha = objCaptchaDBC.resolveRecaptcha(imageBytes, CurrentCaptchaUserName, CurrentCaptchaPassword);
                }
                else if (CurrentCaptchaSetting.Contains("Decaptcher"))
                {
                    objcaptcha = objCaptchaDeacaptcher.resolveRecaptcha(imageBytes, CurrentCaptchaUserName, CurrentCaptchaPassword);
                }
                else if (CurrentCaptchaSetting.Contains("Anigate"))
                {
                    objcaptcha = objCaptchaAnigat.resolveRecaptcha(imageBytes, CurrentCaptchaUserName, CurrentCaptchaPassword);
                }
                else if (CurrentCaptchaSetting.Contains("ImageTyperz"))
                {
                    objcaptcha = objCaptchaImageTyperz.resolveRecaptcha(imageBytes, CurrentCaptchaUserName, CurrentCaptchaPassword);
                }
                CaptchaReturnValue = objcaptcha.CaptchaImage.ToString();

            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            return CaptchaReturnValue;

        }
Esempio n. 2
0
        public void FindCaptcha()
        {
            try
            {
                CaptchaFactory objCaptchafactory = new DBCService();
                bool processFindcapthastart = true;
                while (processFindcapthastart)
                {


                    try
                    {

                        if (webHotmail.Document != null)
                        {
                            try
                            {
                                imageBytes = null;
                                processFindcapthastart = false;
                                string id = string.Empty;
                                string webdocument = webHotmail.Document.Body.OuterHtml;

                                string[] datalist = System.Text.RegularExpressions.Regex.Split(webdocument, "id=");
                                foreach (var item in datalist)
                                {

                                    if (item.Contains("wlspispHIPBimg") && !item.Contains(".gif"))
                                    {
                                        id = item.Substring(0, item.IndexOf("src=")).Trim();
                                        break;
                                    }
                                }
                                IHTMLImgElement img = null;
                                try
                                {
                                    id = id.Replace("\"", "");
                                    img = (IHTMLImgElement)webHotmail.Document.All[id].DomElement;
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }

                                IHTMLElementRenderFixed irend = (IHTMLElementRenderFixed)img;
                                Bitmap bmp = new Bitmap(img.width, img.height);
                                Graphics g = Graphics.FromImage(bmp);
                                IntPtr hdc = g.GetHdc();
                                irend.DrawToDC(hdc);
                                g.ReleaseHdc(hdc);
                                g.Dispose();
                                //  ImageCaptcha.Image = bmp;
                                bmp.Save(@"C:\Facedominator\logs\HOTMAILdecaptcha" + Fname + ".jpg");



                                string _ImageUrl = Path.Combine(@"C:\Facedominator\logs\HOTMAILdecaptcha" + Fname + ".jpg");
                                System.Net.WebClient webClient = new System.Net.WebClient();
                                imageBytes = webClient.DownloadData(_ImageUrl);

                              

                                if (CheckDbcUserNamePassword)
                                {

                                    Captcha Recaptcha = objCaptchafactory.resolveRecaptcha(imageBytes, CurrentCaptchaUserName, CurrentCaptchaPassword);

                                    CaptchaPic.LoadAsync(_ImageUrl);

                                    FillCaptcha();
                                    
                                }

                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }