Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.DeathByCaptcha;
- import java.io.IOException;
- class Main
- {
- public static void main(String[] args)
- throws Exception, InterruptedException
- {
- // EXAMPLE RECAPTCHA_COORDINATES.
- // Put your DBC username & password here:
- //Client client = (Client)(new HttpClient(args[0], args[1]));
- String username = "xxxxx";
- String password = "xxxxx";
- String filename = "test.jpg";
- Client client = (Client)(new SocketClient(username, password));
- client.isVerbose = true;
- try {
- try {
- System.out.println(
- "Your balance is " + client.getBalance() + " US cents");
- } catch (IOException e) {
- System.out.println("Failed fetching balance: " + e.toString());
- return;
- }
- Captcha captcha = null;
- try {
- // Upload a CAPTCHA and poll for its status with 120 seconds timeout.
- // Put you CAPTCHA image file name, file object, input stream, or
- // vector of bytes, and solving timeout (in seconds)
- // if 0 then the default value take place.
- // please note we are specifying type=2 in the second argument
- captcha = client.decode(filename, 2, 0);
- } catch (IOException e) {
- System.out.println("Failed uploading CAPTCHA");
- return;
- }
- if (null != captcha) {
- System.out.println(
- "CAPTCHA " + captcha.id + " solved: " + captcha.text);
- // Report incorrectly solved CAPTCHA if necessary.
- // Make sure you've checked if the CAPTCHA was in fact incorrectly
- // solved, or else you might get banned as abuser.
- /*try {
- if (client.report(captcha)) {
- System.out.println("Reported as incorrectly solved");
- } else {
- System.out.println(
- "Failed reporting incorrectly solved CAPTCHA");
- }
- } catch (IOException e) {
- System.out.println(
- "Failed reporting incorrectly solved CAPTCHA: " + e.toString());
- }*/
- } else {
- System.out.println("Failed solving CAPTCHA");
- }
- } catch (com.DeathByCaptcha.Exception e) {
- System.out.println(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement