问题描述
标题有点误导,但我找不到其他好的标题。因此,我想要的是我可以控制的某些浏览器对window对象和DOM对象的实现。这似乎没有道理,但让我尝试尽我所能解释。 初始代码是在网站上的:
name = "";
document.referrer = "";
opener = "";
let input = new URL(document.location).searchParams.get("yummy");
if(input != null && (top==window || top.length == 1) && (parent == window || parent.length == 1) && input.match(/^[\w\.]*$/gi)){
eval(eval(input));
}
修改后,这就是代码!
name = "";document.referrer = "";opener = "";
let input = new URL(document.location).searchParams.get("yummy");
if(input != null) {
if (top==window || top.length == 1) {
if (parent == window || parent.length == 1) {
if input.match(/^[\w\.]*$/gi)){
eval(eval(input));
} else { console.log("Regex didnt match") };
} else { console.log("Parent != window or parent length != 1") }
} else { console.log("Top != window or top length != 1") };
} else { console.log("Input == Null") };
现在,由于我要尝试评估,我将在浏览器中使用send yummy(?yummy = ls)。但是,如果我使用第一个代码,浏览器不会告诉我它在哪种情况下失败,如果我使用第二个代码,它将告诉我我在哪里失败了,但是在每次请求之后,我都必须按F12来查看控制台。是的,我可以这样做,但是如果我制作一个python3程序来发出请求,评估此javascript,阅读控制台并在终端中打印,那将非常棒。如果那不可能,那么可以使用python3将http请求发送到浏览器(机械化,phantomjs或v8引擎或其他),阅读控制台(让浏览器评估javascript),然后在终端中打印。另外,nodejs不支持window和DOM对象。
那么,我有可能实现这一目标吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)