Compare commits
No commits in common. "59a1320186bfd4223c2c3677111c8acbc12d5bb7" and "9df3585d21f043a1d379650c9b6399d2bc0dffb1" have entirely different histories.
59a1320186
...
9df3585d21
3 changed files with 4 additions and 26 deletions
|
@ -9,15 +9,12 @@ DEBUG=false
|
||||||
PORT_RANGE="1-65535"
|
PORT_RANGE="1-65535"
|
||||||
NMAP_ARGS=""
|
NMAP_ARGS=""
|
||||||
KNOWN_PORTS=()
|
KNOWN_PORTS=()
|
||||||
IPv=""
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|--host) HOST="$2"; shift;;
|
-h|--host) HOST="$2"; shift;;
|
||||||
-p|--portrange) PORT_RANGE="$2"; shift;;
|
-p|--portrange) PORT_RANGE="$2"; shift;;
|
||||||
-k|--known) KNOWN_PORTS+=($2); shift;;
|
-k|--known) KNOWN_PORTS+=($2); shift;;
|
||||||
-d|--debug) DEBUG=true;;
|
-d|--debug) DEBUG=true;;
|
||||||
-4|--ipv4) IPv="";;
|
|
||||||
-6|--ipv6) IPv="-6";;
|
|
||||||
-i|--input)
|
-i|--input)
|
||||||
INPUT="$2"
|
INPUT="$2"
|
||||||
if [ ! -f "$INPUT" ]; then
|
if [ ! -f "$INPUT" ]; then
|
||||||
|
@ -31,7 +28,6 @@ while [[ $# -gt 0 ]]; do
|
||||||
echo "--host HOSTNAME/IP: Host that shall be scanned by nmap"
|
echo "--host HOSTNAME/IP: Host that shall be scanned by nmap"
|
||||||
echo "--portrange RANGE: Ports that shall be scanned (nmap format)"
|
echo "--portrange RANGE: Ports that shall be scanned (nmap format)"
|
||||||
echo "--known PORTNUMBER: Port number that is expected to be open"
|
echo "--known PORTNUMBER: Port number that is expected to be open"
|
||||||
echo "--ipv6: Use IPv6 for the scan (IPv4 if not specified)"
|
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -78,7 +74,7 @@ function runNmap {
|
||||||
done < $INPUT
|
done < $INPUT
|
||||||
else
|
else
|
||||||
local $cmd
|
local $cmd
|
||||||
cmd="nmap $portrange $IPv $NMAP_ARGS -- $HOST"
|
cmd="nmap $portrange $NMAP_ARGS -- $HOST"
|
||||||
log "$cmd"
|
log "$cmd"
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
parseLine "$line"
|
parseLine "$line"
|
||||||
|
|
|
@ -2,7 +2,7 @@ object CheckCommand "nmap" {
|
||||||
import "ipv4-or-ipv6"
|
import "ipv4-or-ipv6"
|
||||||
|
|
||||||
command = [ "/home/nagios/check_nmap.sh/check_nmap.sh" ]
|
command = [ "/home/nagios/check_nmap.sh/check_nmap.sh" ]
|
||||||
timeout = 12h
|
timeout = 10m
|
||||||
|
|
||||||
arguments = {
|
arguments = {
|
||||||
"--host" = {
|
"--host" = {
|
||||||
|
|
|
@ -1,31 +1,13 @@
|
||||||
apply Service "nmap4" {
|
apply Service "nmap" {
|
||||||
import "generic-service"
|
import "generic-service"
|
||||||
|
|
||||||
check_command = "nmap"
|
check_command = "nmap"
|
||||||
check_interval = 24h
|
check_interval = 24h
|
||||||
retry_interval = 2h
|
retry_interval = 2h
|
||||||
vars.notification_interval = 1d
|
|
||||||
vars.nmap_ipv4 = true
|
|
||||||
|
|
||||||
for (k => v in host.vars.nmap) {
|
for (k => v in host.vars.nmap) {
|
||||||
vars["nmap_" + k] = v
|
vars["nmap_" + k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
assign where host.vars.nmap != null && (host.vars.nmap.ipv6_only == null || host.vars.nmap.ipv6_only == false)
|
assign where host.vars.nmap != null
|
||||||
}
|
|
||||||
|
|
||||||
apply Service "nmap6" {
|
|
||||||
import "generic-service"
|
|
||||||
|
|
||||||
check_command = "nmap"
|
|
||||||
check_interval = 24h
|
|
||||||
retry_interval = 2h
|
|
||||||
vars.notification_interval = 1d
|
|
||||||
vars.nmap_ipv6 = true
|
|
||||||
|
|
||||||
for (k => v in host.vars.nmap) {
|
|
||||||
vars["nmap_" + k] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
assign where host.vars.nmap != null && (host.vars.nmap.ipv4_only == null || host.vars.nmap.ipv4_only == false)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue