diff --git a/tests/p_nmap/0_install_nmap.sh b/tests/p_nmap/0_install_nmap.sh new file mode 100755 index 0000000..4782b77 --- /dev/null +++ b/tests/p_nmap/0_install_nmap.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - install package nmap" +t_InstallPackage nmap + diff --git a/tests/p_nmap/nmap_test_eth0.sh b/tests/p_nmap/nmap_test_eth0.sh new file mode 100755 index 0000000..df24b90 --- /dev/null +++ b/tests/p_nmap/nmap_test_eth0.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - nmap querys eth0 and checks for open ssh-port" + +# Grabing IP of eth0 +IP=$(ip -f inet addr list eth0 | grep 'inet ') +regex='.*inet\ (.*)\/.*' +if [[ $IP =~ $regex ]] + then + t_Log "Found eth0 IP - starting nmap test" + nmap ${BASH_REMATCH[1]} | grep -iq ssh +fi + +t_CheckExitStatus $? diff --git a/tests/p_nmap/nmap_test_lo.sh b/tests/p_nmap/nmap_test_lo.sh new file mode 100755 index 0000000..692973d --- /dev/null +++ b/tests/p_nmap/nmap_test_lo.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - nmap querys loopback and checks for open ssh port" + +nmap 127.0.0.1 | grep -qi ssh + +t_CheckExitStatus $?