js注入,canvas截图

拿到画布数据

document.getElementsByClassName("inner_page")[0] //DOM对象,默认BASE64格式
document.getElementsByClassName("inner_page")[0].toDataURL("image/jpeg")  //转换成jpeg的BASE64

(引用)注入js,另存为功能

var script=document.createElement("script");
script.src="https://superal.github.io/canvas2image/canvas2image.js";
document.getElementsByTagName('head')[0].appendChild(script);

一句话的方式:

 var script=document.createElement("script");script.src="https://superal.github.io/canvas2image/canvas2image.js";document.getElementsByTagName('head')[0].appendChild(script);

弹出并下载:

Canvas2Image.saveAsJPEG(document.getElementsByClassName("inner_page")[0])
Canvas2Image.saveAsJPEG(document.getElementsByClassName("inner_page")[1]) //手动保存多个
上一篇:Shell Script入门到入土


下一篇:Nmap