diff options
author | Renato Botelho <renato@netgate.com> | 2015-08-03 13:44:36 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-08-03 13:44:36 -0300 |
commit | eee26008666292465f1de7e74b63d36769985c4e (patch) | |
tree | 0c2667b1034b3a12598fbfc65f6db807d9170194 /config/nmap/nmap.inc | |
parent | 727ab97aa214417a41f943f929ff4bb9f79fcbc8 (diff) | |
parent | 03b8e426bc1c403a3bedc37ed885ff8d4a7ff2da (diff) | |
download | pfsense-packages-eee26008666292465f1de7e74b63d36769985c4e.tar.gz pfsense-packages-eee26008666292465f1de7e74b63d36769985c4e.tar.bz2 pfsense-packages-eee26008666292465f1de7e74b63d36769985c4e.zip |
Merge pull request #924 from doktornotor/patch-13
Diffstat (limited to 'config/nmap/nmap.inc')
-rw-r--r-- | config/nmap/nmap.inc | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/config/nmap/nmap.inc b/config/nmap/nmap.inc index 632d4b2d..cbf1b15a 100644 --- a/config/nmap/nmap.inc +++ b/config/nmap/nmap.inc @@ -1,9 +1,9 @@ <? -/* $Id$ */ /* - part of pfSense (https://www.pfsense.org/) - - Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com. + nmap.inc + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2006 Bill Marquette <bill.marquette@gmail.com> + Copyright (C) 2015 ESF, LLC All rights reserved. Redistribution and use in source and binary forms, with or without @@ -43,20 +43,16 @@ function nmap_install() { } /* Only copy the file if it doesn't exist */ if (file_exists($source_file) && !file_exists($destination_file)) { - if (!is_dir(dirname($destination_file))) { - @mkdir(dirname($destination_file), 0644, true); - } + safe_mkdir(dirname($destination_file)); @symlink($source_file, $destination_file); } } -function nmap_custom_php_validation_command($post, & $input_errors) { +function nmap_custom_php_validation_command($post, &$input_errors) { global $_POST, $savemsg, $config; if (empty($_POST['hostname'])) { $input_errors[] = gettext("You must enter an IP address to scan."); - } elseif (!(is_ipaddr($_POST['hostname']) || - is_subnet($_POST['hostname']) || - is_hostname($_POST['hostname']))) { + } elseif (!(is_ipaddr($_POST['hostname']) || is_subnet($_POST['hostname']) || is_hostname($_POST['hostname']))) { $input_errors[] = gettext("You must enter a valid IP address to scan."); } @@ -71,9 +67,9 @@ function nmap_custom_php_validation_command($post, & $input_errors) { function nmap_custom_add_php_command() { $nmap_options = ""; - if (function_exists("is_ipaddrv6") && function_exists("is_subnetv6")) - if (is_ipaddrv6($_POST['hostname']) || is_subnetv6($_POST['hostname'])) - $nmap_options .= " -6"; + if (is_ipaddrv6($_POST['hostname']) || is_subnetv6($_POST['hostname'])) { + $nmap_options .= " -6"; + } switch($_POST['scanmethod']) { case 'syn': @@ -93,14 +89,23 @@ function nmap_custom_add_php_command() { break; } - if($_POST['noping']) $nmap_options .= " -P0"; - if($_POST['servicever']) $nmap_options .= " -sV"; - if($_POST['osdetect']) $nmap_options .= " -O"; - if(!empty($_POST['interface'])) $nmap_options .= " -e " . get_real_interface($_POST['interface']); + if ($_POST['noping']) { + $nmap_options .= " -P0"; + } + if ($_POST['servicever']) { + $nmap_options .= " -sV"; + } + if ($_POST['osdetect']) { + $nmap_options .= " -O"; + } + if (!empty($_POST['interface'])) { + $nmap_options .= " -e " . get_real_interface($_POST['interface']); + } $nmap_options .= " " . escapeshellarg($_POST['hostname']); - echo "Running: /usr/local/bin/nmap {$nmap_options}</br>"; + echo "<strong>Running: /usr/local/bin/nmap {$nmap_options}</strong><br />"; system("/usr/local/bin/nmap" . $nmap_options); + echo "<br /><br /><input class=\"formbtn\" type=\"button\" value=\"Back to NMap\" onclick=\"history.back()\" />"; } function nmap_get_interfaces() { |