From 029098714c02fa9b85ce02cfd944a279ba0f2b57 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 1 Aug 2015 16:19:49 +0200 Subject: nmap - code style fixes, add copyright headers --- config/nmap/nmap.xml | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) (limited to 'config') diff --git a/config/nmap/nmap.xml b/config/nmap/nmap.xml index ad0f8e0a..446ba461 100644 --- a/config/nmap/nmap.xml +++ b/config/nmap/nmap.xml @@ -7,26 +7,25 @@ /* $Id$ */ /* ========================================================================== */ /* - authng.xml - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper . + nmap.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2006 Bill Marquette + Copyright (C) 2015 ESF, LLC All rights reserved. */ -/* ========================================================================== */ +/* ====================================================================================== */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY @@ -39,20 +38,16 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* ========================================================================== */ +/* ====================================================================================== */ ]]> - Describe your package here - Describe your package requirements here - Currently there are no FAQ items provided. nmap - 6.40_2 pkg v1.3 + 1.4 Diagnostics: NMap Scan yes true /usr/local/pkg/nmap.inc - NMap NMap is a utility for network exploration or security auditing. It supports ping scanning (determine which hosts are up), many port scanning techniques (determine what services the hosts are offering), version detection (determine what application/service is runing on a port), and TCP/IP fingerprinting (remote host OS or device identification). It also offers flexible target and port specification, decoy/stealth scanning, SunRPC scanning, and more. Most Unix and Windows platforms are supported in both GUI and command line modes. Several popular handheld devices are also supported, including the Sharp Zaurus and the iPAQ. @@ -61,7 +56,6 @@ /usr/local/pkg/ - 077 https://packages.pfsense.org/packages/config/nmap/nmap.inc @@ -97,23 +91,23 @@ -P0 noping - This allows the scanning of networks that don't allow ICMP echo requests (or responses) through their firewall. microsoft.com is an example of such a network, and thus you should always use -P0 or -PT80 when port scanning microsoft.com. Note the "ping" in this context may involve more than the traditional ICMP echo request packet. Nmap supports many such probes, including arbitrary combinations of TCP, UDP, and ICMP probes. By default, Nmap sends an ICMP echo request and a TCP ACK packet to port 80. + This allows the scanning of networks that don't allow ICMP echo requests (or responses) through their firewall. microsoft.com is an example of such a network, and thus you should always use -P0 or -PT80 when port scanning microsoft.com. Note the "ping" in this context may involve more than the traditional ICMP echo request packet. Nmap supports many such probes, including arbitrary combinations of TCP, UDP, and ICMP probes. By default, Nmap sends an ICMP echo request and a TCP ACK packet to port 80. checkbox Do not try to ping hosts at all before scanning them. -sV servicever - After TCP and/or UDP ports are discovered using one of the other scan methods, version detection communicates with those ports to try and determine more about what is actually running. A file called nmap-service-probes is used to determine the best probes for detecting various services and the match strings to expect. Nmap tries to determine the service protocol (e.g. ftp, ssh, telnet, http), the application name (e.g. ISC Bind, Apache httpd, Solaris telnetd), the version number, and sometimes miscellaneous details like whether an X server is open to connections or the SSH protocol version) + After TCP and/or UDP ports are discovered using one of the other scan methods, version detection communicates with those ports to try and determine more about what is actually running. A file called nmap-service-probes is used to determine the best probes for detecting various services and the match strings to expect. Nmap tries to determine the service protocol (e.g. ftp, ssh, telnet, http), the application name (e.g. ISC Bind, Apache httpd, Solaris telnetd), the version number, and sometimes miscellaneous details like whether an X server is open to connections or the SSH protocol version). checkbox - Try to identify service versions + Try to identify service versions. -O osdetect - This option activates remote host identification via TCP/IP fingerprinting. In other words, it uses a bunch of techniques to detect subtleties in the underlying operating system network stack of the computers you are scanning. It uses this information to create a "fingerprint" which it compares with its database of known OS fingerprints (the nmap-os-fingerprints file) to decide what type of system you are scanning + This option activates remote host identification via TCP/IP fingerprinting. In other words, it uses a bunch of techniques to detect subtleties in the underlying operating system network stack of the computers you are scanning. It uses this information to create a "fingerprint" which it compares with its database of known OS fingerprints (the nmap-os-fingerprints file) to decide what type of system you are scanning. checkbox - Turn on OS detection + Turn on OS detection. -- cgit v1.2.3 From fdcc94c973d61600bddc38c11844357ab8949ba3 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 1 Aug 2015 16:23:13 +0200 Subject: nmap - code style fixes, add copyright headers --- config/nmap/nmap.inc | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'config') diff --git a/config/nmap/nmap.inc b/config/nmap/nmap.inc index 632d4b2d..3f17d447 100644 --- a/config/nmap/nmap.inc +++ b/config/nmap/nmap.inc @@ -1,9 +1,9 @@ + 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,11 @@ 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'])) + if (function_exists("is_ipaddrv6") && function_exists("is_subnetv6")) { + if (is_ipaddrv6($_POST['hostname']) || is_subnetv6($_POST['hostname'])) { $nmap_options .= " -6"; + } + } switch($_POST['scanmethod']) { case 'syn': @@ -93,14 +91,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}
"; + echo "Running: /usr/local/bin/nmap {$nmap_options}
"; system("/usr/local/bin/nmap" . $nmap_options); + echo "

