Html 创建全屏 iframe
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7902960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating a full screen iframe
提问by Jingo
I'm currently looking into XSS attacks, with the aim of using them in client demonstrations (I'm a pen tester). I've written a tool that will host a malicious version of a website's login page (that harvests usernames and passwords) and then redirects the victim back to the original website. However, I have been trying to get it to work using iframes instead, as it would look far more convincing as the url won't change.
我目前正在研究 XSS 攻击,目的是在客户端演示中使用它们(我是一名渗透测试员)。我编写了一个工具,该工具将托管网站登录页面的恶意版本(收集用户名和密码),然后将受害者重定向回原始网站。但是,我一直在尝试使用 iframe 让它工作,因为它看起来更有说服力,因为 url 不会改变。
I've googled about and this seems to be the appropriate code:
我用谷歌搜索了一下,这似乎是合适的代码:
<iframe src="http://192.168.0.1/login.php" style="border: 0; width: 100%; height: 100%">
but the iframe created is by no means full screen (on internet explorer and firefox). Here is a screenshot
但创建的 iframe 绝不是全屏的(在 Internet Explorer 和 firefox 上)。这是一个屏幕截图
As you can see, the iframe login page is beneath the "what is your name?" area, thus no where near full screen. I've tried editing the css file of the malicious login page, to include full screen parameters, but this has no effect either.
如您所见,iframe 登录页面位于“您的名字是什么?”下方。区域,因此没有接近全屏的地方。我已经尝试编辑恶意登录页面的 css 文件,以包含全屏参数,但这也不起作用。
Does anyone have any solutions? Thanks!
有没有人有任何解决方案?谢谢!
回答by Moin Zaman
Not tested, but try this:
未测试,但试试这个:
<iframe src="http://192.168.0.1/login.php" style="border: 0; position:absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%">
or
或者
<iframe src="http://192.168.0.1/login.php" style="border: 0; position:fixed; top:0; left:0; right:0; bottom:0; width:100%; height:100%">
回答by Jingo
This code works:
此代码有效:
<html>
<head>
<style type="text/css">
body
{
margin: 0;
overflow: hidden;
}
#iframe1
{
height: 100%;
left: 0px;
position: absolute;
top: 0px;
width: 100%;
}
</style>
</head>
<body>
<iframe id="iframe1" src="HERE PLACE YOUR URL" frameborder="0"></iframe>
</body>
</html>