Update ReCapBypass to v1.1 (#1585)

Prevents 404 status loop & small changes
add to aniworld & serienstream
This commit is contained in:
LuftVerbot 2023-05-08 13:57:58 +02:00 committed by GitHub
parent 20fef93b24
commit 5d5ba1fafc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 110 additions and 88 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'AniWorld (experimental)' extName = 'AniWorld (experimental)'
pkgNameSuffix = 'de.aniworld' pkgNameSuffix = 'de.aniworld'
extClass = '.AniWorld' extClass = '.AniWorld'
extVersionCode = 13 extVersionCode = 14
libVersion = '13' libVersion = '13'
} }

View File

@ -238,51 +238,62 @@ class JsInterceptor : Interceptor {
return result.text; return result.text;
} }
(async function() { async function main() {
let intervalIdA = setInterval(() => { let intervalIdA = setInterval(() => {
let iframewindow = document.querySelector('iframe[title="reCAPTCHA-Aufgabe läuft in zwei Minuten ab"]').contentWindow; let iframewindow = document.querySelector("iframe[src*='recaptcha/api2']:not([src*=anchor])").contentWindow;
if (iframewindow) { if (iframewindow) {
clearInterval(intervalIdA); clearInterval(intervalIdA);
let audiobutton = iframewindow.document.querySelector('#recaptcha-audio-button'); let audiobutton = iframewindow.document.querySelector('#recaptcha-audio-button');
let event = iframewindow.document.createEvent('HTMLEvents'); let event = iframewindow.document.createEvent('HTMLEvents');
event.initEvent('click', false, false); event.initEvent('click', false, false);
audiobutton.dispatchEvent(event); audiobutton.dispatchEvent(event);
let intervalIdB = setInterval(async () => { let intervalIdB = setInterval(async () => {
let source = iframewindow.document.querySelector('#audio-source').getAttribute('src'); let audio = iframewindow.document.querySelector('#audio-source');
if (source) { let source = audio.getAttribute('src');
clearInterval(intervalIdB); if (source) {
let audioresponse = iframewindow.document.querySelector('#audio-response'); clearInterval(intervalIdB);
let verifybutton = iframewindow.document.querySelector('#recaptcha-verify-button'); // Prevent 404 status loop
var tries = 0; const response = await fetch(source);
let intervalIdC = setInterval(async () => { if (response.ok) {
var solved = null let audioresponse = iframewindow.document.querySelector('#audio-response');
solved = await getWitSpeechApiResult(source); let verifybutton = iframewindow.document.querySelector('#recaptcha-verify-button');
tries++; var tries = 0;
if (solved != null) { let intervalIdC = setInterval(async () => {
clearInterval(intervalIdC); var solved = null
audioresponse.value = solved; solved = await getWitSpeechApiResult(source);
verifybutton.dispatchEvent(event); tries++;
const originalOpen = iframewindow.XMLHttpRequest.prototype.open; if (solved != null) {
iframewindow.XMLHttpRequest.prototype.open = function (method, url, async) { clearInterval(intervalIdC);
if (url.includes('userverify')) { audioresponse.value = solved;
originalOpen.apply(this, arguments); // call the original open method verifybutton.dispatchEvent(event);
this.onreadystatechange = function () { const originalOpen = iframewindow.XMLHttpRequest.prototype.open;
if (this.readyState === 4 && this.status === 200) { iframewindow.XMLHttpRequest.prototype.open = function (method, url, async) {
const responseBody = this.responseText; if (url.includes('userverify')) {
window.android.passPayload(responseBody); originalOpen.apply(this, arguments); // call the original open method
} this.onreadystatechange = function () {
}; if (this.readyState === 4 && this.status === 200) {
} const responseBody = this.responseText;
}; window.android.passPayload(responseBody);
} else if(tries >= 2) { }
window.android.passPayload(""); };
} }
}, 2000); };
} } else if (tries >= 2) {
clearInterval(intervalIdC);
window.android.passPayload("");
}
}, 2000); }, 2000);
} else {
window.android.passPayload("Audio file not found");
}
} }
}, 2000); }, 2000);
})() }
}, 2000);
};
// Prevent async-related problems with stupid webviews
setTimeout(async () => await main(), 0);
""" """
val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap() val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap()

