Reputation: 1291
I want list out all open ports of the particular system. I found one solution but it is working very slowly. I am using .net framework 3.5.
Upvotes: 0
Views: 1347
Reputation: 1374
Assuming windows: The only way to get a list of open ports (or listening / not listening / filtering etc) is to port scan all ports (all 65,535 of them unless only interested in specific ports). This is an obvious security consideration - and why there are so many port scanners out there rather than someone knocking up a small C# utility to get a list. Therefore, it will be slow.
If it is from your network (and you therefore have access to it) - you could build a secure (ish) internal service that allows other machines on the same subnet to request a list of ports. This would require each machine to run the service, some security consideration to be built in, and a way of requesting (most likely a small windows app/cmd line routine that send a UDP or TCP request which the service listens for and (after validation etc) returns the list probably using encyrption or secure sockets). There are probably off the shelf (maybe even free bee - though think security there) product or tool available for accessible (local) networks. Or (Microsoft's PortQry tool perhaps )
If, however, your are trying to write a hacking tool - just download NMap instead.
Upvotes: 3