Get All Open Connections via Commandline

Description

This script retrieves all open connections using netstat.

Overview

This script runs netstat with the -ano options to list all currently open connections.

Dependencies

  • None

Operating Systems

  • Windows

Example Output

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       996
  TCP    0.0.0.0:443            0.0.0.0:0              LISTENING       9008
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:1337           0.0.0.0:0              LISTENING       9008
  TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING       1108
  TCP    0.0.0.0:5040           0.0.0.0:0              LISTENING       5596
  TCP    0.0.0.0:7680           0.0.0.0:0              LISTENING       12440
  TCP    0.0.0.0:17500          0.0.0.0:0              LISTENING       11348
  TCP    0.0.0.0:49664          0.0.0.0:0              LISTENING       756
  TCP    0.0.0.0:49665          0.0.0.0:0              LISTENING       588
  TCP    0.0.0.0:49666          0.0.0.0:0              LISTENING       1328
  TCP    0.0.0.0:49667          0.0.0.0:0              LISTENING       1292
  TCP    0.0.0.0:49668          0.0.0.0:0              LISTENING       2372
  TCP    0.0.0.0:49669          0.0.0.0:0              LISTENING       2964
  TCP    0.0.0.0:49670          0.0.0.0:0              LISTENING       712
  TCP    127.0.0.1:843          0.0.0.0:0              LISTENING       11348
  TCP    127.0.0.1:1337         127.0.0.1:51351        ESTABLISHED     9008
  TCP    127.0.0.1:1337         127.0.0.1:64949        ESTABLISHED     9008
  TCP    127.0.0.1:17600        0.0.0.0:0              LISTENING       11348
  TCP    127.0.0.1:51351        127.0.0.1:1337         ESTABLISHED     11592
  TCP    127.0.0.1:52818        0.0.0.0:0              LISTENING       8220
  TCP    127.0.0.1:52818        127.0.0.1:52819        ESTABLISHED     8220
  TCP    127.0.0.1:52819        127.0.0.1:52818        ESTABLISHED     9000
  TCP    127.0.0.1:54123        127.0.0.1:54124        ESTABLISHED     1028
  TCP    127.0.0.1:54124        127.0.0.1:54123        ESTABLISHED     1028
  TCP    127.0.0.1:54125        127.0.0.1:54126        ESTABLISHED     14488
  TCP    127.0.0.1:54126        127.0.0.1:54125        ESTABLISHED     14488
  TCP    127.0.0.1:58014        127.0.0.1:58015        ESTABLISHED     11348
  TCP    127.0.0.1:58015        127.0.0.1:58014        ESTABLISHED     11348
  TCP    127.0.0.1:58016        127.0.0.1:58017        ESTABLISHED     11348
  TCP    127.0.0.1:58017        127.0.0.1:58016        ESTABLISHED     11348
  TCP    127.0.0.1:60460        127.0.0.1:1337         TIME_WAIT       0
  TCP    127.0.0.1:64821        0.0.0.0:0              LISTENING       11652
  TCP    127.0.0.1:64821        127.0.0.1:64836        ESTABLISHED     11652
Scroll to Top