I'm trying to write a script that will use netstat to check ephemeral ports on a windows machine. When I test this script in the IDLE on Windows, it returns with a 0.
Here is my code that I'm testing:
import os
oPorts=os.system('netstat -ano | find /i \"estab\" /c')
print(oPorts)
Here is what happens when I try to run that in Python:
]1
Here's the output however when I run the same thing in command prompt.
So why is Python outputting a 0 when there are clearly about 311 established connections on the Windows host? What am I missing?