Advertisement
Guest User

Untitled

a guest
Apr 30th, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. package com.DeathByCaptcha;
  2.  
  3. import java.io.IOException;
  4.  
  5. class Main
  6. {
  7. public static void main(String[] args)
  8. throws Exception, InterruptedException
  9. {
  10. // EXAMPLE RECAPTCHA_COORDINATES.
  11.  
  12. // Put your DBC username & password here:
  13. //Client client = (Client)(new HttpClient(args[0], args[1]));
  14. String username = "xxxxx";
  15. String password = "xxxxx";
  16. String filename = "test.jpg";
  17. Client client = (Client)(new SocketClient(username, password));
  18. client.isVerbose = true;
  19.  
  20. try {
  21. try {
  22. System.out.println(
  23. "Your balance is " + client.getBalance() + " US cents");
  24. } catch (IOException e) {
  25. System.out.println("Failed fetching balance: " + e.toString());
  26. return;
  27. }
  28.  
  29. Captcha captcha = null;
  30. try {
  31. // Upload a CAPTCHA and poll for its status with 120 seconds timeout.
  32. // Put you CAPTCHA image file name, file object, input stream, or
  33. // vector of bytes, and solving timeout (in seconds)
  34. // if 0 then the default value take place.
  35. // please note we are specifying type=2 in the second argument
  36. captcha = client.decode(filename, 2, 0);
  37. } catch (IOException e) {
  38. System.out.println("Failed uploading CAPTCHA");
  39. return;
  40. }
  41. if (null != captcha) {
  42. System.out.println(
  43. "CAPTCHA " + captcha.id + " solved: " + captcha.text);
  44.  
  45. // Report incorrectly solved CAPTCHA if necessary.
  46. // Make sure you've checked if the CAPTCHA was in fact incorrectly
  47. // solved, or else you might get banned as abuser.
  48. /*try {
  49. if (client.report(captcha)) {
  50. System.out.println("Reported as incorrectly solved");
  51. } else {
  52. System.out.println(
  53. "Failed reporting incorrectly solved CAPTCHA");
  54. }
  55. } catch (IOException e) {
  56. System.out.println(
  57. "Failed reporting incorrectly solved CAPTCHA: " + e.toString());
  58. }*/
  59. } else {
  60. System.out.println("Failed solving CAPTCHA");
  61. }
  62. } catch (com.DeathByCaptcha.Exception e) {
  63. System.out.println(e);
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement