Instead of telnet, an option would be also to use nmap to test for the remote host/port availability (you can use the default fixlets to deploy a nmap scanpoint to distribute it on Windows and Linux systems), then you can use it in a task selecting the appropriate options depending on the protocol used by the listening host, and reducing the other discovery attempts. I’d specify the options -p8014 ( portlist) and -sT (for TCP) or -sU (for UDP sevice, depending on listening host’s behavior), and use the same analysis techniques suggested to return info about success/failure of connection, and possibly the latency of the connection. Also -Pn can help removing a ping attempt.
wait nmap -Pn -sT -p8014 -oN /tmp/10101030_8014.nmap 10.10.10.30 > /dev/null
should produce a file like:
Nmap 6.47 scan initiated Thu Jul 16 23:20:39 2015 as: nmap -Pn -sT -p8014 -oN /tmp/pio.nmap 10.10.10.30
Nmap scan report for 10.10.10.30
Host is up (0.11s latency).
PORT STATE SERVICE
8014/tcp closed unknown
Nmap done at Thu Jul 16 23:20:39 2015 – 1 IP address (1 host up) scanned in 0.23 seconds
and your analysis relevance will sound like:
exist lines whose (it contains open and it contains 8014) of file “/tmp/10101030_1084.nmap”
This technique will also allow you to identify with a single task other ports/hosts if you need to, and will not depend on telnet tcp timeout