"; } function nmap_get_interfaces() { -- cgit v1.2.3 From fbb2657b8e6c0c91c3c9501af43174d66112f847 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 1 Aug 2015 16:28:02 +0200 Subject: nmap.inc - fix tag (XHTML) --- config/nmap/nmap.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config') diff --git a/config/nmap/nmap.inc b/config/nmap/nmap.inc index 3f17d447..bb4494a5 100644 --- a/config/nmap/nmap.inc +++ b/config/nmap/nmap.inc @@ -105,7 +105,7 @@ function nmap_custom_add_php_command() { } $nmap_options .= " " . escapeshellarg($_POST['hostname']); - echo "Running: /usr/local/bin/nmap {$nmap_options}
"; + echo "Running: /usr/local/bin/nmap {$nmap_options}
"; system("/usr/local/bin/nmap" . $nmap_options); echo "

"; } -- cgit v1.2.3 From da7bf010a8ec71191e0ae1f5cfe1a759b20be7cf Mon Sep 17 00:00:00 2001 From: doktornotor Date: Mon, 3 Aug 2015 14:42:24 +0200 Subject: nmap.inc - remove unneeded checks --- config/nmap/nmap.inc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'config') diff --git a/config/nmap/nmap.inc b/config/nmap/nmap.inc index bb4494a5..4d3b884a 100644 --- a/config/nmap/nmap.inc +++ b/config/nmap/nmap.inc @@ -67,10 +67,8 @@ 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'])) { + if (is_ipaddrv6($_POST['hostname']) || is_subnetv6($_POST['hostname'])) { $nmap_options .= " -6"; - } } switch($_POST['scanmethod']) { -- cgit v1.2.3 From 03b8e426bc1c403a3bedc37ed885ff8d4a7ff2da Mon Sep 17 00:00:00 2001 From: doktornotor Date: Mon, 3 Aug 2015 17:27:27 +0200 Subject: nmap.inc - fix indentation --- config/nmap/nmap.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config') diff --git a/config/nmap/nmap.inc b/config/nmap/nmap.inc index 4d3b884a..cbf1b15a 100644 --- a/config/nmap/nmap.inc +++ b/config/nmap/nmap.inc @@ -68,7 +68,7 @@ function nmap_custom_add_php_command() { $nmap_options = ""; if (is_ipaddrv6($_POST['hostname']) || is_subnetv6($_POST['hostname'])) { - $nmap_options .= " -6"; + $nmap_options .= " -6"; } switch($_POST['scanmethod']) { -- cgit v1.2.3