Telnet is a network protocol that enables a user to connect to a remote computer and communicate with it using a CLI. Telnet uses a client-server architecture, with the client at the user’s local machine and the server at the remote site.
This guide will explain the telnet with several ways to check the specific port for testing purposes. The content that illustrates this guide is:
- Check the Telnet’s Status
- How to Telnet to a Specific Port for Testing?
- Check the Open Ports for a Specific Domain
- Bonus Tip: Scanning a specific port to find vulnerabilities
Let’s start with the telnet services.
Prerequisite: Check the Telnet’s Status
To check the telnet services, the “inetd” command is utilized with the “sudo” privilege:
$ sudo systemctl status inetd
The output shows that services of “telnet” are in active state. Once you ensure the Telnet services, you can connect to a remote machine using the telnet command followed by the remote machine’s IP address or hostname.
How to Telnet to a Specific Port for Testing?
For testing purposes, you must know which ports are opened and can be accepted by a specific domain. So, the primary step is to check for the opened ports.
Check the Open Ports for Specific Domains
In our case, we are using the “nmap” command on a domain “itslinuxfoss”
# nmap itslinuxfoss.com
The output shows that “80/tcp”, “443/tcp”, “8080/tcp” and “8443/tcp” ports have an “open” state.
Example 1: Connect to port 80 for Testing Purposes
To connect to port 80 on the remote machine that provides the “HTTP” services, run the below script:
$ telnet itslinuxfoss.com 80
The output returns that the connection is established with the “itslinuxfoss.com” via “port 80”.
This will open a Telnet session to the particular port on the remote device. Depending on the service listening on the port.
Example 2: Connect to a port 443 for Testing Purposes
To connect to a specific port “443” using Telnet, you can use the “telnet” command followed by the remote machine’s IP address or hostname and the port number:
$ telnet itslinuxfoss.com 443
Example 3: Connect to a port 13 for Testing Purposes
To connect to a specific port “13” using Telnet which is not open, Let check the “telnet” command followed by the hostname and the port number:
$ telnet itslinuxfoss.com 13
The telnet generates an error if the specified port is not opened on itslinuxfoss
That is all from the guide to testing specific ports using telnet.
Bonus Tip: Scanning a Specific Port to Find Vulnerabilities
To find vulnerabilities on the specific port ( i.e., 80 in this example), the “nmap” command assists by specifying the “vuln” option with the domain name. For this, follow the below script:
$ nmap -v -p 80 --script vuln itslinuxfoss.com
To find DOS vulnerabilities, the “nmap” command can be used to scan a port by executing the below script:
$ nmap -v -p 80 --script dos itslinuxfoss.com
The output shows that the scanning is performed on the “port 80”.
That is all from the “telnet” to test specific ports.
For testing purposes, telnet is used with the domain name by specifying the port number. Before it, we must ensure the specific port is open and reachable on a remote machine. The telnet can also be used to troubleshoot connectivity issues or test the functionality of a service listening on a specific port This guide has provided various ways to test specific ports using telnet.