aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-08-01 16:23:13 +0200
committerdoktornotor <notordoktor@gmail.com>2015-08-01 16:23:13 +0200
commitfdcc94c973d61600bddc38c11844357ab8949ba3 (patch)
treeb8785155ac4596c16f93a42e23f22bf43982d5d2 /config
parent029098714c02fa9b85ce02cfd944a279ba0f2b57 (diff)
downloadpfsense-packages-fdcc94c973d61600bddc38c11844357ab8949ba3.tar.gz
pfsense-packages-fdcc94c973d61600bddc38c11844357ab8949ba3.tar.bz2
pfsense-packages-fdcc94c973d61600bddc38c11844357ab8949ba3.zip
nmap - code style fixes, add copyright headers
Diffstat (limited to 'config')
-rw-r--r--config/nmap/nmap.inc43
1 files changed, 25 insertions, 18 deletions
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 @@
<?
-/* $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,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}</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() {