Last active
August 29, 2015 13:57
-
-
Save photonxp/9802141 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment