text: import socket
  import fcntl
  import struct
  import array
  
  def all_interfaces():
      max_possible = 128  # arbitrary. raise if needed.
      bytes = max_possible * 32
      s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      names = array.array('B', '\0' * bytes)
      outbytes = struct.unpack('iL', fcntl.ioctl(
          s.fileno(),
          0x8912,  # SIOCGIFCONF
          struct.pack('iL', bytes, names.buffer_info()[0])
      ))[0]
      namestr = names.tostring()
      return [namestr[i:i+32].split('\0', 1)[0] for i in range(0, outbytes, 32)]
  
  if (__name__ == '__main__'):
  	print all_interfaces()
  