1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Resolved How can I find open ports on a remote computer

Discussion in 'Networking (Hardware & Software)' started by zhshqzyc, 2013/11/25.

  1. 2013/11/25
    zhshqzyc

    zhshqzyc Inactive Thread Starter

    Joined:
    2008/12/15
    Messages:
    140
    Likes Received:
    0
    I have a port for the production of an application.
    Code:
    string sIpaddress = @ "gtcp://" + ips[0].ToString() +  ":54331 ";
    The port is 54331.

    Now I want to debug with a different port, but I don't know what can I use.
    I want to list all open ports for the remote machine.
     
  2. 2013/11/25
    PeteC

    PeteC SuperGeek Staff

    Joined:
    2002/05/10
    Messages:
    28,896
    Likes Received:
    389
    Moved to Networking
     

  3. to hide this advert.

  4. 2013/11/25
    retiredlearner

    retiredlearner SuperGeek WindowsBBS Team Member

    Joined:
    2004/06/25
    Messages:
    7,209
    Likes Received:
    514
  5. 2013/11/25
    zhshqzyc

    zhshqzyc Inactive Thread Starter

    Joined:
    2008/12/15
    Messages:
    140
    Likes Received:
    0
    It seems that there is no such command "portqry" in windows 7.
     
  6. 2013/11/26
    retiredlearner

    retiredlearner SuperGeek WindowsBBS Team Member

    Joined:
    2004/06/25
    Messages:
    7,209
    Likes Received:
    514
  7. 2013/11/26
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    The article Neil linked to says at the top:

     
    Arie,
    #6
  8. 2013/11/27
    zhshqzyc

    zhshqzyc Inactive Thread Starter

    Joined:
    2008/12/15
    Messages:
    140
    Likes Received:
    0
    Code:
    c:\PortQryV2>PortQry.exe -n 11.50.96.228 -r 80:65535
    
    Querying target system called:
    
     11.50.96.228
    
    Attempting to resolve IP address to a name...
    
    
    IP address resolved to cfemsg01.corporate.my.com
    
    querying...
    
    TCP port 80 (http service): LISTENING
    
    Error opening socket: 10051
    
    
    Network unreachable.
    
    c:\PortQryV2>
    Why?
     
  9. 2013/11/27
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338
  10. 2013/11/27
    zhshqzyc

    zhshqzyc Inactive Thread Starter

    Joined:
    2008/12/15
    Messages:
    140
    Likes Received:
    0
    No, it is an internal ip address. I faked it just as an example.
     
  11. 2013/11/27
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338
  12. 2013/11/27
    zhshqzyc

    zhshqzyc Inactive Thread Starter

    Joined:
    2008/12/15
    Messages:
    140
    Likes Received:
    0
    Well even I limit a small range say
    Code:
    c:\PortQryV2>PortQry.exe -n 11.50.96.228 -r 80:81
    It is still wrong.
    If I remove -r part.
    Code:
    c:\PortQryV2>PortQry.exe -n 11.50.96.228
    Then
    Code:
    querying...
    
    TCP port 80 (http service): LISTENING
     
  13. 2013/11/27
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338
    The easiest way to test and see whether a port is open on a remote computer can be accomplished by accessing the computer with the remote desktop wizard and then looking at its firewall settings with the netstat command.
    1. Click Start, type "Remote Desktop Connection" (sans the quotes) into the Search box and press [Enter]

    2. Input the IP address of the remote computer and press "Connect ".

    3. If prompted, enter a username and password.

    4. On the remote computer, click "Start," type "cmd" in the "Search" box and press [Enter].

    5. Type the command:

      netstat -an |find /i "listening "​

      press [Enter] and you should see a list of open ports on the remote computer.
     
  14. 2013/11/27
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Socket error 10051 ALWAYS means: computer is unreachable. This can be caused by: misconfigured router, router down, hardware firewall rules or software firewall rules.

    Since you know the router is working fine, the error is the result of a firewall rule.

    That error will get spit out as soon as you query a port that is not in use, especially when scanning a range such as:
    PortQry.exe -n 11.50.96.228 -r 80:65535

    The error will get returned if port 81 is not in use or if a firewall rule is blocking connections to port 81 (or a service or program that uses port 81).

    If you just do:
    PortQry.exe -n 11.50.96.228
    it will return:
    querying...
    TCP port 80 (http service): LISTENING
    because PortQry queries port 80 by default.

    To really determine the status (open, closed, filtered) of ports on a remote system use nmap. They do have a Windows version. Most all firewalls cannot thwart the specialized queries that nmap can do. Example, 2 different port scans of google return 2 different sets of results:

    Code:
    tonyt@d830:~$ [B]sudo nmap -v google.com[/B]
    
    Starting Nmap 5.00 ( [url]http://nmap.org[/url] ) at 2013-11-27 18:30 EST
    NSE: Loaded 0 scripts for scanning.
    Warning: Hostname google.com resolves to 11 IPs. Using 74.125.228.103.
    Initiating Ping Scan at 18:30
    Scanning 74.125.228.103 [4 ports]
    Completed Ping Scan at 18:30, 0.07s elapsed (1 total hosts)
    Initiating Parallel DNS resolution of 1 host. at 18:30
    Completed Parallel DNS resolution of 1 host. at 18:30, 0.04s elapsed
    Initiating SYN Stealth Scan at 18:30
    Scanning iad23s08-in-f7.1e100.net (74.125.228.103) [1000 ports]
    Discovered open port 443/tcp on 74.125.228.103
    Discovered open port 80/tcp on 74.125.228.103
    Completed SYN Stealth Scan at 18:30, 16.11s elapsed (1000 total ports)
    Host iad23s08-in-f7.1e100.net (74.125.228.103) is up (0.10s latency).
    Interesting ports on iad23s08-in-f7.1e100.net (74.125.228.103):
    Not shown: 998 filtered ports
    PORT    STATE SERVICE
    80/tcp  open  http
    443/tcp open  https
    
    Read data files from: /usr/share/nmap
    Nmap done: 1 IP address (1 host up) scanned in 16.39 seconds
               Raw packets sent: 2012 (88.504KB) | Rcvd: 13 (556B)
    
    
    
    tonyt@d830:~$ [B]sudo nmap -v PN google.com[/B]
    
    Starting Nmap 5.00 ( [url]http://nmap.org[/url] ) at 2013-11-27 18:30 EST
    NSE: Loaded 0 scripts for scanning.
    Warning: Hostname google.com resolves to 11 IPs. Using 74.125.228.103.
    Initiating Ping Scan at 18:30
    Scanning 2 hosts [4 ports/host]
    Completed Ping Scan at 18:30, 0.14s elapsed (2 total hosts)
    Initiating Parallel DNS resolution of 2 hosts. at 18:30
    Completed Parallel DNS resolution of 2 hosts. at 18:30, 0.04s elapsed
    Initiating SYN Stealth Scan at 18:30
    Scanning 2 hosts [1000 ports/host]
    Discovered open port 22/tcp on 80.68.93.100
    Discovered open port 53/tcp on 80.68.93.100
    Discovered open port 587/tcp on 80.68.93.100
    Discovered open port 110/tcp on 80.68.93.100
    Discovered open port 21/tcp on 80.68.93.100
    Discovered open port 995/tcp on 80.68.93.100
    Discovered open port 80/tcp on 80.68.93.100
    Discovered open port 443/tcp on 74.125.228.103
    Discovered open port 80/tcp on 74.125.228.103
    Increasing send delay for 80.68.93.100 from 0 to 5 due to 29 out of 96 dropped probes since last increase.
    Completed SYN Stealth Scan against 74.125.228.103 in 38.26s (1 host left)
    Completed SYN Stealth Scan at 18:31, 39.87s elapsed (2000 total ports)
    Host tedside.pitcairn.net.pn (80.68.93.100) is up (0.11s latency).
    Interesting ports on tedside.pitcairn.net.pn (80.68.93.100):
    Not shown: 989 closed ports
    PORT    STATE    SERVICE
    21/tcp  open     ftp
    22/tcp  open     ssh
    25/tcp  filtered smtp
    53/tcp  open     domain
    80/tcp  open     http
    110/tcp open     pop3
    135/tcp filtered msrpc
    139/tcp filtered netbios-ssn
    445/tcp filtered microsoft-ds
    587/tcp open     submission
    995/tcp open     pop3s
    
    Host iad23s08-in-f7.1e100.net (74.125.228.103) is up (0.055s latency).
    Interesting ports on iad23s08-in-f7.1e100.net (74.125.228.103):
    Not shown: 998 filtered ports
    PORT    STATE SERVICE
    80/tcp  open  http
    443/tcp open  https
    
    Read data files from: /usr/share/nmap
    Nmap done: 2 IP addresses (2 hosts up) scanned in 40.27 seconds
               Raw packets sent: 3190 (140.312KB) | Rcvd: 1057 (42.352KB)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.