mirror of
https://github.com/venera-app/venera.git
synced 2025-12-16 07:01:16 +00:00
Enhance Cloudflare challenge detection logic (#619)
添加了验证body内的,防止一些网站的漏判
This commit is contained in:
@@ -128,10 +128,15 @@ void passCloudflare(CloudflareException e, void Function() onFinished) async {
|
|||||||
var head =
|
var head =
|
||||||
await controller.evaluateJavascript("document.head.innerHTML") ??
|
await controller.evaluateJavascript("document.head.innerHTML") ??
|
||||||
"";
|
"";
|
||||||
|
var body =
|
||||||
|
await controller.evaluateJavascript("document.body.innerHTML") ??
|
||||||
|
"";
|
||||||
Log.info("Cloudflare", "Checking head: $head");
|
Log.info("Cloudflare", "Checking head: $head");
|
||||||
var isChallenging = head.contains('#challenge-success-text') ||
|
var isChallenging = head.contains('#challenge-success-text') ||
|
||||||
head.contains("#challenge-error-text") ||
|
head.contains("#challenge-error-text") ||
|
||||||
head.contains("#challenge-form");
|
head.contains("#challenge-form") ||
|
||||||
|
body.contains("challenge-platform") ||
|
||||||
|
body.contains("window._cf_chl_opt");
|
||||||
if (!isChallenging) {
|
if (!isChallenging) {
|
||||||
Log.info(
|
Log.info(
|
||||||
"Cloudflare",
|
"Cloudflare",
|
||||||
@@ -159,10 +164,14 @@ void passCloudflare(CloudflareException e, void Function() onFinished) async {
|
|||||||
void check(InAppWebViewController controller) async {
|
void check(InAppWebViewController controller) async {
|
||||||
var head = await controller.evaluateJavascript(
|
var head = await controller.evaluateJavascript(
|
||||||
source: "document.head.innerHTML") as String;
|
source: "document.head.innerHTML") as String;
|
||||||
|
var body = await controller.evaluateJavascript(
|
||||||
|
source: "document.body.innerHTML") as String;
|
||||||
Log.info("Cloudflare", "Checking head: $head");
|
Log.info("Cloudflare", "Checking head: $head");
|
||||||
var isChallenging = head.contains('#challenge-success-text') ||
|
var isChallenging = head.contains('#challenge-success-text') ||
|
||||||
head.contains("#challenge-error-text") ||
|
head.contains("#challenge-error-text") ||
|
||||||
head.contains("#challenge-form");
|
head.contains("#challenge-form") ||
|
||||||
|
body.contains("challenge-platform") ||
|
||||||
|
body.contains("window._cf_chl_opt");
|
||||||
if (!isChallenging) {
|
if (!isChallenging) {
|
||||||
Log.info(
|
Log.info(
|
||||||
"Cloudflare",
|
"Cloudflare",
|
||||||
|
|||||||
Reference in New Issue
Block a user