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

WithOSDetection: check for root privileges warning -- fix unclear error status #137

Merged
merged 1 commit into from
Jan 5, 2025

Conversation

tonymet
Copy link
Contributor

@tonymet tonymet commented Jan 5, 2025

Improve error handling when WithOSDetection is called without being root

Example Test CLI

https://gist.github.com/tonymet/6107b994863d8ba8f6e0c062ae026b27

git clone git@gist.github.com:6107b994863d8ba8f6e0c062ae026b27.git node-go-test
cd node-go-test
 go run . --target 192.168.10.1 
2025/01/04 17:21:09 unable to run nmap scan: this feature requires root privileges
2025/01/04 17:21:09 Warnings: 
 &[TCP/IP fingerprinting (for OS scan) requires root privileges.]
Nmap done: 0 hosts up scanned in 0.000000 seconds

STEPS TO REPEAT

  1. create a scanner WithOSDetection() (see gist)
  2. inspect err or warnings
	scanner, err := nmap.NewScanner(
		ctx,
		nmap.WithTargets(optTargets...),
		nmap.WithPorts(optPorts),
		nmap.WithOSDetection(),
	)

BEFORE

2025/01/04 17:15:08 unable to run nmap scan: exit status 1

AFTER

2025/01/04 17:15:28 unable to run nmap scan: this feature requires root privileges
2025/01/04 17:15:28 Warnings: 
 &[TCP/IP fingerprinting (for OS scan) requires root privileges.]

@tonymet tonymet changed the title check for root privileges warning -- fix unclear error status WithOSDetection: check for root privileges warning -- fix unclear error status Jan 5, 2025
@tonymet
Copy link
Contributor Author

tonymet commented Jan 5, 2025

excellent library. Very easy to work with , easy to patch

Copy link
Owner

@Ullaakut Ullaakut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tonymet , thanks for your contribution :) This looks good to me 👍

@Ullaakut Ullaakut merged commit 3b1ad87 into Ullaakut:master Jan 5, 2025
@Ullaakut
Copy link
Owner

Ullaakut commented Jan 5, 2025

Released as v3.0.5

@tonymet
Copy link
Contributor Author

tonymet commented Jan 5, 2025

@Ullaakut thanks for the fantastic module and being an awesome maintainer. Happy to help out feel free to ping me if any other support work is needed.

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

Successfully merging this pull request may close these issues.

2 participants