shell_exec not working with nmap command

非 Y 不嫁゛ 提交于 2019-12-01 02:14:02

Try to specify full path to nmap like /usr/local/bin/nmap. PHP might not know about nmap location. Enjoy!

You might want to resort to exec() instead, which gives you greater error diagnostics:

// Capture outout from STDERR as well
$command = "nmap ... 2>&1";

exec($command, $output, $return_var);

// If return code is not zero, the command failed
if ($return_var != 0) 
{
    // dump all output, including error messages
    var_dump($output);
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!