Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 03:10

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Image Captcha Solven

Discussion on Image Captcha Solven within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2020
Posts: 16
Received Thanks: 1
Question Image Captcha Solven (help)

Hi,

ich bin grade dabei ein Image Captcha zu lösen, bin auch zu 98% fertisch. Hab nur ein kleines Problemchen.

Ich muss die Captcha Antwort für sich rauslesen und einfügen (W9h5k)
Webseite wo der Captcha ist:
github Code vom Captcha Solver (Beispiel Code):
Mein Code:
Code:
using System;
using OpenQA.Selenium.Chrome;
using ImageTypers;
using OpenQA.Selenium;
using System.Threading;
using System.Collections.Generic;
using System.Linq;

namespace Test_Selenium
{
    class Program
    {
        static void Main(string[] args)
        {
            // Chrome Optionen festlegen
            ChromeOptions option = new ChromeOptions();
            //option.AddArgument("--headless");
            option.AddArguments("ignore-certificate-errors");

            // Chrome Service festlegen
            ChromeDriverService service = ChromeDriverService.CreateDefaultService();
            service.HideCommandPromptWindow = true;

            ChromeDriver WebDriver = new ChromeDriver(service, option);

            try
            {
                WebDriver.Navigate().GoToUrl("https://2captcha.com/demo/normal");               // go to normal test page
                                                                                                // get access token from: http://www.imagetyperz.com
                string token = "XXXX";
                ImageTypersAPI i = new ImageTypersAPI(token);

                // balance
                string balance = i.account_balance();
                Console.WriteLine(string.Format("Balance: {0}", balance));

                // optional parameters dict
                Dictionary<string, string> image_params = new Dictionary<string, string>();
                image_params.Add("iscase", "true");         // case sensitive captcha
                //image_params.Add("isphrase", "true");       // text contains at least one space (phrase)
                //image_params.Add("ismath", "true");         // instructs worker that a math captcha has to be solved
                //image_params.Add("alphanumeric", "1");      // 1 - digits only, 2 - letters only
                image_params.Add("minlength", "2");         // captcha text length (minimum)
                image_params.Add("maxlength", "5");         // captcha text length (maximum)

                Console.WriteLine("Waiting for captcha to be solved...");
                string captcha_id = i.submit_image("https://2captcha.com/template/demo/images/normal.jpg", image_params);
                Dictionary<string, string> response = i.retrieve_response(captcha_id);
                ImageTypers.Utils.print_response(response);

                var array = response.ToArray();
                var first = array[1];

                Console.WriteLine(first);

                //WebDriver.FindElementByXPath("/html/body/div[1]/div[2]/div/div/div/div[1]/div/div/div/div/div/div[2]/div/form/input").SendKeys(response);
            }
            finally
            {
                Console.WriteLine("Fertig");
                Console.ReadLine();
                WebDriver.Quit();
            }

        }

    }
}
Consolen output:
Code:
Balance: $15.2308
Waiting for captcha to be solved...
Response
--------------------------------
  "CaptchaId" - "15842269"
  "Response" - "w9h5k"
  "Cookie_OutPut" - ""
  "Proxy_reason" - ""
  "Recaptcha score" - "0.00"
  "Status" - "Solved"
--------------------------------
[Response, w9h5k]
Fertig
Liquidcit is offline  
Old 09/21/2021, 09:59   #2

 
Njahs's Avatar
 
elite*gold: 574
Join Date: Nov 2010
Posts: 2,498
Received Thanks: 726
Da die Response ein einfaches ist kannst du die Antwort wie folgt herausfinden:

Code:
[...]
Dictionary<string, string> response = i.retrieve_response(captcha_id);
var antwort = response["Response"];
[...]
Um auf die Textbox im Selenium zuzugreifen gibt es viele unterschiedliche , sei es über den Namen, die Klasse, einen oder eben . Mein Favorit ist in den meisten Fällen die CSS Variante, da man das ganz einfach im Browser selbst testen kann (Entwicklertools von Chrome):

Code:
WebDriver.FindElement(By.CssSelector("form input"));
oder
WebDriver.FindElement(By.CssSelector("input[name='answer']"));
Grüße
Njahs is offline  
Thanks
1 User
Old 09/21/2021, 11:16   #3
 
elite*gold: 0
Join Date: Mar 2020
Posts: 16
Received Thanks: 1
kann geschlossen werden, dankeschön <3
Liquidcit is offline  
Old 09/29/2021, 06:36   #4

 
elite*gold: 0
Join Date: Nov 2018
Posts: 178
Received Thanks: 48
Wenn ich Sie wäre, würde ich Selenium vermeiden und versuchen, eine native Lösung wie Javascript zu php und dann zu c# über json Speicherung verwenden
tehpwnerer69 is offline  
Old 10/01/2021, 19:08   #5


 
Else's Avatar
 
elite*gold: 4
The Black Market: 166/0/0
Join Date: Feb 2008
Posts: 3,854
Received Thanks: 1,268
Quote:
Originally Posted by tehpwnerer69 View Post
Wenn ich Sie wäre, würde ich Selenium vermeiden und versuchen, eine native Lösung wie Javascript zu php und dann zu c# über json Speicherung verwenden

Und dann zu C++.
Else is offline  
Old 10/01/2021, 23:24   #6

 
elite*gold: 0
Join Date: Nov 2018
Posts: 178
Received Thanks: 48
Quote:
Originally Posted by Else View Post
Und dann zu C++.
Und noch einmal zu BASIC
tehpwnerer69 is offline  
Old 10/02/2021, 08:23   #7


 
Else's Avatar
 
elite*gold: 4
The Black Market: 166/0/0
Join Date: Feb 2008
Posts: 3,854
Received Thanks: 1,268
Quote:
Originally Posted by tehpwnerer69 View Post
Und noch einmal zu BASIC
Eigentlich zu Python, Ruby o.Ä. Damit deine vorgeschlagenen Wege auch korrekt sind.
Else is offline  
Reply


Similar Threads Similar Threads
Lawl Image - Easy Image upload
10/08/2015 - Coding Releases - 132 Replies
Hier steht euch nun die gründlich überarbeitete Version von LawlImage zur verfügung! Mit LawlImage ist es einfach wie nie, schnell Bilder hochzuladen. Das einzige was ihr tun müsst, ist einen Rechtsklick auf das Bild auszuführen und unter "Senden an" oder "Send To" LawlImage zu wählen. Schneller kann man Bilder nicht hochladen! http://image.lawl-dev.com/imgsrv.php?url=79348bed 8d5da002ffc10d36f2e916d2.png
[Trading] Signature image + topic image
07/31/2013 - League of Legends Trading - 0 Replies
If you can make those please add me on my skype, which can be found in my signature.
Dibiase - New Sig/Full Size Image - [GIANT IMAGE WARNING]
10/26/2011 - General Art - 1 Replies
WARNING - SOME OF THESE IMAGES ARE MASSIVE(OVER 2000 PIXELS WIDE/1000 PIXELS HIGH). This is my latest signature collection, the full size images show the detail. Full-Size: http://img339.imageshack.us/img339/971/dibiaseful l.png Super-Sized:
Neuer Image Hoster / New Image Hoster
05/15/2010 - Main - 9 Replies
Hi, ich habe einen neuen Image-Hoster erstellt. Ich hoffe das ich einige Nutzer finde. Falls ihr irgendwelche verbesserungs vorschläge habt bitte posten. Bitte Hier Klicken Hi, i created a new Image-Hoster. I hope that i find some users. If you have any tips to make this site better please post them.



All times are GMT +1. The time now is 03:11.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.