blob: adbf519d71c1e806a514477d1ef78217a588eeea (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* SPDX-License-Identifier: CC0-1.0
*
* Code to run Hacktcha on Google's "sorry" page.
*
* Copyright (C) 2022 Wojtek Kosior
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the CC0 1.0 Universal License as published by
* the Creative Commons Corporation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* CC0 1.0 Universal License for more details.
*/
/* Use with https://www.google.com/sorry/index */
"use strict";
(async () => {
const form = document.getElementById("captcha-form");
const recaptcha_div = form.querySelector("#recaptcha");
const site_key = recaptcha_div.getAttribute("data-sitekey");
for (const warning of
document.querySelectorAll("noscript, form div[style^=font-size]"))
warning.style.display = "none";
for await (const token of HCHA.run(recaptcha_div, site_key)) {
if (token !== null) {
const token_field = document.createElement("textarea");
token_field.setAttribute("type", "hidden");
token_field.value = token;
token_field.name = "g-recaptcha-response";
recaptcha_div.after(token_field);
form.submit();
recaptcha_div.style.display = "none";
await new Promise(cb => {});
}
}
})();
|