List Active connection details

You can see all incoming and outgoing connection details using below script,

import subprocess;
process=subprocess.Popen(['netstat','-ano'],stdout=subprocess.PIPE,shell=True);
for line in iter(process.stdout.readline,''):
    print line.rstrip()

Note: please refer attach text file for script text without indentation error.

Sample output would be,

active_connection_list.txt (173 Bytes)