Ever wondered how to check what your firefox is doing in the background, using windows processexplorer and a series of these commands on windows will help you trace the process
1 2 3 4 | C:'WINDOWS>netstat -an |find /i "listening" C:'WINDOWS>netstat -an |find /i "established" C:'WINDOWS>netstat -no C:'WINDOWS>pulist |find /i "1536" |
But a similar but much detailed output can be achieved using the python psutils module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import psutil def process(): plist = psutil.get_process_list() plist = sorted(plist, key=lambda i: i.name) for i in plist: if "firefox.exe" in i.name: #print i.get_memory_info() print "process id ", i.pid rss,vms = i.get_memory_info() print "memory used ", str(round(i.get_memory_percent(),2))+ "%" print "memory used in ram = "+ str(round((float(rss/1024)/1024), 2)) +" MB" print "swap memory usage = "+ str(round((float(vms/1024)/1024), 2)) +" MB" print "cpu utilization "+ str(i.get_cpu_percent()) +"%" user,system = i.get_cpu_times() print "cpu time spent outside the kernel ",user print "cpu time spent inside the kernel ",system #print i.get_connections() print "network connections....." for g in i.get_connections(): print "local address "+ str(g[3]) + "-->" + str(g[4]) + " status "+ str(g[5]) #print i.get_threads() def main(): process() main() |