Last active
March 18, 2024 15:39
-
-
Save Leo7654/fd499e57a052ff5f0a90ab07b0816b85 to your computer and use it in GitHub Desktop.
Auth Autofill Capcha js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Auth Autofill Capcha | |
// @version 2024-03-10-2 | |
// @description Auth Autofill Capcha | |
// @author Leo7654 | |
// @updateURL https://gist.github.com/Leo7654/fd499e57a052ff5f0a90ab07b0816b85/raw/fa68198eed37b3545daa343da3669faf6292a8bd/AuthAutofillCapcha.user.js | |
// @match https://nice.checkplus.co.kr/cert/mobileCert/certification | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=checkplus.co.kr | |
// @grant none | |
// @require https://cdn.jsdelivr.net/npm/tesseract.js@5/dist/tesseract.min.js | |
// ==/UserScript== | |
(function() { | |
var img = 'https://nice.checkplus.co.kr/cert/captcha/image/6f814745410dd12b17d0135fbab259ef05595aefdfa1e70b212562d09b49d965' | |
img = document.getElementById("simpleCaptchaImg"); | |
const run = (async () => { | |
const blob = await getImageBlob(img) | |
img.src = URL.createObjectURL(blob) | |
const worker = await Tesseract.createWorker('eng', { | |
tessedit_char_whitelist: '0123456789', | |
}); | |
const ret = await worker.recognize(blob); | |
console.log(ret); | |
worker.terminate(); | |
const text = ret.data.text | |
console.log(text); | |
document.getElementById("captchaAnswer").value = text | |
}); | |
async function getImageBlob(img) { | |
return new Promise(resolve => { | |
var x = new XMLHttpRequest(); | |
x.open('GET', img.src); | |
x.responseType = 'blob'; | |
x.onload = function() { | |
var blob = x.response; | |
resolve(blob) | |
}; | |
x.send(); | |
}); | |
} | |
run() | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
반갑습니다. 익스텐션 잘 쓰고 있습니다. 감사합니다.
캡챠가 신기한게 같은 주소여도 이미지를 로딩할때마다 이미지가 계속 바뀝니다. 최신의 이미지(정답)으로 로직이 구현되어 있는것 같습니다. 보이는 이미지와 답이 달라도 확인을 누르시면 뚤릴것입니다.
(getImageBlob함수의 결과를 최신 이미지로 덮어씌우는것까지 해볼까 하다 안했습니다.)
알파벳으로 인식하는것은 제가 테스트했을땐 발견하지 못했었네요. https://github.com/tesseract-ocr/tesseract 숫자만 인식하는 언어지원을 하면좋을 텐데 안하고 있네요.