Open aszx87410 opened 2 years ago
Your fingers too slow to smash, tbh.
We need to keep inputing the code on the image, so just create an automation script and do OCR.
The problem is, the OCR library is not that accurate, my solution is to use a fallback language and hope it works.
const puppeteer = require('puppeteer'); const path = require('path') const fs = require('fs') const pageUrl = 'http://challenge.ctf.games:31205/'; const { createWorker, PSM } = require('tesseract.js'); const worker = createWorker(); const worker2 = createWorker(); const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); (async () => { await worker.load(); await worker.loadLanguage('eng'); await worker.initialize('eng'); await worker.setParameters({ tessedit_char_whitelist: "0123456789" }); await worker2.load(); await worker2.loadLanguage('chi_tra'); await worker2.initialize('chi_tra'); await worker2.setParameters({ tessedit_char_whitelist: "0123456789" }); const browser = await puppeteer.launch({ headless: false }); const page = await browser.newPage(); await page.goto(pageUrl); send() async function send() { let { data: { text } } = await worker.recognize('http://challenge.ctf.games:31205/static/otp.png'); console.log('text:'+text) if (text.length !== 9) { const result = await worker2.recognize('http://challenge.ctf.games:31205/static/otp.png'); text = result.data.text console.log('text again:'+text) } await page.evaluate((text) => { document.querySelector('input[name=otp_entry]').value = text document.querySelector('input[type=submit]').click() }, text) await page.waitForNavigation(); send() } })();
Description
Your fingers too slow to smash, tbh.
Writeup
We need to keep inputing the code on the image, so just create an automation script and do OCR.
The problem is, the OCR library is not that accurate, my solution is to use a fallback language and hope it works.