I am trying to use GetExtendedTcpTable via a Python program. Basically I am trying to convert "ActiveState Code Recipe 392572: Using the Win32 IPHelper API" to "Getting the active TCP/UDP connections using the GetExtendedTcpTable function".
My problem is that I cannot seem to get the Python script to recognize TCP_TABLE_CLASS.TCP_TABL\E_OWNER_PID_ALL.
I have tried
ctypes.windll.iphlpapi.GetExtendedTcpTable(NULL, ctypes.byref(dwSize), bOrder, AF_INET, TCP_TABLE_CLASS.TCP_TABLE_OWNER_PID_ALL, 0)
but this always bails with "AttributeError: function 'TCP_TABLE_CLASS' not found"
I have also tried
ctypes.windll.iphlpapi.GetExtendedTcpTable(NULL, ctypes.byref(dwSize), bOrder, AF_INET, ctypes.windll.iphlpapi.TCP_TABLE_CLASS.TCP_TABLE_OWNER_PID_ALL, 0)
which receives the same results.
Any recommendations are appreciated.
Cutaway