aboutsummaryrefslogtreecommitdiffstats
path: root/libs/services.php
diff options
context:
space:
mode:
Diffstat (limited to 'libs/services.php')
-rw-r--r--libs/services.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/services.php b/libs/services.php
index 61411e4..a3f9e94 100644
--- a/libs/services.php
+++ b/libs/services.php
@@ -5,7 +5,7 @@ $Config = new Config();
$datas = array();
-$available_protocols = array('tcp', 'udp');
+$available_protocols = array('tcp', 'udp', 'unix');
$show_port = $Config->get('services:show_port');
@@ -18,10 +18,16 @@ if (count($Config->get('services:list')) > 0)
$name = $service['name'];
$protocol = isset($service['protocol']) && in_array($service['protocol'], $available_protocols) ? $service['protocol'] : 'tcp';
- if (Misc::scanPort($host, $port, $protocol))
- $status = 1;
- else
- $status = 0;
+ $socketProtocols = array('tcp', 'udp', 'unix');
+ if (in_array($protocol, $socketProtocols)) {
+ if (Misc::socketAvailable($host, $port, $protocol))
+ $status = 1;
+ else
+ $status = 0;
+ }
+ else {
+ $status = Misc::systemdServiceActive($host) ? 1 : 0;
+ }
$datas[] = array(
'port' => $show_port === true ? $port : '',