[python-win32] Get listening ports

Marcus Low marcus at internetnowasp.net
Sat Jun 28 17:51:11 CEST 2008


Hi,

Yup ip helpers the way, but alternatively if u want a simple routine, u 
can launch the netstat -a -b after u createprocess with the appropriate 
flags and pipe the information
to ur buffer, then just parse the buffer and get the information, all 
these can be done without seeing an ugly cmd console popping out. I have 
the whole code in win32 C++ though, maybe there is an equivalent python 
code around.

Marcus.

Tim Golden wrote:
> le dahut wrote:
>> Hello,
>>
>> I'm looking for an API that can do netstat calls to return a list of 
>> listenign ports and maybe a process attached to it.
>
> You need the IP Helpers API
>
> http://msdn.microsoft.com/en-us/library/ms886687.aspx
>
> I'm afraid I've never used it, though, so you'll have
> to scout around for examples.
>
> TJG
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>




More information about the python-win32 mailing list