aboutsummaryrefslogtreecommitdiffstats
path: root/config/nmap
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-11-15 14:29:49 +0100
committerdoktornotor <notordoktor@gmail.com>2015-11-15 14:29:49 +0100
commita82eb1b5a23ff9e44bb8acf3ce0d396a1731f3b1 (patch)
tree46b1750954b2839561634f38a1aca56ba1f817e5 /config/nmap
parent088e90e3102e4e2c2d2c7fdae0f26a31978ea767 (diff)
downloadpfsense-packages-a82eb1b5a23ff9e44bb8acf3ce0d396a1731f3b1.tar.gz
pfsense-packages-a82eb1b5a23ff9e44bb8acf3ce0d396a1731f3b1.tar.bz2
pfsense-packages-a82eb1b5a23ff9e44bb8acf3ce0d396a1731f3b1.zip
Remove created symlink on uninstall, clean up input validations, code style fixes
Diffstat (limited to 'config/nmap')
-rw-r--r--config/nmap/nmap.inc20
1 files changed, 13 insertions, 7 deletions
diff --git a/config/nmap/nmap.inc b/config/nmap/nmap.inc
index cbf1b15a..9d867770 100644
--- a/config/nmap/nmap.inc
+++ b/config/nmap/nmap.inc
@@ -30,7 +30,7 @@
function nmap_install() {
$destination_file = "/usr/local/share/nmap/nmap-mac-prefixes";
- $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ $pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3);
switch ($pfs_version) {
case "2.1":
$source_file = "/usr/pbi/nmap-" . php_uname("m") . "/share/nmap/nmap-mac-prefixes";
@@ -48,17 +48,23 @@ function nmap_install() {
}
}
+function nmap_deinstall() {
+ $destination_file = "/usr/local/share/nmap/nmap-mac-prefixes";
+ if (is_link($destination_file)) {
+ @unlink($destination_file);
+ }
+}
+
function nmap_custom_php_validation_command($post, &$input_errors) {
- global $_POST, $savemsg, $config;
- if (empty($_POST['hostname'])) {
+ 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.");
}
- if(!empty($_POST['interface'])) {
+ if(!empty($post['interface'])) {
$interfaces = get_configured_interface_with_descr();
- if (!array_key_exists($_POST['interface'], $interfaces)) {
+ if (!array_key_exists($post['interface'], $interfaces)) {
$input_errors[] = gettext("Invalid interface.");
}
}
@@ -122,7 +128,7 @@ function nmap_get_interfaces() {
if (is_array($config['openvpn']["openvpn-{$mode}"])) {
foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
if (!isset($setting['disable'])) {
- $tmp["name"] = gettext("OpenVPN") . " ".$mode.": ".htmlspecialchars($setting['description']);
+ $tmp["name"] = gettext("OpenVPN") . " " . $mode . ": " . htmlspecialchars($setting['description']);
$tmp["value"] = 'ovpn' . substr($mode, 0, 1) . $setting['vpnid'];
$nmap_ifs[] = $tmp;
}