javascript - 检查 chrome 网络中的标头时注入.JS 文件
问题描述
检查时,我检查了我的 chrome 网络选项卡,发现这个脚本看起来有点可疑。它被称为 inject.js 并且有这个代码。我没有任何扩展名,叫做这样的东西,所以我担心它可能是恶意软件脚本?
(() => {
try {
const detectJs = (chain) => {
const properties = chain.split('.');
let value = properties.length ? window : null;
for (let i = 0; i < properties.length; i++) {
const property = properties[i];
if (value && value.hasOwnProperty(property)) {
value = value[property];
} else {
value = null;
break;
}
}
return typeof value === 'string' || typeof value === 'number' ? value : !!value;
};
const onMessage = (event) => {
if (event.data.id !== 'patterns') {
return;
}
removeEventListener('message', onMessage);
const patterns = event.data.patterns || {};
const js = {};
for (const appName in patterns) {
if (patterns.hasOwnProperty(appName)) {
js[appName] = {};
for (const chain in patterns[appName]) {
if (patterns[appName].hasOwnProperty(chain)) {
js[appName][chain] = {};
for (const index in patterns[appName][chain]) {
const value = detectJs(chain);
if (value && patterns[appName][chain].hasOwnProperty(index)) {
js[appName][chain][index] = value;
}
}
}
}
}
}
postMessage({ id: 'js', js }, '*');
};
addEventListener('message', onMessage);
} catch (e) {
// Fail quietly
}
})();
这是某种恶意软件吗?
解决方案
我看到了相同的代码,并确定它是 Wappalyzer 的一部分,方法是使用 Chrome 中的开发人员工具,单击 Sources 选项卡并在 Page 子选项卡上搜索 inject.js。
推荐阅读
- angular - 我需要单元测试方面的帮助。对于代码。我想通过编写单元测试在角度规范文件中覆盖这段代码
- android - 在android构建上找不到本机库?
- r - 如何拆分混合大小写的字符串?
- android - 为什么每次重新启动应用程序时都会创建数据库?
- regex - awk 或 sed:如何根据上一行和下一行进行修改
- mongodb - 有没有办法在投影的 $map 中使用 $Set
- web-scraping - 使用 python 抓取 Booking 评论
- python - 如何在 QTableWidget 中设置项目的文本在 pyqt 中水平和垂直居中?
- react-native - 是否有任何可用于学习 React Native 的参考应用程序?
- python - 如何显示低于某个数字的价格?