All pastes #2131062 Raw Edit

Something

public text v1 · immutable
#2131062 ·published 2012-03-22 08:27 UTC
rendered paste body
#!/bin/bash

PORT=$1
IP=$2

RESULT=$(/usr/bin/nmap -PN -p $PORT $IP | /bin/grep -E "closed|filtered|open" | /usr/bin/awk '{print $2}')

if [ "$RESULT" == "open" ]
then
	echo "Le port $PORT est ouvert.|status=2;2;2;2; ok=2"
	exit 0
elif [ "$RESULT" == "closed" ]
then
	echo "Le port $PORT est ferme.|status=0;0;0;0; ok=0"
	exit 2
else
	echo "Le port est filtre.|status=1;1;1;1; ok=1"
	exit 1
fi