def _ipconfig_getnode():
 import os, re
 dirs = ['', 'c:\\windows\\system32', 'c:\\winnt\\system32']
 try:
  import ctypes
  buffer = ctypes.create_string_buffer(300)
  ctypes.windll.kernel32.GetSystemDirectoryA(buffer, 300)
  dirs.insert(0, buffer.value.decode('mbcs'))
 except:
  pass
 for dir in dirs:
  try:
   pipe = os.popen((os.path.join(dir, 'ipconfig') + ' /all'))
  except IOError:
   continue
  for line in pipe:
   value = line.split(':')[(-1)].strip().lower()
   if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value):
    return int(value.replace('-', ''), 16)

def _ipconfig_getnode ( ) : import os , re dirs = [ '' , 'c:\\windows\\system32' , 'c:\\winnt\\system32' ] try : import ctypes buffer = ctypes . create_string_buffer ( 300 ) ctypes . windll . kernel32 . GetSystemDirectoryA ( buffer , 300 ) dirs . insert ( 0 , buffer . value . decode ( 'mbcs' ) ) except : pass for dir in dirs : try : pipe = os . popen ( ( os . path . join ( dir , 'ipconfig' ) + ' /all' ) ) except IOError : continue for line in pipe : value = line . split ( ':' ) [ ( - 1 ) ] . strip ( ) . lower ( ) if re . match ( '([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]' , value ) : return int ( value . replace ( '-' , '' ) , 16 )
get the hardware address on windows by running ipconfig .