View File

@ -6,7 +6,7 @@ ext {
extName = 'Serienstream' extName = 'Serienstream'
pkgNameSuffix = 'de.serienstream' pkgNameSuffix = 'de.serienstream'
extClass = '.Serienstream' extClass = '.Serienstream'
extVersionCode = 7 extVersionCode = 8
libVersion = '13' libVersion = '13'
} }

View File

@ -238,51 +238,62 @@ class JsInterceptor : Interceptor {
return result.text; return result.text;
} }
(async function() { async function main() {
let intervalIdA = setInterval(() => { let intervalIdA = setInterval(() => {
let iframewindow = document.querySelector('iframe[title="reCAPTCHA-Aufgabe läuft in zwei Minuten ab"]').contentWindow; let iframewindow = document.querySelector("iframe[src*='recaptcha/api2']:not([src*=anchor])").contentWindow;
if (iframewindow) { if (iframewindow) {
clearInterval(intervalIdA); clearInterval(intervalIdA);
let audiobutton = iframewindow.document.querySelector('#recaptcha-audio-button'); let audiobutton = iframewindow.document.querySelector('#recaptcha-audio-button');
let event = iframewindow.document.createEvent('HTMLEvents'); let event = iframewindow.document.createEvent('HTMLEvents');
event.initEvent('click', false, false); event.initEvent('click', false, false);
audiobutton.dispatchEvent(event); audiobutton.dispatchEvent(event);
let intervalIdB = setInterval(async () => { let intervalIdB = setInterval(async () => {
let source = iframewindow.document.querySelector('#audio-source').getAttribute('src'); let audio = iframewindow.document.querySelector('#audio-source');
if (source) { let source = audio.getAttribute('src');
clearInterval(intervalIdB); if (source) {
let audioresponse = iframewindow.document.querySelector('#audio-response'); clearInterval(intervalIdB);
let verifybutton = iframewindow.document.querySelector('#recaptcha-verify-button'); // Prevent 404 status loop
var tries = 0; const response = await fetch(source);
let intervalIdC = setInterval(async () => { if (response.ok) {
var solved = null let audioresponse = iframewindow.document.querySelector('#audio-response');
solved = await getWitSpeechApiResult(source); let verifybutton = iframewindow.document.querySelector('#recaptcha-verify-button');
tries++; var tries = 0;
if (solved != null) { let intervalIdC = setInterval(async () => {
clearInterval(intervalIdC); var solved = null
audioresponse.value = solved; solved = await getWitSpeechApiResult(source);
verifybutton.dispatchEvent(event); tries++;
const originalOpen = iframewindow.XMLHttpRequest.prototype.open; if (solved != null) {
iframewindow.XMLHttpRequest.prototype.open = function (method, url, async) { clearInterval(intervalIdC);
if (url.includes('userverify')) { audioresponse.value = solved;
originalOpen.apply(this, arguments); // call the original open method verifybutton.dispatchEvent(event);
this.onreadystatechange = function () { const originalOpen = iframewindow.XMLHttpRequest.prototype.open;
if (this.readyState === 4 && this.status === 200) { iframewindow.XMLHttpRequest.prototype.open = function (method, url, async) {
const responseBody = this.responseText; if (url.includes('userverify')) {
window.android.passPayload(responseBody); originalOpen.apply(this, arguments); // call the original open method
} this.onreadystatechange = function () {
}; if (this.readyState === 4 && this.status === 200) {
} const responseBody = this.responseText;
}; window.android.passPayload(responseBody);
} else if(tries >= 2) { }
window.android.passPayload(""); };
} }
}, 2000); };
} } else if (tries >= 2) {
clearInterval(intervalIdC);
window.android.passPayload("");
}
}, 2000); }, 2000);
} else {
window.android.passPayload("Audio file not found");
}
} }
}, 2000); }, 2000);
})() }
}, 2000);
};
// Prevent async-related problems with stupid webviews
setTimeout(async () => await main(), 0);
""" """
val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap() val headers = request.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }.toMutableMap()