1

I have written a shell script to scan the ports of system using nmap.

I am searching for some port number like 515 which is used by the Line Printer Daemon—print service and if it is there means I can say it is a printer as printer only have this daemon.

I don't know whether this port can be used by any other process.If yes kindly tell me about this whether it is possible to use the well known port or not by our own process.

If yes then I can't say it is a printer as port user is not a printer all the time.

Thnaks

3 Answers 3

1

For any port the official use of the port-number is not necessarily what is really running on there.
There are no 100% guarantees. It is always possible that somebody decided to put something else on that port. In some cases the "official" use of a port already indicates that there is more than 1 possibility.

That is why nmap has the -sV option: This attempts to probe what is really running on a port.

Having said all that: The chance that somebody abuses 1 of the more common ports (such as 515) for something else than the intended normal use is very small.

It is such a corner-case that I normally wouldn't even bother with nmap -sV, unless I am suspecting somebody is messing around intentionally.

0
1

You can use that port as long as nothing else is running on it. Also you need higher privileges when starting the process to be able to claim that port.

4
  • :@Lucas Kauffman :Thanks,for the information.this means it is not Reliable to use nmap port scan result to find out the printer ,I can't say it is a printer as the port may used by other process.
    – pradiptart
    Aug 6, 2012 at 8:59
  • 1
    You will have to discover what protocol is being used on that port, nmap has the -sV parameter switch to do this automatically. Aug 6, 2012 at 9:06
  • nmap often talks enough of the protocol to determine that it is actually a printer on that port. It can pick between different pieces of software on the same port such as nginx, IIS and Apache, all on port 80 (on different machines) and it will let you know which one is which.
    – Ladadadada
    Aug 6, 2012 at 9:15
  • Thanks @Ladadadada ,Actually 515 is the port for the LPD and it is one the print server have not printer I regret for wrong info.Use this: technet.microsoft.com/library/cc783789%28WS.10%29.aspx ,I use nmap to the print server's Ip now and now also I am getting the same port used as printer,So I got confused by this,it clears that a server having LPD running to receive the request of printer from the client is having 515 port running .Now I am using 9100 port for this ,is this a good idea now as 515 is not the port used by a remote printer.
    – pradiptart
    Aug 6, 2012 at 9:37
0

I'm not entirely clear what you're asking:

Are you asking if "reserved" ports can only be used by the associated app, so that if you see port 25 in use, for example, then whatever's running on it must be a SMTP server because that's the SMTP port? If so, then the answer is "No". It's essentially 'first come first served' to bind to a port.

OR

Are you asking if you can take a port that's normally used by one process and use it for another process? If so, the answer's "yes" - see the first part of my answer. You just need to stop the other process grabbing the port, then you can bind to it yourself.

1
  • Thanks for you reply ,My doubt is about accessing the well known ports ,The question came to me because as earlier I have asked I am using nmap to descover all nodes and getting the printer connected to it so,some time the nmap no giving device type as printer so,how to know the printer device ,Then I thought of using the port used by the printer,thus asked whether the ports are fixed for a perticular process or can be used by any other ..
    – pradiptart
    Aug 6, 2012 at 11:29

You must log in to answer this question.

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