title: Make ARP request on python
body: <p>I'm trying to make ARP request on python. My code:</p>
  
  <pre><code>import socket
  from struct import pack
  from uuid import getnode as get_mac
  
  def main():
      dest_ip = [10, 7, 31, 99]
      local_mac = [int(("%x" % get_mac())[i:i+2], 16) for i in range(0, 12, 2)]
      local_ip = [int(x) for x in socket.gethostbyname(socket.gethostname()).split('.')]
  
      sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.SOCK_RAW)
      sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
      sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
      sock.bind(('', 0))
  
      ARP_FRAME = [
          pack('!H', 0x0001), # HRD
          pack('!H', 0x0800), # PRO
          pack('!B', 0x06), # HLN
          pack('!B', 0x04), # PLN 
          pack('!H', 0x0001), # OP
          pack('!6B', *local_mac), # SHA
          pack('!4B', *local_ip), # SPA
          pack('!6B', *(0x00,)*6), # THA
          pack('!4B', *dest_ip), # TPA
      ]
      print(ARP_FRAME)
      sock.sendto(b''.join(ARP_FRAME), ('255.255.255.255', 0))
      sock.close()
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>When I execute this code, Wireshark does not catch any packets.
  I think problem in socket. When I do <code>socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.SOCK_RAW)</code> I get <code>AttributeError: module 'socket' has no attribute 'AF_PACKET'</code>. What am I doing wrong and how fix it? </p>
  
  <p>OS X 10.11.3</p>