智慧树Webpack Vue核心注入
利用webpack4的call调用找到vuex插件后对install函数做劫持拿到Vue静态实例混入初始化函数```js
// ==UserScript==
// @name 智慧树Webpack Core注入
// @namespace http://tampermonkey.net/
// @version 0.1
// @descriptiontry to take over the world!
// @author 李恒道
// @match https://onlineexamh5new.zhihuishu.com/*
// @icon https://www.google.com/s2/favicons?domain=qpanpan.com
// @grant none
// @run-at document-start
// ==/UserScript==
function enableWebpackHook(callback) {
let originCall = Function.prototype.call
Function.prototype.call = function (...args) {
const result = originCall.apply(this, args)
if (args?.a?.version === '2.5.0') {
const install = args.exports.a.install
args.exports.a.install = function (...args) {
args.mixin({
mounted: function () {
this.$el['__Ivue__'] = this
}
})
return install.apply(this, args)
}
return result
}
return result
}
}
enableWebpackHook()
``` 本帖最后由 steven026 于 2023-9-22 09:12 编辑
阁下这招webpack4注入有点东西
倘若我连夜升级迁移webpack5那阁下该如何应对呢
![](https://bbs.tampermonkey.net.cn/data/attachment/forum/202303/27/091559h4pubz916zb8dduz.jpg) steven026 发表于 2023-9-22 09:09
阁下这招webpack4注入有点东西
倘若我连夜升级迁移webpack5那阁下该如何应对呢
![](https://bbs.tamper ...
webpackjsonP劫持
只要他还有vue
我就能安排!
页:
[1]