Blame tests/p_nmap/nmap_test_eth0.sh
|
Athmane Madjoudj |
8f72ef |
#!/bin/sh
|
|
Athmane Madjoudj |
8f72ef |
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
|
|
Athmane Madjoudj |
8f72ef |
|
|
Athmane Madjoudj |
8f72ef |
t_Log "Running $0 - nmap querys eth0 and checks for open ssh-port"
|
|
Athmane Madjoudj |
8f72ef |
|
|
Athmane Madjoudj |
8f72ef |
# Grabing IP of eth0
|
|
Athmane Madjoudj |
8f72ef |
IP=$(ip -f inet addr list eth0 | grep 'inet ')
|
|
Athmane Madjoudj |
8f72ef |
regex='.*inet\ (.*)\/.*'
|
|
Athmane Madjoudj |
8f72ef |
if [[ $IP =~ $regex ]]
|
|
Athmane Madjoudj |
8f72ef |
then
|
|
Athmane Madjoudj |
8f72ef |
t_Log "Found eth0 IP - starting nmap test"
|
|
Athmane Madjoudj |
8f72ef |
nmap ${BASH_REMATCH[1]} | grep -iq ssh
|
|
Athmane Madjoudj |
8f72ef |
fi
|
|
Athmane Madjoudj |
8f72ef |
|
|
Athmane Madjoudj |
8f72ef |
t_CheckExitStatus $?
|