How to test open ports w/o telnet or nc

Found this out of necessity when a security team didn’t allow the installation of either telnet or nc. I initially thought ssh would work, but it doesn’t really work.

The command is simple. Just do this:

/dev/tcp/<host>/<port>

Replace the <host> and <port>. Here’s how it would look if successful:

SV-LT-1361:~ altonyu$ > /dev/tcp/192.168.0.11/2049
SV-LT-1361:~ altonyu$ echo $?
0

Here’s how it would look if unsuccessful:

SV-LT-1361:~ altonyu$ > /dev/tcp/192.168.0.11/2047
-bash: connect: Connection refused
-bash: /dev/tcp/192.168.0.11/2047: Connection refused
SV-LT-1361:~ altonyu$ echo $?
1

Obviously if the command hangs, it probably means it won’t work either.

Hope this helps someone!

List of command line commands to access POP3 and IMAP4.

List of command line commands to access POP3 and IMAP4.

POP3

Start, Run, type ‘cmd’, Select ‘ok’.

Type:

Telnet

Set local_echo : This is so you can see what you type.

Open London 110 : London can be replaced with the ip address of the Exchange server.

User administrator : Administrator is the user account.

Pass password : password is the password of the user.

Stat : gives you the number of messages and total size of your mailbox.

List : Lists each message number and gives you its size.

Retr message number : message number is the number of the individual message, the message will be displayed.

Dele message number : message will be deleted from your mailbox.

Quit : end of session.

IMAP4

Start, Run, type ‘cmd’, Select ‘ok’.

Type:

Telnet

Set local_echo : This is so you can see what you type.

Open London 143 : London can be replaced with the ip address of the Exchange server.

0000 login administrator password : login with username and password.

0001 select “inbox” : select the folder you want to view.

0002 fetch 1 all : retrieves the first message header information.

0003 logout : logout.