{"id":42,"date":"2009-01-22T04:48:00","date_gmt":"2009-01-22T04:48:00","guid":{"rendered":"https:\/\/freezion.com\/2009\/01\/22\/arp-ping-using-scapy\/"},"modified":"2009-01-22T04:48:00","modified_gmt":"2009-01-22T04:48:00","slug":"arp-ping-using-scapy","status":"publish","type":"post","link":"https:\/\/freezion.com\/?p=42","title":{"rendered":"ARP Ping Using Scapy"},"content":{"rendered":"<p>here&#8217;s a quick script i whipped up a while ago.<br \/>\nit uses scapy to perform an ARP ping of a network, and provides a CSV report of any MAC addresses it finds, along with the associated IP&#8217;s.<\/p>\n<p>It requires tcpdump to be installed and in the $PATH, as well as root privs to run.<\/p>\n<pre>#!\/usr\/bin\/env python\n# note that this script requires tcpdump to be installed\n# additionally, it requires root privs to run.\n# ----\n# Portions of this code can be attributed to the book\n# Python for Unix and Linux System Administration\n# by Noah Gift and Jeremy M. Jones.\n# Copyright 2008 Noah Gift and Jeremy M. Jones\n# ISBN-13: 978-0-596-51582-9\n# ----\n\nimport sys\nif len(sys.argv) != 2:\n    print \"Usage: pingarp n  eg: pingarp 192.168.1.0\/24\"\n    sys.exit(1)\n\nfrom scapy import srp,Ether,ARP,conf\nconf.verb=0\nans,unans=srp(Ether(dst=\"ff:ff:ff:ff:ff:ff\")\/ARP(pdst=sys.argv[1]),\n              timeout=2)\n\nprint r\"MAC,IP\"\nfor snd,rcv in ans:\n    print rcv.sprintf(r\"%Ether.src%,%ARP.psrc%\")<\/pre>\n<p>here&#8217;s sample output:<\/p>\n<pre>$ sudo .\/pingarp 192.168.11.0\/24\nMAC,IP\n00:16:01:8b:54:4a,192.168.11.1\n00:13:ce:e9:6e:95,192.168.11.3\n00:40:ca:8a:72:48,192.168.11.6<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>here&#8217;s a quick script i whipped up a while ago. it uses scapy to perform an ARP ping of&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,5],"tags":[42,43,51,56],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-hacking","category-tech","tag-net","tag-pentest","tag-scapy","tag-tools"],"_links":{"self":[{"href":"https:\/\/freezion.com\/index.php?rest_route=\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freezion.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freezion.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freezion.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freezion.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=42"}],"version-history":[{"count":0,"href":"https:\/\/freezion.com\/index.php?rest_route=\/wp\/v2\/posts\/42\/revisions"}],"wp:attachment":[{"href":"https:\/\/freezion.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freezion.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freezion.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}