J'essaie d'utiliser GetExtendedTcpTable via un programme Python. Fondamentalement, j'essaie de convertir "ActiveState Code Recipe 392572: Utilisation de l'API Win32 IPHelper" à "Getting the active TCP/UDP connections using the GetExtendedTcpTable function".Utilisation de GetExtendedTcpTable en Python
Mon problème est que je n'arrive pas à obtenir le script Python pour reconnaître TCP_TABLE_CLASS.TCP_TABL \ E_OWNER_PID_ALL.
J'ai essayé
ctypes.windll.iphlpapi.GetExtendedTcpTable(NULL, ctypes.byref(dwSize), bOrder, AF_INET, TCP_TABLE_CLASS.TCP_TABLE_OWNER_PID_ALL, 0)
mais Bails toujours avec "AttributeError: fonction 'TCP_TABLE_CLASS' not found"
J'ai aussi essayé
ctypes.windll.iphlpapi.GetExtendedTcpTable(NULL, ctypes.byref(dwSize), bOrder, AF_INET, ctypes.windll.iphlpapi.TCP_TABLE_CLASS.TCP_TABLE_OWNER_PID_ALL, 0)
qui reçoit les mêmes résultats.
Toutes les recommandations sont appréciées.
Cutaway