[python-win32] Resolve IP to windows computer name

Andreas Maurer amapy@snafu.de
Tue, 05 Nov 2002 17:37:17 +0100

Troy Sorzano wrote:
> Hi all,
> I am trying to write a little script in python to read my firewall 
> logs.  The source is logged as an IP address.  But I would like that IP 
> converted into the windows computer name.  I found the windows utility 
> NBTSTAT -A <ip>  but it requires the computer I am looking up to be 
> turned on.  I tried NBTSTAT -c  to list the cached name lookups but 
> they expire.
> Does anyone have a better suggestion then NBTSTAT?
> Thanks,
> Troy Sorzano

Hi Troy,

try ping -a <IP-Address>


import socket