Installing scapy for Python 2.5

Discussion in 'Mac Programming' started by fishinatree, Aug 23, 2008.

  1. fishinatree macrumors newbie

    Joined:
    Jun 7, 2008
    Location:
    Santa Rosa, CA
    #1
    I'm trying to get access to the tools provided by Scapy for the purpose of Python programming, but I can't get it to install. I followed the directions here: http://www.secdev.org/projects/scapy/portability.html, but the first method (for Mac os X halfway down page) doesn't provide a way of accessing CVS (my login gets denied). The Darwinports installation of scapy doesn't work.
    Code:
    adminbot2425:~ gabefierro$ sudo port install scapy
    --->  Configuring php5
    Error: Target org.macports.configure returned: configure failure: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6" && ./configure --prefix=/opt/local --mandir=/opt/local/share/man --infodir=/opt/local/share/info --with-config-file-path=/opt/local/etc --enable-calendar --with-iconv=/opt/local --enable-exif --enable-ftp --enable-wddx --with-zlib=/opt/local --with-bz2=/opt/local --without-mysql --without-sqlite --without-pdo-sqlite --with-libxml-dir=/opt/local --with-gettext=/opt/local --with-xml --with-expat-dir=/opt/local --with-xmlrpc --enable-soap --enable-filepro --enable-bcmath --enable-trans-sid --enable-mbstring --enable-dbx --enable-dba --enable-zip --with-openssl=/opt/local --with-mhash=/opt/local --with-mcrypt=/opt/local --with-xsl=/opt/local --with-curl=/opt/local --with-pcre-regex=/opt/local --with-gd=/opt/local --with-jpeg-dir=/opt/local --with-png-dir=/opt/local --enable-gd-native-ttf --without-pear --with-freetype-dir=/opt/local --with-apxs=/usr/sbin/apxs --with-ldap=/usr --with-kerberos=/usr --with-iodbc=/usr " returned error 1
    Command output: checking for AIX... no
    checking whether ln -s works... yes
    checking for system library directory... lib
    checking whether to enable runpaths... yes
    checking if compiler supports -R... no
    checking if compiler supports -Wl,-rpath,... yes
    checking for re2c... no
    configure: warning: You will need re2c 0.12.0 or later if you want to regenerate PHP parsers.
    checking for gawk... no
    checking for nawk... no
    checking for awk... awk
    checking if awk is broken... no
    checking for bison... bison -y
    checking for bison version... 2.3 (ok)
    checking for flex... flex
    checking for yywrap in -lfl... yes
    checking lex output file root... lex.yy
    checking whether yytext is a pointer... yes
    checking for working const... yes
    checking for flex version... invalid
    configure: warning: flex versions supported for regeneration of the Zend/PHP parsers: 2.5.4  (found: 2.5.33)
    checking whether /usr/bin/gcc-4.0 supports -no-cpp-precomp... yes
    checking whether to force non-PIC code in shared modules... no
    checking whether /dev/urandom exists... yes
    checking for pthreads_cflags... 
    checking for pthreads_lib... 
    
    Configuring SAPI modules
    checking for AOLserver support... no
    checking for Apache 1.x module support via DSO through APXS... configure: error: You have enabled Apache 1.3 support while your server is Apache 2.  Please use the appropiate switch --with-apxs2
    
    Error: The following dependencies failed to build: py-pylibpcap swig php5 python25 ruby
    Error: Status 1 encountered during processing.
    That's the output I get. Can someone please help me get this working? I'm running Python 2.5 on 10.5.4.
    f][sh
     
  2. myjay610 macrumors regular

    Joined:
    Jan 6, 2008
    #2
    Have you had any luck with this? I'm trying to do the same thing. The stupid binary installer for macports didn't even work right for me because I can't see any of the items it refers to. And of course the scapy install via ports doesn't work as well, it fails at the end.
     
  3. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #3
    may it's this...

    You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2
     
  4. fishinatree thread starter macrumors newbie

    Joined:
    Jun 7, 2008
    Location:
    Santa Rosa, CA
    #4
    Does anyone know how to enable Apache 1.3 or 2? Maybe a command line tool or something similar.

    And myjay610, what's the problem you run into at the end? Can you post some console output or something?

    f][sh
     
  5. myjay610 macrumors regular

    Joined:
    Jan 6, 2008
    #5
    Here's my error list, it's a bunch of compiler errors when trying to install sqllite, not sure why it's installing that for scapy but it is.

    ---> Building sqlite3 with target all
    Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_sqlite3/work/sqlite-3.6.3" && gnumake all " returned error 2
    Command output: sqlite3.c:81398: error: 'TK_LSHIFT' undeclared (first use in this function)
    sqlite3.c:81401: error: 'TK_LT' undeclared (first use in this function)
    sqlite3.c:81407: error: 'TK_GE' undeclared (first use in this function)
    sqlite3.c:81410: error: 'TK_RSHIFT' undeclared (first use in this function)
    sqlite3.c:81413: error: 'TK_GT' undeclared (first use in this function)
    sqlite3.c:81419: error: 'TK_ILLEGAL' undeclared (first use in this function)
    sqlite3.c:81428: error: 'TK_BITOR' undeclared (first use in this function)
    sqlite3.c:81431: error: 'TK_CONCAT' undeclared (first use in this function)
    sqlite3.c:81436: error: 'TK_COMMA' undeclared (first use in this function)
    sqlite3.c:81440: error: 'TK_BITAND' undeclared (first use in this function)
    sqlite3.c:81444: error: 'TK_BITNOT' undeclared (first use in this function)
    sqlite3.c:81461: error: 'TK_STRING' undeclared (first use in this function)
    sqlite3.c:81464: error: 'TK_ID' undeclared (first use in this function)
    sqlite3.c:81476: error: 'TK_DOT' undeclared (first use in this function)
    sqlite3.c:81484: error: 'TK_INTEGER' undeclared (first use in this function)
    sqlite3.c:81490: error: 'TK_FLOAT' undeclared (first use in this function)
    sqlite3.c:81510: warning: assignment makes integer from pointer without a cast
    sqlite3.c:81514: error: 'TK_VARIABLE' undeclared (first use in this function)
    sqlite3.c:81523: error: 'TK_REGISTER' undeclared (first use in this function)
    sqlite3.c:81563: error: 'TK_BLOB' undeclared (first use in this function)
    sqlite3.c: In function 'sqlite3RunParser':
    sqlite3.c:81635: error: 'TK_SPACE' undeclared (first use in this function)
    sqlite3.c:81635: warning: case label value exceeds maximum value for type
    sqlite3.c:81643: error: 'TK_ILLEGAL' undeclared (first use in this function)
    sqlite3.c:81643: warning: case label value exceeds maximum value for type
    sqlite3.c:81650: error: 'TK_SEMI' undeclared (first use in this function)
    sqlite3.c:81650: warning: case label value exceeds maximum value for type
    sqlite3.c:81666: warning: comparison between pointer and integer
    sqlite3.c:81667: warning: passing argument 2 of 'sqlite3Parser' makes integer from pointer without a cast
    gnumake: *** [sqlite3.lo] Error 1

    Error: The following dependencies failed to build: py-pylibpcap swig php5 apache2 apr-util sqlite3 pcre bzip2 curl libmcrypt libxml2 libxslt mhash tiff python25 ruby
    Error: Status 1 encountered during processing.
    hotroute:~ john$
     
  6. myjay610 macrumors regular

    Joined:
    Jan 6, 2008
    #6
    Ok, I got Scapy running on 10.5. It's running off of python 2.4 and at version 1.1.1 but it's what I'm going to work with for now!

    Here's what I did:
    installed python2.4 (download: http://www.python.org/ftp/python/2.4.5/Python-2.4.5.tar.bz2 )

    Installation (follow these!) ... it has to be tweaked for 10.5
    un-package and cd into the directory
    ./configure
    vim pyconfig.h (or use any editor)
    add: #define SETPGRP_HAVE_ARG 1 to the top
    make
    make install

    Now you should be able to type python2.4 and get 2.4.5 running, and typing 'python' will still bring up 2.5.x

    So I tried (for the heck of it) python2.4 scapy.py and got the error, missing pcap module.

    So went back to the handy dandy portability page and tried following their instructions for pcap...nope. So I went and downloaded, the newest version, 0.6.2 from http://sourceforge.net/projects/pylibpcap

    install:
    pylibpcap-0.6.2.tar.gz
    tar zxf pylibpcap-0.6.2.tar.gz
    cd pylibpcap-0.6.2
    python2.4 ./setup.py build
    sudo python2.4 ./setup.py install

    then, python2.4 scapy.py and:
    Welcome to Scapy (v1.1.1 / f88d9910220)
    >>>

    Haven't written any scripts yet, but that's where I'm at.

    Good luck! And if anyone gets it for 2.5 please share!

    John
     
  7. fishinatree thread starter macrumors newbie

    Joined:
    Jun 7, 2008
    Location:
    Santa Rosa, CA
    #7
    Wow! Thanks! I have to use sudo to get it to work, but it finally works! On its webpage http://secdev.org/projects/scapy/portability.html#osx, it only lists installation for 10.4, which might mean that Scapy hasn't been modified to run w/ 10.5 and Python 2.5 at the same time. I don't really know...I'm a relative newcomer to this whole thing.
    But thank you very much for your help.
    f][sh
     
  8. myjay610 macrumors regular

    Joined:
    Jan 6, 2008
    #8
    Yeah, I forgot to mention that you should run it as sudo. Same if you are just going to use the python interactive mode, you would do 'sudo python2.4' then 'from scapy import *' ... for some reason sometimes I have to do the import statement twice.
     

Share This Page