pandorafms/pandora_server/util/plugin/udp_nmap_plugin.sh
slerena 72653518fc 2009-12-18 Sancho Lerena <slerena@artica.es>
* pandora_server.spec: Added xprobe2 dep (we made the xprobe2 rpm package
	so now it's possible to satisfy dependency). Alter all paths to binary from
	/usr/local/bin to /usr/bin. Other minor issues in RPM fixed.

	* pandora_server_installer: Added description to get deps from zypper and yum.
	Installing services in debian/ubunty systems with update-rc.d. 
	Make check to link from /usr/local/bin to /usr/bin if install
	deploy binary at /usr/local. /usr/bin is the new default.

	* pandora_server_upgrade: /usr/bin as new default. Link issue fixed.

	* DEBIAN/make_deb_package.sh: Fixed Makefile replace regexp to replace all 
	target binary to put then in the jail under /usr/bin path.

	* DEBIAN/postinst: Fixed path for tentacle_server at /usr/bin

	* DEBIAN/prerm: Using native debian commands to remove services.

	* Tools.pm: If there is a problem loading something in the enterprise, show it
	to log.

	* util/pandora_server,
	util/tentacle_serverd: new path to /usr/bin/
	
	* pandora_server.conf: new path for pandora_exec to /usr/bin/

	* util/plugin/udp_nmap_plugin.sh: Check parameters before calling to namp.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2220 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-12-18 18:22:33 +00:00

60 lines
903 B
Bash
Executable File

#!/bin/bash
# UDP Scan (using nmap) Pandora FMS Server plugin
# (c) Sancho Lerena 2008-2009
# Default values
PORT=""
HOST=""
function help {
echo -e "UDP Port Plugin for Pandora FMS Plugin server. http://pandorafms.com"
echo -e "Syntax:"
echo -e "\t\t-p port"
echo -e "\t\t-t hostname / target IP"
echo -e "Samples:"
echo " ./udp_nmap_plugin.sh -p 137 -t 192.168.5.20"
echo ""
echo -e "Please note that -p accepts nmap multiport syntax (like: 135,138,139,200-300)\n\n"
exit
}
if [ $# -eq 0 ]
then
help
fi
# Main parsing code
while getopts ":hp:t:" optname
do
case "$optname" in
"h")
help
;;
"p")
PORT=$OPTARG
;;
"t")
HOST=$OPTARG
;;
?)
help
;;
default)
help
;;
esac
done
if [ -z "$PORT" ] || [ -z "$HOST" ]
then
help
fi
# execution
nmap -T5 -p $PORT -sU $HOST | grep open | wc -l 2> /dev/null