Link to home
Start Free TrialLog in
Avatar of SAM2009
SAM2009Flag for Canada

asked on

Check which ports are opened in a Windows server.

Hi,

If I'm in a Window 2008 or 2012 servers and I want to proof that some ports like Tcp 80, 443, 339 for example are opened not blocked by firewall how I can do that? Some time port are opened but there is just nothing listening, I mean there is no application installed which can respond.

Is there cmd or tool that just show what are opened?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Dr. Klahn
Dr. Klahn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, the tool is telnet.

You can install it from the additional features from windows.
https://www.technipages.com/windows-10-enable-telnet

Then, use it like this

Telnet Computer Port

Open in new window


REM So to test 80
Telnet webserver 80

REM Test 443
Telnet webserver 443

Open in new window

Jose, the server side is asked for. Probing a port can be done with telnet as soon as the port has a running process assigned to it, that much is true, but not the answer to this question.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@dfke:
Sorry, but that is nonsense. nmap cannot scan for ports no-one is listening on. It can test whether a firewall actively rejects connects on ports, but silent discards are just resulting in timeouts as if there is no listening process.

And etc\services just lists names for ports, it does not open anything. The file is used for displaying purposes only.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sudeep brings up a good point.

If you have access to the machine in question, running this command will be much faster than running nmap...

netstat -pluten

Open in new window


This will tell you all listeners, from a localhost view.

All the above points still hold though, an open port can only be determined by scanning all ports.

If you have access to the machine in question, typical firewall approach is to...

1) Close all ports + protocols.

2) Create a few exemptions to open only those ports + protocols where server provides listeners.
I'm reading the original question the same way Qlemo is I think, essentially asking, "what protocol/port combination would a firewall let traffic through (assuming there was some process to receive it)?"

You could parse firewall rules to find this out, but one complication is the fact that many firewalls (including Windows Firewall) allow traffic based on more criteria than just protocol and port, e.g. destination application/service, source subnet, etc.  So the thinking needs to be expanded there.
Avatar of Dr. Klahn
Dr. Klahn

We need a more specific definition of the problem, and the solution that you desire.  Would you expand on the problem statement, please?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAM2009

ASKER

Yes David was right, my question is more:

"How do I check which ports have no firewall blocks in a Windows server? Is this required a listener?"
The answer is "you cannot check without a listener".
Well... as I said... you can check + you'll have the same test result if there is no listener or if port is blocked by a firewall rule.

As Shaun + Sudeep stated, the only way to show all listeners or all firewall rules is testing on the local machine. In other words, there is no way to do this type of testing externally (offsite).
Avatar of SAM2009

ASKER

Thanks!
You're welcome!