{"id":163,"date":"2014-12-17T18:09:37","date_gmt":"2014-12-17T17:09:37","guid":{"rendered":"http:\/\/rubinstein.me\/?p=163"},"modified":"2014-12-18T15:19:58","modified_gmt":"2014-12-18T15:19:58","slug":"install-and-run-scapy-on-mac-os-x-10-10-yosemite","status":"publish","type":"post","link":"http:\/\/iict-space.heig-vd.ch\/ars\/2014\/12\/17\/install-and-run-scapy-on-mac-os-x-10-10-yosemite\/","title":{"rendered":"Install and Run Scapy on Mac OS X 10.10 (Yosemite)"},"content":{"rendered":"<h1>Scapy on Yosemite<\/h1>\n<p>There seems to be quite a few people trying to get <a href=\"http:\/\/www.secdev.org\/projects\/scapy\/\">Scapy<\/a> installed and running on Yosemite.<\/p>\n<p>Scapy is\u00a0getting kind of old and as a result, as of the writing of this article, there doesn&#8217;t seem to be a user-friendly way to get it working on the latest reincarnation of OS X.<\/p>\n<p>While Googling for a solution, I stumbled upon <a href=\"http:\/\/juhalaaksonen.com\/blog\/2013\/12\/11\/installing-scapy-for-mac-os-x\/\">a post from\u00a0juhnu<\/a> describing a procedure to get Scapy installed on an older version of Mac OS and I decided to give it a go, just for fun.<\/p>\n<p>By the end of the exercise, I had a broken install that I managed to get up and running with slight modifications of juhnu&#8217;s procedure.<\/p>\n<h1>Dependencies<\/h1>\n<p>Let&#8217;s start by getting the dependencies out of the way, before we jump into Scapy&#8217;s own installation. As you may know, you will need at least Mac OS X\u00a0<strong>Command Line Tools<\/strong>\u00a0and most probably <strong>Xcode<\/strong>, in order to build the necessary packages.<\/p>\n<h2 class=\"\"><em>Building libdnet<\/em><\/h2>\n<p>As of the writing of this post, the latest version of <a href=\"https:\/\/code.google.com\/p\/libdnet\/downloads\/list\">libdnet<\/a> is 1.12. So let&#8217;s go ahead and download, build and install it:<\/p>\n<pre class=\"lang:default mark:7 decode:true\" title=\"Installation of libdnet\">$ wget http:\/\/libdnet.googlecode.com\/files\/libdnet-1.12.tgz\r\n$ tar xvf libdnet-1.12.tgz\r\n$ .\/configure\r\n$ make\r\n$ sudo make install\r\n$ cd python\r\n$ sudo python2.6 setup.py install<\/pre>\n<p>I have highlighted for you line 7, which contains a key element in this game. You must explicitly use python2.6 here (and everywhere else in this tutorial). Yosemite defaults to python 2.7 and your dear friend Scapy won&#8217;t like it!<\/p>\n<h2><em>Installing pylibpcap<\/em><\/h2>\n<p>Let&#8217;s install <a href=\"http:\/\/sourceforge.net\/projects\/pylibpcap\/\">pylibpcap<\/a>, a python module for the legendary libpcap packet capture library. As of the writing of this article, the latest version is 0.6.4.<\/p>\n<pre class=\"lang:default mark:4 decode:true\" title=\"Installing pylibpcap\">$ wget http:\/\/dfn.dl.sourceforge.net\/sourceforge\/pylibpcap\/pylibpcap-0.6.4.tar.gz\r\n$ tar xvf pylibpcap-0.6.4.tar.gz\r\n$ cd pylibpcap-0.6.4\r\n$ sudo python2.6 setup.py install<\/pre>\n<p>Here again, make sure to use python2.6 on line 4 when installing pylibpcap.<\/p>\n<h2><em>Installing Scapy<\/em><\/h2>\n<p class=\"\">Up to here, you should already be able to install and run Scapy on your Yosemite machine. There are some other optional libraries that will give you additional functionality and we will take care of those after installing Scapy. As of the writing of this article, <em>wget scapy.net<\/em> will get you version 2.2 of Scapy. If you find yourself with a different version, you will want to adjust line 3 of the following block accordingly:<\/p>\n<pre class=\"lang:default mark:4 decode:true\" title=\"Installing Scapy\">$ wget scapy.net\r\n$ unzip scapy-latest.zip\r\n$ cd scapy-2.2\r\n$ sudo python2.6 setup.py install<\/pre>\n<p>Once again, I cannot stress how important it is to run python2.6 and not simply python, as highlighted\u00a0in line 4.<\/p>\n<p>In its current state, you should be able to run Scapy just fine, although it will complain with some warnings. Just make sure to use <em>sudo<\/em> if you&#8217;re planning to inject packets.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo scapy<\/pre>\n<h1>Installing Additional Libraries<\/h1>\n<p>You can get rid of most of the warnings by installing 3 additional libraries that will give you the possibility to decrypt WEP trafic, make impressive\u00a0graphical PostScript\/PDF dumps of a packet or a list of packets or even plot\u00a0IP ID patterns.<\/p>\n<h2><em>Installing\u00a0pycrypto<\/em><\/h2>\n<p>Get yourself the <a href=\"https:\/\/www.dlitz.net\/software\/pycrypto\/\">latest version of pycrypto<\/a> (2.6.1 as of the writing of this article) and proceed to install:<\/p>\n<pre class=\"lang:default decode:true \">$ wget http:\/\/ftp.dlitz.net\/pub\/dlitz\/crypto\/pycrypto\/pycrypto-2.6.1.tar.gz\r\n$ tar xfz pycrypto-2.6.1.tar.gz\r\n$ cd pycrypto-2.6.1\r\n$ sudo python2.6 setup.py install<\/pre>\n<p>Again, notice the use of python2.6 (sorry for being so insistent&#8230;).<\/p>\n<h2><em>Installing gnuplot-py<\/em><\/h2>\n<p>The latest available version of gnuplot-py at the moment of the writing of this article is 1.8. Get it <a href=\"http:\/\/sourceforge.net\/projects\/gnuplot-py\/files\/\">from the website<\/a> and proceed to install (if you use Safari to download, it will decompress the archive and you will end up with just a tarball):<\/p>\n<pre class=\"lang:default decode:true\">$ tar xfz gnuplot-py-1.8.tar.gz\r\n$ cd gnuplot-py-1.8\r\n$ sudo python2.6 setup.py install<\/pre>\n<h2>\u00a0<em>Installing PyX<\/em><\/h2>\n<p>For this library, we&#8217;ll make an exception and we will not install the latest version. As of the writing of this article, the latest version of PyX is 0.13. However, <strong>this version is only compatible with Python 3<\/strong> and therefore, <strong>it will not work with our Scapy install<\/strong>. So <strong>you will want to get version 0.12.1<\/strong> which is the latest version available to be compatible with Python 2.6. Go ahead and download the file <a href=\"http:\/\/sourceforge.net\/projects\/pyx\/files\/\">from the website<\/a>\u00a0and comeback here to finish the install:<\/p>\n<pre class=\"lang:default decode:true\">$ tar xfz PyX-0.12.1.tar.gz\r\n$ cd PyX-0.12.1\r\n$ sudo python2.6 setup.py install<\/pre>\n<p>Did you notice the python2.6 for the last two libraries? Just checking \ud83d\ude09<\/p>\n<p>There you go. Your Scapy should be ready to go. When you run Scapy (with sudo&#8230; don&#8217;t forget), you might\u00a0be greeted with these 3 warning:<\/p>\n<pre class=\"lang:default decode:true\">WARNING: No route found for IPv6 destination :: (no default route?)\r\nthe sha module is deprecated; use the hashlib module instead\r\nThe popen2 module is deprecated.  Use the subprocess module.<\/pre>\n<p>You may safely ignore these warnings. Happy Scaping!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scapy on Yosemite There seems to be quite a few people trying to get Scapy installed and running on Yosemite. Scapy is\u00a0getting kind of old and as a result, as of the writing of this article, there doesn&#8217;t seem to <a class=\"more-link\" href=\"http:\/\/iict-space.heig-vd.ch\/ars\/2014\/12\/17\/install-and-run-scapy-on-mac-os-x-10-10-yosemite\/\">Continue reading <span class=\"screen-reader-text\">  Install and Run Scapy on Mac OS X 10.10 (Yosemite)<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,15,3],"tags":[17,16,18],"_links":{"self":[{"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/posts\/163"}],"collection":[{"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/comments?post=163"}],"version-history":[{"count":1,"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/posts\/163\/revisions"}],"predecessor-version":[{"id":164,"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/posts\/163\/revisions\/164"}],"wp:attachment":[{"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/media?parent=163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/categories?post=163"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/iict-space.heig-vd.ch\/ars\/wp-json\/wp\/v2\/tags?post=163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}