mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-08-14 05:36:02 +08:00
add
This commit is contained in:
parent
8cb3cd0d0b
commit
264bb30aa7
@ -82,4 +82,10 @@ function AttachDebugger() {
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
chrome.cookies.onChanged.addListener(function(info){
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs){
|
||||
chrome.tabs.sendMessage(tabs[0].id, {action: {type:'getcookie', info: info}}, function(){})
|
||||
})
|
||||
});
|
13
inject.js
13
inject.js
@ -1304,9 +1304,9 @@ function inject_script(code){
|
||||
script.onload = script.onreadystatechange = function(){
|
||||
script.onreadystatechange = script.onload = null;
|
||||
}
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
(head || document.body).appendChild( script );
|
||||
(head || document.body).removeChild( script );
|
||||
var html = document.getElementsByTagName("html")[0];
|
||||
html.appendChild( script );
|
||||
html.removeChild( script );
|
||||
}
|
||||
|
||||
function check_format(str){
|
||||
@ -1335,6 +1335,7 @@ chrome.storage.local.get(hookers, function (result) {
|
||||
}
|
||||
})
|
||||
|
||||
var cookie_cache = {}
|
||||
chrome.extension.onMessage.addListener(function(msg, sender, sendResponse) {
|
||||
if (msg.action.type == 'error'){
|
||||
inject_script(`console.error(${JSON.stringify(msg.action.info)})`)
|
||||
@ -1348,4 +1349,10 @@ chrome.extension.onMessage.addListener(function(msg, sender, sendResponse) {
|
||||
if (msg.action.type == 'alerterror'){
|
||||
inject_script(`alert(${JSON.stringify(msg.action.info)})`)
|
||||
}
|
||||
if (msg.action.type == 'getcookie'){
|
||||
var cookie = msg.action.info.cookie
|
||||
cookie_cache[cookie.domain] = cookie_cache[cookie.domain] || {}
|
||||
cookie_cache[cookie.domain][cookie.name] = cookie.value
|
||||
inject_script('window.vilame_setter='+JSON.stringify(cookie_cache))
|
||||
}
|
||||
});
|
@ -35,7 +35,7 @@
|
||||
"name": "v_jstools",
|
||||
"version": "0.0.0",
|
||||
"description": "v_jstools js hook工具",
|
||||
"permissions": ["storage", "unlimitedStorage", "activeTab", "tabs", "debugger", "storage", "contextMenus"],
|
||||
"permissions": ["storage", "unlimitedStorage", "activeTab", "tabs", "debugger", "storage", "contextMenus", "cookies"],
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
"browser_action": {
|
||||
"default_popup": "popup.html"
|
||||
|
@ -45,11 +45,10 @@ var server = wss.createServer(function(conn){
|
||||
if (info == 'browser:start'){
|
||||
global.conn = conn
|
||||
}else{
|
||||
info = {message: info}
|
||||
try{
|
||||
info = JSON.parse(info)
|
||||
}catch(e){}
|
||||
resqueue.pop().json(info)
|
||||
resqueue.pop().json({message: info})
|
||||
}
|
||||
})
|
||||
conn.on("error", function(){ console.log("error") })
|
||||
@ -164,7 +163,12 @@ function mk_websocket_hook_code(){
|
||||
console.log('websocket.onmessage', info)
|
||||
if (info.evalstring){
|
||||
// 这里让你可以通过 /?evalstring=123 传入代码直接执行,
|
||||
websocket.send(v_eval(v_decodeURIComponent(info.evalstring)))
|
||||
try{
|
||||
var ret = v_eval(v_decodeURIComponent(info.evalstring))
|
||||
}catch(e){
|
||||
var ret = e.stack
|
||||
}
|
||||
websocket.send(ret)
|
||||
}else{
|
||||
// 这里处理请求参数以及对应rpc函数调用,返回参数用字符串传递回 websocket。回传字符串即可。
|
||||
var ret = '你好'
|
||||
|
Loading…
x
Reference in New Issue
Block a user