uniquely identifying a machine...

Marcus Stojek stojek at part-gmbh.de
Mon Mar 10 20:53:50 CET 2003


Hi,
I found this somewhere in the net. Don't remember the author,
but it is someone well known in this group.

With this you can check the unique hardware ID of the Ethernet-card
installed.


from netbios import *

ncb = NCB()
ncb.Command = NCBENUM
la_enum = LANA_ENUM()
ncb.Buffer = la_enum
rc = Netbios(ncb)
adresslist=[]
if rc != 0: raise RuntimeError, "Unexpected result %d" %(rc,)
for i in range(la_enum.length):
    ncb.Reset()
    ncb.Command = NCBRESET
    ncb.Lana_num = ord(la_enum.lana[i])
    rc = Netbios(ncb)
    if rc != 0: raise RuntimeError, "Unexpected result %d" %(rc,)
    ncb.Reset()
    ncb.Command = NCBASTAT
    ncb.Lana_num = ord(la_enum.lana[i])
    ncb.Callname = "*               "
    adapter = ADAPTER_STATUS()
    ncb.Buffer = adapter
    Netbios(ncb)
    adress=''
    for ch in adapter.adapter_address:
        adress+=( "%02x" % (ord(ch),))
    adresslist.append(adress.upper())
print adresslist


Chris Spencer <clspence at one.net> schrieb:

>This might not be a direct Python question, but I thought I'd pose it anyways.
>
>I have a need, for licensing purposes, to be able to uniquely identify a
>machine.  For various policy reasons, we can not rely on the TCP/IP stack being
>active.  So uniquely identifying a machine by IP address, machine name, or NIC
>address is not possible.
>
>Cross-platform is a plus, but definately not necessary.
>
>Anyone out there have any ideas?
>
>Chris.





More information about the Python-list mailing list