mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-24 18:16:24 +01:00
Add a fallback to get the hostname
This commit is contained in:
parent
074c8514d2
commit
7f21e9a29b
@ -670,12 +670,15 @@ if (!function_exists('core_machine_id')) {
|
|||||||
register_command('core_machine_id', COMMAND_ID_CORE_MACHINE_ID);
|
register_command('core_machine_id', COMMAND_ID_CORE_MACHINE_ID);
|
||||||
function core_machine_id($req, &$pkt) {
|
function core_machine_id($req, &$pkt) {
|
||||||
my_print("doing core_machine_id");
|
my_print("doing core_machine_id");
|
||||||
if (is_callable('gethostname')) {
|
if (can_call_function('gethostname')) {
|
||||||
# introduced in 5.3
|
# introduced in 5.3
|
||||||
$machine_id = gethostname();
|
$machine_id = gethostname();
|
||||||
} else {
|
} elseif(can_call_function('php_uname')) {
|
||||||
$machine_id = php_uname('n');
|
$machine_id = php_uname('n');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$machine_id = getenv('HOSTNAME');
|
||||||
|
}
|
||||||
$serial = "";
|
$serial = "";
|
||||||
|
|
||||||
if (is_windows()) {
|
if (is_windows()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user