Пример #1
0
        public override Captcha resolveRecaptcha(byte[] imageBytes, string AccountKey, string ImagePath)
        {
            Captcha objCaptcha = new Captcha();

            try
            {
                ClsAnigates objAnigate = new ClsAnigates();

                string Captcha = objAnigate.GetCaptcha(AccountKey, ImagePath);
                objCaptcha.CaptchaImage = Captcha;
            }
            catch { };
            return(objCaptcha);
        }
Пример #2
0
        public override Captcha resolveRecaptcha(byte[] imageBytes, string Username, string Password)
        {
            Captcha objCaptcha = new Captcha();

            try
            {
                API.CAPTCHA.CAPTCHA objAPICaptcha = new API.CAPTCHA.CAPTCHA();

                string Captcha = objAPICaptcha.UploadCaptchaAndGetText(Username, Password, imageBytes);
                objCaptcha.CaptchaImage = Captcha;
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return(objCaptcha);
        }
Пример #3
0
        public override Captcha resolveRecaptcha(byte[] imageBytes, string Username, string Password)
        {
            string[] args = new string[] { Username, Password, "" };
            Captcha objCaptcha = new Captcha();
            DeathByCaptcha.Client client = (DeathByCaptcha.Client)new DeathByCaptcha.SocketClient(Username, Password);
            try
            {
               
                client.Verbose = true;

                Console.WriteLine("Your balance is {0:F2} US cents", client.Balance);

                for (int i = 2, l = args.Length; i < l; i++)
                {
                    try
                    {
                        Console.WriteLine("Solving CAPTCHA {0}", args[i]);

                        DeathByCaptcha.Captcha captcha = client.Decode(imageBytes, 2 * DeathByCaptcha.Client.DefaultTimeout);
                        if (null != captcha)
                        {
                            Console.WriteLine("CAPTCHA {0:D} solved: {1}", captcha.Id, captcha.Text);

                            objCaptcha.CaptchaImage = captcha.Text;
                            return objCaptcha;
                        }
                        else
                        {

                            Console.WriteLine("CAPTCHA was not solved");
                            return objCaptcha;
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return objCaptcha;
        }
Пример #4
0
        public override Captcha resolveRecaptcha(byte[] imageBytes, string Username, string Password)
        {
            Captcha objCaptcha = new Captcha();
            try
            {
                
                API.CAPTCHA.CAPTCHA objAPICaptcha = new API.CAPTCHA.CAPTCHA();

                string Captcha = objAPICaptcha.UploadCaptchaAndGetText(Username, Password, imageBytes);
                objCaptcha.CaptchaImage = Captcha;
              
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return objCaptcha;
        }
Пример #5
0
        public override Captcha resolveRecaptcha(byte[] imageBytes, string Username, string Password)
        {
            string[] args       = new string[] { Username, Password, "" };
            Captcha  objCaptcha = new Captcha();

            DeathByCaptcha.Client client = (DeathByCaptcha.Client) new DeathByCaptcha.SocketClient(Username, Password);
            try
            {
                client.Verbose = true;

                Console.WriteLine("Your balance is {0:F2} US cents", client.Balance);

                for (int i = 2, l = args.Length; i < l; i++)
                {
                    try
                    {
                        Console.WriteLine("Solving CAPTCHA {0}", args[i]);

                        DeathByCaptcha.Captcha captcha = client.Decode(imageBytes, 2 * DeathByCaptcha.Client.DefaultTimeout);
                        if (null != captcha)
                        {
                            Console.WriteLine("CAPTCHA {0:D} solved: {1}", captcha.Id, captcha.Text);

                            objCaptcha.CaptchaImage = captcha.Text;
                            return(objCaptcha);
                        }
                        else
                        {
                            Console.WriteLine("CAPTCHA was not solved");
                            return(objCaptcha);
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return(objCaptcha);
        }
Пример #6
0
        public override string SendCaptcha(out string captchaID, out bool success)
        {
            if (null == client)
            {
                client = new HttpClient(APIKeyOrName, APISourceOrPassword);
            }

            try
            {
                Captcha captcha = client.Decode(image, Client.DefaultTimeout);
                if (null != captcha)
                {
                    captchaID = captcha.Id.ToString();
                    success   = true;
                    return(captcha.Text);
                }
            }catch (Exception e) { }
            captchaID = "";
            success   = false;
            return("None");
        }
Пример #7
0
        public override Captcha resolveRecaptcha(byte[] imageBytes, string AccountKey, string ImagePath)
        {
            Captcha objCaptcha = new Captcha();
            try
            {
                ClsAnigates objAnigate = new ClsAnigates();

                string Captcha = objAnigate.GetCaptcha(AccountKey, ImagePath);
                objCaptcha.CaptchaImage = Captcha;
            }
            catch { };
            return objCaptcha;
        }
Пример #8
0
        public override Captcha resolveRecaptcha(byte[] imageBytes, string Username, string Password)
        {
             Captcha objCaptcha = new Captcha();
             try
             {
                 string DecaptcherHost = "Decaptcha.com";
                 int DecaptchaPort = 0;


                 /// code for convert bit[] to Image
                 byte[] buffer = imageBytes.ToArray();
                 MemoryStream memStream = new MemoryStream();
                 memStream.Write(buffer, 0, buffer.Length);
                 Image captcha = Image.FromStream(memStream);



                 Decaptcher objDecaptcher = new Decaptcher();
                // string CaptchaImage = objDecaptcher.decaptcha(imageBytes, DecaptcherHost, DecaptchaPort, Username, Password);
             }
             catch (Exception ex)
             {
                 GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
             }
            return objCaptcha;
        }
Пример #9
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;

        }