Operating System - HP-UX
1830862 Members
2650 Online
110017 Solutions
New Discussion

running script to test telnet connectivity

 
SOLVED
Go to solution
Adam Noble
Super Advisor

running script to test telnet connectivity

Hi,

One of my colleagues wants to write a script that tests for connectivity on a specific port.

Obviously if you do a telnet you need to do a control c to break that connection so how can I manage this test within a script.

Cheers
4 REPLIES 4
Georg Tresselt
Honored Contributor
Solution

Re: running script to test telnet connectivity

Have a look at the end of this thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1052758

Seems to come down to:

>>> The trick here is how to send the ctrl-]. Use this key sequence: ctrl-v ctrl-].
You can use ctrl-v and then any other ctrl sequence to get that exact sequence.

Note that cut-n-paste from this forum will NOT grab the ctrl-C or ctrl-]!! <<<
http://www.tresselt.eu
Peter Godron
Honored Contributor

Re: running script to test telnet connectivity

Adam,
you can use expect to mimik pretty much any input. Even works for scripted passwd.

Available from:
http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/
Arturo Galbiati
Esteemed Contributor

Re: running script to test telnet connectivity

Hi,
why snd ctrl-c when a simple quit is enougth?

> telnet localhost 25<
Kasper Hedensted
Trusted Contributor

Re: running script to test telnet connectivity

Hi,

This sounds like a job for Nmap:

Nmap download:
http://hpux.connect.org.uk/hppd/hpux/Networking/Admin/nmap-3.93/

Here is the output from a port-scan on port 25:

root@servera:/> nmap -p 25 serverb

Starting nmap V. 2.53 by fyodor@insecure.org ( www.insecure.org/nmap/ )
Interesting ports on serverb:
Port State Service
25/tcp open smtp

Nmap run completed -- 1 IP address (1 host up) scanned in 0 seconds


Regards, Kasper