Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mettle_get_fqdn: Returns IP address not hostname #239

Open
bcoles opened this issue Nov 22, 2022 · 5 comments
Open

mettle_get_fqdn: Returns IP address not hostname #239

bcoles opened this issue Nov 22, 2022 · 5 comments
Labels

Comments

@bcoles
Copy link
Contributor

bcoles commented Nov 22, 2022

diff --git a/mettle/src/mettle.c b/mettle/src/mettle.c
index ae50704..6bdf22c 100644
--- a/mettle/src/mettle.c
+++ b/mettle/src/mettle.c
@@ -255,6 +255,7 @@ struct mettle *mettle(void)
        m->em = extmgr_new();
 
        sigar_fqdn_get(m->sigar, m->fqdn, sizeof(m->fqdn));
+       printf("FQDN: %s\n", m->fqdn);
 
        sigar_sys_info_get(m->sigar, &m->sysinfo);
$ ./build/linux.x86_64/mettle/src/mettle 
FQDN: 192.168.200.204
@usiegl00
Copy link

usiegl00 commented Dec 5, 2022

What is the hostname, this is "expected" behavior if it is not a FQDN:
https://github.com/rapid7/sigar/blob/08507a8aae1d37d040f888fe7a42c166a8732122/src/sigar.c#L2374

@bcoles
Copy link
Contributor Author

bcoles commented Dec 5, 2022

What is the hostname, this is "expected" behavior if it is not a FQDN: https://github.com/rapid7/sigar/blob/08507a8aae1d37d040f888fe7a42c166a8732122/src/sigar.c#L2374

Makes sense. The tested system hostname is not a FQDN.

On the Metasploit side we expect only a hostname. It doesn't need to be a FQDN (rapid7/metasploit-framework#17289). An IP address instead rather than a hostname is unexpected.

@usiegl00
Copy link

usiegl00 commented Dec 5, 2022

Maybe break sigar_hostname_get out from sigar_fqdn_get?

@usiegl00
Copy link

usiegl00 commented Dec 5, 2022

There is also sigar_net_info_get which has the host_name field.

@sempervictus
Copy link

There is also sigar_net_info_get which has the host_name field.

This strikes me as the right direction since it doesnt mess w/ upstream and gives us a few other fields we can use (or discard) as we please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants