Thursday, May 28, 2015

How to scan port on local computer Lubuntu


Sometimes i want to know what port is open on my local computer, i want to know what services is running through my local computer.

So how to do this? how can i find out what ports are opened on my local computer? how can i scan my local computer (lubuntu) for open ports?

It's actually pretty simple, all you have to do is open up terminal/console (CTRL + ALT + T) and then type this command:

netstat -ntlp | grep LISTEN

That's it, you will get all listening port numbers, these port numbers represent certain service inside our computer, for example port number 80 is a web server.

kernelpanic@lubuntulaptop:~$ netstat -ntlp | grep LISTEN
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::139                  :::*                    LISTEN      -               
tcp6       0      0 :::22                   :::*                    LISTEN      -               
tcp6       0      0 ::1:631                 :::*                    LISTEN      -               
tcp6       0      0 :::445                  :::*                    LISTEN 

From the output above, shows that i have several ports open, which is port 139, 53, 22, 631, and 445. So what does it mean exactly??

For example if you have port 21 open, that means your computer is running ftp server, if you have port 22 open, then you must be running ssh server, etc.

If you are not sure about certain port, you can find out by typing the command below, it will shows exactly what kind of service for that specific port.

sudo netstat -ntlp | grep :139
sudo netstat -ntlp | grep :53
sudo netstat -ntlp | grep :22
sudo netstat -ntlp | grep :631
sudo netstat -ntlp | grep :445

Netstat command comes pre-installed on lubuntu, so we don't have to install it first, we can just use it right away, very simple and easy to use.

I just show you how to scan local computer for open port, so how do i scan other computer (or certain ip address) for open port?? the answer would be on another article...stay tune :)

No comments:

Post a Comment