From 8ccc8f8b2e3bf5568d1b26cee910849aa3cf970c Mon Sep 17 00:00:00 2001 From: Sergey Gorbaty Date: Thu, 21 Aug 2014 11:20:19 -0700 Subject: [PATCH] New alert user module --- .../phonegap/phonegap_alert_user/command.js | 27 +++++++++++++ .../phonegap/phonegap_alert_user/config.yaml | 17 ++++++++ .../phonegap/phonegap_alert_user/module.rb | 39 +++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 modules/phonegap/phonegap_alert_user/command.js create mode 100644 modules/phonegap/phonegap_alert_user/config.yaml create mode 100644 modules/phonegap/phonegap_alert_user/module.rb diff --git a/modules/phonegap/phonegap_alert_user/command.js b/modules/phonegap/phonegap_alert_user/command.js new file mode 100644 index 000000000..1d287980a --- /dev/null +++ b/modules/phonegap/phonegap_alert_user/command.js @@ -0,0 +1,27 @@ +// +// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net +// Browser Exploitation Framework (BeEF) - http://beefproject.com +// See the file 'doc/COPYING' for copying permission +// + +// Phonegap_alert_user +// +beef.execute(function() { + var title = "<%== @title %>"; + var message = "<%== @message %>"; + var buttonName = "<%== @buttonName %>"; + + + function onAlert() { + result = "Alert dismissed"; + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result ); + } + + navigator.notification.alert( + message, + onAlert, + title, + buttonName + ); + +}); diff --git a/modules/phonegap/phonegap_alert_user/config.yaml b/modules/phonegap/phonegap_alert_user/config.yaml new file mode 100644 index 000000000..bd577f08a --- /dev/null +++ b/modules/phonegap/phonegap_alert_user/config.yaml @@ -0,0 +1,17 @@ +# +# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +# Phonegap_prompt_user +# +beef: + module: + phonegap_alert_user: + enable: true + category: "Phonegap" + name: "Alert User" + description: "Show user an alert" + authors: ["staregate"] + target: + working: ["All"] diff --git a/modules/phonegap/phonegap_alert_user/module.rb b/modules/phonegap/phonegap_alert_user/module.rb new file mode 100644 index 000000000..a47bc7f9d --- /dev/null +++ b/modules/phonegap/phonegap_alert_user/module.rb @@ -0,0 +1,39 @@ +# +# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +# Phonegap_prompt_user +# + +class Phonegap_alert_user < BeEF::Core::Command + + def self.options + return [{ + 'name' => 'title', + 'description' => 'Alert title', + 'ui_label'=>'Title', + 'value' => 'Beef', + 'width' => '300px' + },{ + 'name' => 'message', + 'description' => 'Message', + 'ui_label'=>'Message', + 'value' => 'Game over!', + 'width' => '300px' + },{ + 'name' => 'buttonName', + 'description' => 'Default button name', + 'ui_label'=>'Button name', + 'value' => 'Done', + 'width' => '100px' + }] + end + + def callback + content = {} + content['Result'] = @datastore['result'] + save content + end + +end