古诗文网自动填充验证码

自动识别填充验证码以及账号信息并登录(不可用),不需要到代码中修改账号,登陆一次之后就会自动登录(不可用)

  1. // ==UserScript==
  2. // @name 古诗文网自动填充验证码
  3. // @namespace http://waahah.github.io/
  4. // @version 0.2.4
  5. // @description 自动识别填充验证码以及账号信息并登录(不可用),不需要到代码中修改账号,登陆一次之后就会自动登录(不可用)
  6. // @author waahah
  7. // @license Apache License 2.0
  8. // @require https://unpkg.com/tesseract.js@2.1.4/dist/tesseract.min.js
  9. // @match *://so.gushiwen.cn/user/login.aspx*
  10. // @icon data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M15 3h6v5h-2V5h-4V3zM9 3v2H5v3H3V3h6zm6 18v-2h4v-3h2v5h-6zm-6 0H3v-5h2v3h4v2zM3 11h18v2H3v-2z'/%3E%3C/svg%3E
  11. // @grant unsafeWindow
  12. // @grant GM_registerMenuCommand
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. 'use strict';
  17. class Sleep {
  18. constructor(timeout) {
  19. this.timeout = timeout;
  20. }
  21. then(resolve, reject) {
  22. const startTime = Date.now();
  23. setTimeout(
  24. () => resolve(Date.now() - startTime),
  25. this.timeout
  26. );
  27. }
  28. }
  29.  
  30. let name, pwd, valName, valPwd;
  31. const host_name = `${location.host}_nmae`;
  32. const host_pwd = `${location.host}_pwd`;
  33.  
  34. //存放自己写好的工具类函数的对象
  35. const utils = {
  36. get_utils: function () {
  37. valName = localStorage.getItem(host_name);
  38. valPwd = localStorage.getItem(host_pwd);
  39. return this.get_utils;
  40. },
  41. set_utils: () => {
  42. window.localStorage.setItem(host_name, name);
  43. window.localStorage.setItem(host_pwd, pwd);
  44. }
  45. };
  46. utils.del_utils = () => {
  47. if (window.localStorage.getItem(host_name) !== null) {
  48. window.localStorage.removeItem(host_name);
  49. }
  50. if (window.localStorage.getItem(host_pwd) !== null) {
  51. window.localStorage.removeItem(host_pwd);
  52. }
  53. }
  54.  
  55. GM_registerMenuCommand("删除保存在本地的账号密码", utils.del_utils);
  56. utils.get_utils();
  57.  
  58. if (valName == undefined && valPwd == undefined) {
  59. name = prompt('第一次需输入邮箱/手机号:', '');
  60. pwd = prompt('第一次需输入密码:', '');
  61. utils.set_utils();
  62. utils.get_utils();
  63. console.log(localStorage);
  64. }
  65.  
  66. const account = document.querySelector('#email');
  67. const password = document.querySelector('#pwd');
  68. const core = document.querySelector('#code');
  69. const randcode = document.querySelector('#imgCode');
  70. const submit = document.querySelector('#denglu');
  71. const emailNo = document.getElementById('emailNo').style.display;
  72. const pwdNo = document.getElementById('pwdNo').style.display;
  73.  
  74. const login = () => {
  75. $("#leftLogin").fadeOut("slow");//立即停止显示微信扫码登录(不可用)
  76. clearInterval(intervalErweima);
  77. if (account.value == '邮箱 / 手机号' && password.value == '') {
  78. //onEmial();//消除提示
  79. account.value = valName;
  80. //onPwd();消除提示
  81. password.value = valPwd;
  82. } else if (zhanghao.value !== valName || password.value !== valPwd) {
  83. zhanghao.value = valName;
  84. password.value = valPwd;
  85. }
  86. return new Promise(resolve => {
  87. console.log('开始尝试登录(不可用)...');
  88. })
  89. }
  90.  
  91. const security = async () => {
  92. //GetCodeImg();
  93. const exampleImage = "/RandCode.ashx";
  94. console.log(`exampleImage${exampleImage}`);
  95.  
  96. const worker = Tesseract.createWorker({
  97. logger: m => console.log(m)
  98. });
  99. Tesseract.setLogging(true);
  100. work();
  101.  
  102. async function work() {
  103. await worker.load();
  104. await worker.loadLanguage('eng');
  105. await worker.initialize('eng');
  106.  
  107. let result = await worker.recognize(exampleImage);
  108. console.log(result.data);
  109. console.log(`识别成功率:${result.data.confidence}`);
  110.  
  111. await worker.terminate();
  112. core.value = result.data.text;
  113. if (emailNo == 'none' && pwdNo == 'none' && result.data.confidence > 50) {
  114. submit.click();
  115. }
  116. if (result.data.confidence < 60) {
  117. (async () => GetCodeImg())().then(
  118. async () => {
  119. await new Sleep(1000);
  120. await security();
  121. }
  122. );
  123.  
  124. }
  125. }
  126. }
  127.  
  128. window.onload = async () => {
  129. login().then(
  130. security()
  131. );
  132. }
  133.  
  134. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址