1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-02 11:36:22 +01:00

Add a fallback to get the hostname

This commit is contained in:
jvoisin 2024-09-01 22:26:31 +02:00
parent 074c8514d2
commit 7f21e9a29b

View File

@ -670,12 +670,15 @@ if (!function_exists('core_machine_id')) {
register_command('core_machine_id', COMMAND_ID_CORE_MACHINE_ID);
function core_machine_id($req, &$pkt) {
my_print("doing core_machine_id");
if (is_callable('gethostname')) {
if (can_call_function('gethostname')) {
# introduced in 5.3
$machine_id = gethostname();
} else {
} elseif(can_call_function('php_uname')) {
$machine_id = php_uname('n');
}
} else {
$machine_id = getenv('HOSTNAME');
}
$serial = "";
if (is_windows()) {