22/05/2015

[Linux] Check remote port connection

It may happen that you're working on a server with a user that has very limited capabilities. Sometimes you have no access to telnet:

telnet host port

nmap:

nmap -A host -p port

curl - it will complain that it did not receive data, meaning that it connected successfully:

curl http://host:port

netcat:

nc host port

 or whatever other tool you like to use. So what to do? Well maybe, you have access to bash:

cat < /dev/tcp/host/port

but I find this method not very reliable. Instead you might have access to Python as well:

python
import socket
test_conn=socket.create_connection(('host',port))

No comments:

Post a Comment

With great power comes great responsibility