#netstate-anov_deadloop.py
# works for windows XP SP-2, python2.5
from subprocess import call
import time
import sys
default_netstat_arglist = "-anov"
def build_arglist_as_is():
one_space = " "
arglist_as_is = one_space.join(sys.argv[1:])
return arglist_as_is
arglist_passed = build_arglist_as_is()
arglist_passed_len = len(arglist_passed)
arglist = default_netstat_arglist
if arglist_passed_len > 0:
arglist = arglist_passed
# call the nestat command and clear the screen before refresh it.
while True:
call(["netstat", arglist], shell=True)
time.sleep(4)
# There would be errors if arg shell=True is omitted.
call(["cls"], shell=True)