[python-win32] Resolve IP to windows computer name
Jens B. Jorgensen
jens.jorgensen@tallan.com
Mon, 04 Nov 2002 12:30:14 -0600
I'm fairly familiar with the protocols for NetBIOS over TCP/IP (aka
NetBT), having written my own code that implements some of their
features (including "reverse lookup" such as you're doing). I think
you'll find though that if a computer is no longer turned on then
getting its name will not be very doable unless you run some kind of
daemon all the time to listen for name registrations. The problem is
that naming in "windows network" is dynamic by design. When a computer
comes up it uses broadcast (depending on what kind of node it is
operating as, could also go to WINS server or both) to register names on
the network. When the computer goes down it is supposed to unregister
its names. Since the design is dynamic in nature it is doubtful you
could reliably get a mapping and also unlikely there's any existing
services will cache the name registrations persistently since this would
violate the design and very likely cause problems, for example someone
logging in to one machine, then shutting that down and going to another
machine and logging in.
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
>
>
>
>
>_______________________________________________
>Python-win32 mailing list
>Python-win32@python.org
>http://mail.python.org/mailman/listinfo/python-win32
>
>
--
Jens B. Jorgensen
jens.jorgensen@tallan.com
"With a focused commitment to our clients and our people, we deliver value through customized technology solutions"