V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
inu1255

造了一个玩具,通过插件远程控制你的浏览器

  •  
  •   inu1255 ·
    inu1255 · Oct 19, 2023 · 3708 views
    This topic created in 922 days ago, the information mentioned may be changed or developed.

    原理很简单,通过 websocket 通信 https://github.com/inu1255/debugirl

    简单写了个服务端,可以获取 V2EX 的用户名。 可以看到跟写 chrome 插件的体验基本一致。

    async function start() {
    	let tabs = await chrome.tabs.query({
    		url: "https://www.v2ex.com/",
    	});
    	let tab = tabs[0];
    	if (!tab) {
    		tab = await chrome.tabs.create({
    			url: "https://www.v2ex.com/",
    			index: 0,
    			active: false,
    		});
    	}
    	if (tab.status != "complete") await waitComplete(tab);
    	let name = await chrome.scripting.executeScript({
    		target: {tabId: tab.id},
    		func: function () {
    			return document.querySelector(".bigger").innerText;
    		},
    	});
    	console.log("your V2EX username is:", name);
    }
    
    5 replies    2023-10-24 10:09:49 +08:00
    Puteulanus
        1
    Puteulanus  
       Oct 19, 2023   ❤️ 1
    和 selenium 比的优势是什么呢
    I3tZ9NgHU44xmaA4
        2
    I3tZ9NgHU44xmaA4  
       Oct 19, 2023
    好像不错,能顺滑如丝的跑的话可以用来做电商,爬虫之类?
    sakura6264
        3
    sakura6264  
       Oct 19, 2023
    可以当后门?
    qile1
        4
    qile1  
       Oct 20, 2023 via Android
    没明白怎么控制浏览器,能不能实时看到用户点了什么,或者帮助用户点击某个选项提交表单
    lqzhgood
        5
    lqzhgood  
       Oct 24, 2023
    看上去的流程是:

    - 提前写好插件代码
    - 让对方安装插件
    - 插件后台运行获取数据
    - 通过 websocket 发回结果给 server

    还是说有个后端管理平台,可以通过 ws 发送任意代码到插件,然后 eval 执行获取结果通过 wx 返回 ?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5360 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 03:49 · PVG 11:49 · LAX 20:49 · JFK 23:49
    ♥ Do have faith in what you're doing.