V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
SaulLawliet
0.01D
V2EX  ›  问与答

在一个网站开启了控制台, 跳过调试后, 我的浏览记录被塞了 N 条记录

  •  
  •   SaulLawliet · Jan 18, 2022 · 1348 views
    This topic created in 1559 days ago, the information mentioned may be changed or developed.

    网址: https://www.tvn.cc/
    恶意代码:

    	function loop() {
    		var startTime = new Date();
    		debugger;
    		if (new Date() - startTime > timeLimit) {
    			if (!open) {
    				callbacks.forEach(function(fn) {
    					fn.call(null);
    				});
    			}
    			open = true;
    			window.stop();
    			var total = "";
    			for (var i = 0; i < 1000000; i++) {
    				total = total + i.toString();
    				history.pushState(0, 0, total);
    			}
    		} else {
    			open = false;
    		}
    	}
    

    孤陋寡闻, 还可以这样?

    2 replies    2022-01-19 09:23:28 +08:00
    BreadKiller
        1
    BreadKiller  
       Jan 18, 2022   ❤️ 1
    进入断点的时候把 history.pushState 重写一下就好了
    ```
    history.pushState=()=>{};
    ```
    jazzychai
        2
    jazzychai  
       Jan 19, 2022
    打他
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   844 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 21:22 · PVG 05:22 · LAX 14:22 · JFK 17:22
    ♥ Do have faith in what you're doing.