0

I need to make continuous connection attempts to www.example.com at port 443.

telnet www.example.com 443

But once done, it will keep getting connected

[root@localhost ~]# bash c_telnet.sh
Trying 142.250.195.164...
Connected to www.google.com.
Escape character is '^]'.
Connection closed by foreign host.
Trying 142.250.205.228...
Connected to www.google.com.
Escape character is '^]'.

As you can see, there is not much that you can deduce from this output. I want to test exactly when the server wasn't reachable.

I'd prefer curl only if curl -I https://www.google.com worked fast enough. Are there any alternatives?

I am not aware if I can ping port 443.

netcat is a great tool but I can't have installed it quickly, meanwhile telnet, curl etc are all available.

1
  • I would use nc -vz www.example.com 443, nc (netcat) should be pre installed on your system, if not, it's really not hard to install it. PS nc -vt is some kind of telnet emulation, you could also use openssl s_client www.example.com:443, there you could also check the certificate in one go.
    – paladin
    Commented Jan 31 at 16:08

2 Answers 2

0

As far as I know, you can also use nmap Doe this work for you?

nmap -p 443 www.google.com

would return

Starting Nmap 7.60 ( https://nmap.org ) at 2024-01-31 08:36 CET
Nmap scan report for www.google.com (142.250.201.164)
Host is up (0.0014s latency).
Other addresses for www.google.com (not scanned): 2a00:1450:4007:818::2004
rDNS record for 142.250.201.164: par21s23-in-f4.1e100.net

PORT    STATE SERVICE
443/tcp open  https

and give you back the shell without connecting as telnet does

2
  • unix.stackexchange.com/a/339643/588983 Found my answer here. Thanks but nmap is not going to be available in a server where netcat isn't available.
    – achhainsan
    Commented Jan 31 at 7:47
  • But I think an overview of what that code actually is doing especially the part where r is calculated would be good.
    – achhainsan
    Commented Jan 31 at 9:33
0

if you want to try to connect and check continuously the 443 port on one host, you should be using paping Paping @ Google Code.

Usage is paping -p 443 Name (or IP) it reacts exactly like ping so you can have average returns, failed or timeouts.

 paping -p 443 192.168.xx.xx
 paping v1.5.5 - Copyright (c) 2011 Mike Lovell

 Connecting to 192.168.xx.xx on TCP 443:

 Connected to 192.168.xx.xx: time=15.66ms protocol=TCP port=443
 Connected to 192.168.xx.xx: time=31.35ms protocol=TCP port=443
 Connected to 192.168.xx.xx: time=31.44ms protocol=TCP port=443
 Connected to 192.168.xx.xx: time=15.60ms protocol=TCP port=443

 Connection statistics:
    Attempted = 4, Connected = 4, Failed = 0 (0.00%)
 Approximate connection times:
    Minimum = 15.60ms, Maximum = 31.44ms, Average = 23.51ms

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .