Blame tests/p_nmap/nmap_test_eth0.sh

Christoph Galuschka dd7235
#!/bin/sh
Christoph Galuschka dd7235
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka dd7235
Christoph Galuschka dd7235
t_Log "Running $0 - nmap querys eth0 and checks for open ssh-port"
Christoph Galuschka dd7235
40b4c8
if [ "$CONTAINERTEST" -eq "1" ]; then
40b4c8
    t_Log "Running in container -> SKIP"
40b4c8
    exit 0
40b4c8
fi
40b4c8
Christoph Galuschka dd7235
# Grabing IP of eth0
Christoph Galuschka dd7235
IP=$(ip -f inet addr list eth0 | grep 'inet ')
Christoph Galuschka dd7235
regex='.*inet\ (.*)\/.*'
Christoph Galuschka dd7235
if [[ $IP =~ $regex ]]
Christoph Galuschka dd7235
  then
Christoph Galuschka dd7235
  t_Log "Found eth0 IP - starting nmap test"
Christoph Galuschka dd7235
  nmap ${BASH_REMATCH[1]} | grep -iq ssh
Christoph Galuschka dd7235
fi
Christoph Galuschka dd7235
Christoph Galuschka dd7235
t_CheckExitStatus $?