FFXU ASCII Art Captcha Solver

A script to automatically solve ASCII art captchas on Fairfax Underground

  1. // ==UserScript==
  2. // @name FFXU ASCII Art Captcha Solver
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description A script to automatically solve ASCII art captchas on Fairfax Underground
  6. // @author Chuck Hoffmann
  7. // @match http://www.*
  8. // @match https*
  9. // @match http*
  10. // @match *
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. let letters = {
  17. D34D107D73D73D73D73D73D127D54:"3",
  18. D124D124D4D4D4D4D63D63D4:"4",
  19. D62D127D73D73D73D73D73D111D38:"6",
  20. D96D96D71D79D88D80D96D96:"7",
  21. D50D123D73D73D73D73D73D127D62:"9",
  22. D127D127D73D73D73D73D73D127D54:"B",
  23. D62D127D65D65D65D65D99D34:"C",
  24. D127D127D65D65D65D65D65D127D62:"D",
  25. D127D127D73D73D73D73D65D65:"E",
  26. D127D127D72D72D72D72D64D64:"F",
  27. D62D127D65D65D65D73D111D46D8:"G",
  28. D127D127D8D8D8D8D8D127D127:"H",
  29. D6D7D1D1D1D1D127D126:"J",
  30. D127D127D8D8D28D54D99D65:"K",
  31. D127D127D1D1D1D1D1D1:"L",
  32. D127D127D48D24D8D24D48D127D127:"M",
  33. D127D127D48D24D12D6D127D127:"N",
  34. D127D127D72D72D72D72D72D120D48:"P",
  35. D64D64D64D127D127D64D64D64:"T",
  36. D126D127D1D1D1D1D1D127D126:"U",
  37. D120D124D6D3D1D3D6D124D120:"V",
  38. D126D127D1D1D62D62D1D1D127D126:"W",
  39. D65D99D54D28D8D28D54D99D65:"X",
  40. D64D96D48D31D31D48D96D64:"Y"
  41. };
  42. let captcha = document.getElementById("spamhurdles_captcha_asciiart");
  43. let captchaString = captcha.textContent;
  44. //console.log("\"" + captchaString + "\"");
  45. let captchaArray = captchaString.split("\n");
  46. let max = captchaArray[0].length;
  47. let key = "";
  48. let solution = "";
  49. for(let ctr=0; ctr< max; ctr++){
  50. let columnVal = 0;
  51. for(let x in captchaArray){
  52. columnVal = columnVal << 1;
  53. if(captchaArray[x][ctr] !== " "){
  54. columnVal = columnVal + 1;
  55. }
  56. }
  57. //console.log("Column " + ctr + " value is : " + columnVal);
  58. if(columnVal === 0){
  59. //console.log(key);
  60. if (letters.hasOwnProperty(key)){
  61. //console.log(letters[key]);
  62. solution = solution + letters[key];
  63. }
  64. key = "";
  65. } else {
  66. key = key + "D" + columnVal;
  67. }
  68. }
  69. let qz = document.getElementById("spamhurdles_captcha_answer_input");
  70. qz.value = solution;
  71. //console.log(solution);
  72. })();