typeof window.__VUE__ !== 'undefined' ||
typeof window.Vue !== 'undefined'
const vueElements = document.querySelectorAll('*');
for (const el of vueElements) {
if (el.__vue__ || el.__vue_app__) {
return 'vue';
}}
window.$router
divObject.__vue_app__.config.globalProperties.$router
divObject.__vue_app__.$router
function recursiveFindRouterWithPush(obj, depth = 0, maxDepth = 5) {
if (depth > maxDepth) {
return null;
}
for (const key in obj) {
try {
if (key === '$router' && obj[key] !== null && typeof obj[key] === 'object' && typeof obj[key].beforeEach === 'function') {
return obj[key];
}
} catch (error) {
}
try {
if (typeof obj[key] === 'object' && obj[key] !== null) {
const foundInSubObject = recursiveFindRouterWithPush(obj[key], depth + 1, maxDepth);
if (foundInSubObject) {
return foundInSubObject;
}
}
} catch (error) {
}
}
return null;
}
$router.getRoutes()
$router.options.routes
foundRouter.getRoutes().forEach(route => {
for (let key in route.meta) {
if (route.meta.hasOwnProperty(key) && key.includes('auth') && route.meta[key] === true) {
route.meta[key] = false;
}
}
})
foundRouter.push('/some/secret/page/you/can/not/access')
// Next.js, method 1: 检查 Next.js 的全局变量
if (typeof window.__NEXT_DATA__ !== 'undefined') {
return 'nextjs'; // Next.js 是基于 React 的,应该优先判断
}
// Next.js, method 2: 检查特定的 meta 和 script 标签
if (!!document.querySelector('meta[name="next-head"]')){
return 'nextjs';
};
const scripts = Array.from(document.querySelectorAll('script[src^="/_next/"]'));
if (scripts.length > 0) {
return 'nextjs';
}
// React, method 1: 检查 React 相关的全局变量
if (typeof window.__REACT__ !== 'undefined' || typeof window.React !== 'undefined' || typeof window.__REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined') {
return 'react';
}
// React, method 2: 检查 DOM 元素上的 React 属性
const rootElement = document.getElementById('root') || document.querySelector('*'); // 尝试获取根元素
if (rootElement) {
for (const key in rootElement) {
if (key.startsWith('__react') || key.startsWith('__reactFiber$')) {
return 'react';
}
}
}
if (window.angular || window.ng) {
return 'angular';
}
if (document && document.querySelector('[ng-version]')) {
return 'angular';
}
原文始发于微信公众号(李姐姐的扫描器):API接口深度发现的动态爬虫实现(3. Web框架识别和移除鉴权)
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论