From 7478a2fe9dcad128c0213f003666cb28b5daeaf1 Mon Sep 17 00:00:00 2001 From: bcoles Date: Fri, 20 Jan 2012 16:17:02 +1030 Subject: [PATCH] Added Detect CUPS module --- modules/host/detect_cups/command.js | 34 ++++++++++++++++++++++++++++ modules/host/detect_cups/config.yaml | 25 ++++++++++++++++++++ modules/host/detect_cups/module.rb | 23 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 modules/host/detect_cups/command.js create mode 100644 modules/host/detect_cups/config.yaml create mode 100644 modules/host/detect_cups/module.rb diff --git a/modules/host/detect_cups/command.js b/modules/host/detect_cups/command.js new file mode 100644 index 000000000..e05d44658 --- /dev/null +++ b/modules/host/detect_cups/command.js @@ -0,0 +1,34 @@ +// +// Copyright 2012 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() { + + var result = "Not Installed"; + var dom = document.createElement('b'); + var img = new Image; + img.src = "http://127.0.0.1:631/images/cups-icon.png"; + img.onload = function() { + if (this.width == 128 && this.height == 128) result="Installed"; + beef.net.send('<%= @command_url %>', <%= @command_id %>,'cups='+result); + dom.removeChild(this); + } + img.onerror = function() { + beef.net.send('<%= @command_url %>', <%= @command_id %>,'cups='+result); + dom.removeChild(this); + } + dom.appendChild(img); + +}); + diff --git a/modules/host/detect_cups/config.yaml b/modules/host/detect_cups/config.yaml new file mode 100644 index 000000000..b335c7987 --- /dev/null +++ b/modules/host/detect_cups/config.yaml @@ -0,0 +1,25 @@ +# +# Copyright 2012 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: + detect_cups: + enable: true + category: "Host" + name: "Detect CUPS" + description: "This module attempts to detect Common UNIX Printing System (CUPS) on localhost on the default port 631." + authors: ["bcoles"] + target: + working: ["ALL"] diff --git a/modules/host/detect_cups/module.rb b/modules/host/detect_cups/module.rb new file mode 100644 index 000000000..a2cef67a4 --- /dev/null +++ b/modules/host/detect_cups/module.rb @@ -0,0 +1,23 @@ +# +# Copyright 2012 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 Detect_cups < BeEF::Core::Command + + def post_execute + save({'CUPS' => @datastore['cups']}) + end + +end