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

Issues with count_hosts_by_os example #80

Open
mikemadden42 opened this issue May 23, 2021 · 3 comments
Open

Issues with count_hosts_by_os example #80

mikemadden42 opened this issue May 23, 2021 · 3 comments

Comments

@mikemadden42
Copy link

I'm seeing a few issues with the count_hosts_by_os example in this repository.

I get this error when I run the program without sudo. Does this example require to be ran with sudo or root?

$ ./count_hosts_by_os
2021/05/23 07:03:44 nmap scan failed: unable to parse nmap output, see warnings for details

When I run the example, the number of Linux hosts is more than the number of hosts seen on the network.

$ sudo ./count_hosts_by_os
Discovered 25 linux hosts and 0 windows hosts out of 18 total up hosts.
@Ullaakut
Copy link
Owner

Ullaakut commented May 24, 2021

Hi @mikemadden42 ! Thanks for opening this issue :) It indeed requires root privileges, since in order to detect operating systems, nmap needs to do TCP/IP fingerprinting.

As for the inaccurate counts, I think I know what is happening, but just to be sure, could you please run the following on your machine?

sudo nmap -F -O 192.168.0.0/24

I think what happens is that the OS detection counts multiple times per host, in some cases. I am unable to reproduce it on my network though, which is why it would be helpful to see the output you are getting :)

Either way, the fix is as simple as adding a break statement when we increase the count for a host, to avoid counting more than once per host.

@mikemadden42
Copy link
Author

Hi @Ullaakut , is there a subset of information I could provide? The full output of the nmap command you listed above could expose a lot of internal information.

@Ullaakut
Copy link
Owner

Hi @mikemadden42,

Sure, you could just manually check whether or not it shows multiple OSes per host, and let us know here :)

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

No branches or pull requests

2 participants