no captcha

Auto complete KissAnime Captcha

  1. // ==UserScript==
  2. // @name no captcha
  3. // @namespace https://greasyfork.org/en/users/135934-elti-musa
  4. // @version 2.2
  5. // @description Auto complete KissAnime Captcha
  6. // @author AnimeBro1
  7. // @match http://kissanime.ru/Special/AreYouHuman2*
  8. // @grant GM_setValue
  9. // @grant GM_getValue
  10. // @grant GM_listValues
  11. // @grant GM_deleteValue
  12. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
  13. // ==/UserScript==
  14.  
  15. var images = [];
  16. var words = [];
  17. var count = 0;
  18. (function() {
  19. $("body").append('<div id="CaptchaInfo" style="display:none;width:200px;height:150px;font-size:20px;position:fixed; top: 10px; left:10px; background: red; border-radius: 25px;padding:40px;"><p></p></div>');
  20. //getE();
  21. //alert(GM_listValues());
  22. if(!isBasicJson()){
  23. factoryReset();
  24. getBasicJson();
  25. }
  26. document.getElementsByTagName("body")[0].onload = function(){
  27. var loaders = [];
  28. var x = $("[indexValue]").toArray();
  29. for(var i =0; i < 5; i++){
  30. getBase64Image(x[i]);
  31. }
  32. console.log(images);
  33. words = getWords();
  34. Complete();
  35. };
  36. })();
  37.  
  38. function factoryReset(){
  39. var keys = GM_listValues();
  40. for (var i=0; i < keys.length; i++) {
  41. GM_deleteValue(keys[i]);
  42. }
  43. }
  44. function isBasicJson(){
  45. return GM_getValue("AnimeBro2",false);
  46. }
  47.  
  48. function getBasicJson(){
  49. var isFirefox = typeof InstallTrigger !== 'undefined';
  50. var isChrome = !!window.chrome && !!window.chrome.webstore;
  51. $("#CaptchaInfo").show();
  52. $("#CaptchaInfo").find("p").html("First time running, fetching some files... Page will reload.");
  53. var msg='';
  54. if(isChrome){
  55. msg = $.ajax({type: "GET", url: "https://cdn.rawgit.com/Eltion/Kissanime-Chaptcha-Auto-Complete/623d627fa2ec94dea00621e406e66088a61b6bff/BasicJson1.json", async: false}).responseText;
  56. }else if(isFirefox){
  57. msg = $.ajax({type: "GET", url: "https://cdn.rawgit.com/Eltion/Kissanime-Chaptcha-Auto-Complete/623d627fa2ec94dea00621e406e66088a61b6bff/BasicJsonFireFox1.json", async: false}).responseText;
  58. }else{
  59. alert("Not Chrome or Firefox. Tryng the chrome database");
  60. msg = $.ajax({type: "GET", url: "https://cdn.rawgit.com/Eltion/Kissanime-Chaptcha-Auto-Complete/623d627fa2ec94dea00621e406e66088a61b6bff/BasicJson1.json", async: false}).responseText;
  61. }
  62. msg = JSON.parse(msg);
  63. for(var i = 0; i < msg.length; i++){
  64. GM_setValue(msg[i].n,msg[i].v);
  65. }
  66. location.reload();
  67. }
  68. function getE(){
  69. var x = GM_listValues();
  70. var b = "";
  71. for(var i =0; i < x.length; i++){
  72. b += '{"n":"'+x[i]+'","v":"'+GM_getValue(x[i])+'"},';
  73. }
  74. $('body').html("<p>"+b+"</p>");
  75. }
  76. function getBase64Image(img) {
  77. var canvas = document.createElement("canvas");
  78. canvas.width = img.naturalWidth;
  79. canvas.height = img.naturalHeight;
  80. var ctx = canvas.getContext("2d");
  81. ctx.drawImage(img, 0, 0);
  82. var dataURL = canvas.toDataURL("image/jpeg",0.2);
  83.  
  84. //dataURL = dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
  85. images.push(dataURL);
  86. }
  87.  
  88. function getWords(){
  89. var words = $("#formVerify").find("span").toArray();
  90. var First = words[0].innerText;
  91. var Second = words[1].innerText;
  92. return [First, Second];
  93. }
  94.  
  95. function Learn(){
  96. $("[indexValue]").on('click', function(){
  97. count++;
  98. var x = parseInt($(this).attr("indexValue"));
  99. if(GM_getValue(words[count-1],false) !== false){
  100. var nn = GM_getValue(words[count-1])+" "+images[x];
  101. GM_setValue(words[count-1],nn);
  102. }else{
  103. var gg = images[x];
  104. GM_setValue(words[count-1],gg);
  105. }
  106. });
  107. }
  108.  
  109. function Complete() {
  110. var jj = 0;
  111. for(var j = 0; j <2; j++){
  112. var w1 = GM_getValue(words[j], false);
  113. if(w1 !== false){
  114. if(w1.includes(" ")){
  115. w1 = w1.split(" ");
  116. }else{
  117. w1 = [w1];
  118. }
  119. //window.prompt("Eltioni",w1);
  120. for(var k =0; k < w1.length; k++){
  121. for(var i = 0; i < images.length; i++){
  122. if(images[i] === w1[k]){
  123. $("[indexValue='"+i+"']").click();
  124. jj++;
  125. if(j === 0){
  126. count++;
  127. }
  128. }
  129. }
  130. }
  131. }
  132. }
  133. UpdateTest(jj);
  134. Learn();
  135. }
  136.  
  137. function UpdateTest(jj){
  138. if(jj === 0){
  139. $("#CaptchaInfo").show();
  140. $("#CaptchaInfo").find("p").html("Couldn't recognize the images. Please select them so script can learn them for next time. IMPORTANT ***Select them in order***");
  141. }else if(jj === 1){
  142. $("#CaptchaInfo").show();
  143. $("#CaptchaInfo").find("p").html("Only one of the images is recognized. Please select the other one so script can learn it for next time.");
  144. }
  145. }