in reply to Capturing the output of nmap from within a Perl script
First, I'm not really sure what nmap is. That's probably not too important.
Second, I'm not sure what a root-only binary is doing in /usr/bin. It should be in /usr/sbin. So that's a bit odd.
Finally, you want sudo. It provides the ability to allow a user (e.g., "wwwrun" or "apache" or whatever your server drops privileges to) to become another user (e.g., 'root') to run specific programs (e.g., "/usr/bin/nmap"), optionally (well, mandatory for you) without providing a password.
my $output = `sudo /usr/bin/nmap -sU -p 2300,6500 $ENV{'REMOTE_ADDR'}` +;
Note that setting the suid bit is not enough unless the program is written to take advantage of the bit.
Update: Not sure what I'm on. I still prefer sudo to set-uid.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Capturing the output of nmap from within a Perl script
by mrborisguy (Hermit) on Aug 09, 2005 at 01:10 UTC | |
|
Re^2: Capturing the output of nmap from within a Perl script
by Anonymous Monk on Aug 08, 2005 at 23:59 UTC | |
|
Re^2: Capturing the output of nmap from within a Perl script
by spiritway (Vicar) on Aug 09, 2005 at 01:05 UTC |