【发布时间】:2019-07-12 11:43:24
【问题描述】:
听说 ReCaptcha 可以读取某人在他的电脑上的所有 extensions(或篡改脚本),有什么办法可以避免这种情况? 任何类型的脚本或代码或设置。
这个理论得到证实:一旦我使用Chrome Automation Extension 登录任何网站,我就会立即被标记。即使它只是为另一个与 recaptcha 无关的任务公开了 Chrome 选项的 API。只需使用 ReCaptcha 加载任何网页(站点)就会触发验证码。
这是 background.js,如何将其更改为对其他应用不显眼?
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/*
* Checks for an extension error that occurred during the asynchronous call.
* If an error occurs, will invoke the error callback and throw an exception.
*
* @param {function(!Error)} errCallback The callback to invoke for error
* reporting.
*/
function checkForExtensionError(errCallback) {
if (typeof(chrome.extension.lastError) != 'undefined') {
var error = new Error(chrome.extension.lastError.message);
errCallback(error);
throw error;
}
}
/**
* Captures a screenshot of the visible tab.
*
* @param {function(string)} callback The callback to invoke with the base64
* encoded PNG.
* @param {function(!Error)} errCallback The callback to invoke for error
* reporting.
*/
function captureScreenshot(callback, errCallback) {
chrome.tabs.captureVisibleTab({format:'png'}, function(dataUrl) {
if (chrome.extension.lastError &&
chrome.extension.lastError.message.indexOf('permission') != -1) {
var error = new Error(chrome.extension.lastError.message);
error.code = 103; // kForbidden
errCallback(error);
return;
}
checkForExtensionError(errCallback);
var base64 = ';base64,';
callback(dataUrl.substr(dataUrl.indexOf(base64) + base64.length))
});
}
/**
* Launches an app with the specified id.
*
* @param {string} id The ID of the app to launch.
* @param {function()} callback Invoked when the launch event is complete.
* @param {function(!Error)} errCallback The callback to invoke for error
* reporting.
*/
function launchApp(id, callback, errCallback) {
chrome.management.launchApp(id, function() {
checkForExtensionError(errCallback);
callback();
});
}
清单:
{
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDr+Q7QFcTr4Wmn9sSICKWbxnYLhIM0ERbcapZCDmpAkiBUhOPt+KkYnTdUFl4Kx2xv02MwIowh36Fho9Dhqh7cPWGIPsLHUaJosO6t6oaHxQsMQS/K4MlnP5pNJykExo82DcajSXGV+mIQH3RslxL+XhtmIh2BQLwbizVG0bA+mwIDAQAB",
"name": "Chrome Automation Extension",
"version": "1",
"manifest_version": 2,
"description": "Exposes extension APIs for automating Chrome",
"background": {
"scripts": ["background.js"]
},
"permissions": [
"tabs", "management", "<all_urls>"
]
}
【问题讨论】:
-
无需猜测和发明阴谋论,只需检查该扩展的来源 - 它通过添加各种元素使其在主页 DOM 中的存在已知,这对于检测包括 ReCaptcha 在内的任何页面脚本都是微不足道的.
-
如果这正是我的想法,那也不算什么阴谋。显然,我不明白它背后的逻辑,我不会问这些问题。如果您能给我提供一个实际的代码或插件、js 或其他解决方案会更有用。
-
哪个代码?您可以自己检查扩展程序的代码,例如通过安装它并查看浏览器配置文件中的文件。还有 CRXViewer 扩展,无需安装即可显示网上商店中其他扩展的源代码。
-
谢谢
-
我看不到发布的代码与问题有何关联 - 我需要查看整个扩展(最好)以做出有根据的猜测,或者至少 manifest.json 和内容脚本。不向网页 DOM 添加内容且不通过 web_accessible_resources 公开其内容的扩展对网络应用不可见。
标签: javascript google-chrome google-chrome-extension google-chrome-devtools selenium-chromedriver