Skip to content

Instantly share code, notes, and snippets.

@nbrew
Created March 1, 2012 23:11
Show Gist options
  • Save nbrew/1953902 to your computer and use it in GitHub Desktop.
Save nbrew/1953902 to your computer and use it in GitHub Desktop.
Install w3af with requirements on Mac OS X
#!/bin/bash
# Attempts to install the web application vulnerability scanner w3af and it's prerequisites.
# For more information about w3af, see: http://w3af.sourceforge.net/
# USAGE: pypi_install package_name version_number md5_checksum
# checksum is optional; package and version are required
function pypi_install() {
name=$1
version=$2
md5=$3
if [ -z ${name} ] || [ -z ${version} ]; then
echo 'No module or version given. Exiting.'
exit 1
fi
fullname=${name}-${version}
tgz=${name}-${version}.tar.gz
echo "Now attempting to install ${fullname}"
cd /usr/local/src
wget "http://pypi.python.org/packages/source/${name:0:1}/${name}/${tgz}#md5=${md5}"
cd ../build && tar -zxvf ../src/${tgz} && cd ${fullname} && python setup.py install && cd ../../src
}
echo 'Installing prerequisites...'
pypi_install pybloomfiltermmap 0.3.2 'b812247cfb44f7dec221f439ea85ec60'
cd /usr/local/src
wget http://pyyaml.org/download/pyyaml/PyYAML-3.09.tar.gz
cd ../build && tar -xzvf ../src/PyYAML-3.09.tar.gz
cd PyYAML-3.09
python setup.py install
cd ../../src
wget http://nltk.googlecode.com/files/nltk-2.0b9.tar.gz
cd ../build && tar -xzvf ../src/nltk-2.0b9.tar.gz
cd nltk-2.0b9
python setup.py install
cd ../../src
pypi_install fpconst 0.7.2 '10ba9e04129af23108d24c22c3a698b1'
# lxml pysvn scapy
pypi_install 'lxml' 2.3.3
cd /usr/local/src
wget http://pysvn.barrys-emacs.org/source_kits/pysvn-1.7.5.tar.gz
cd ../build && tar -zxvf ../src/pysvn-1.7.5.tar.gz && cd pysvn-1.7.5 && python setup.py install && cd ../../src
# for SOAPy
pypi_install wstools 0.3
# SOAPy
pypi_install SOAPpy 0.12.5 '2eeadc857dc0b7d6d3ba27cb5fdb1e08'
# install libdnet and dnet module
cd /usr/local/src
wget 'http://libdnet.googlecode.com/files/libdnet-1.12.tgz'
cd ../build && tar -zxvf ../src/libdnet-1.12.tgz && cd libdnet-1.12
p=`which python`; dir=`dirname ${p}`; ./configure --prefix=/usr/local --with-python=${dir} && make && sudo make install
cd python && python setup.py install
cd /usr/local/src
# install libpcap
wget http://dfn.dl.sourceforge.net/sourceforge/pylibpcap/pylibpcap-0.6.2.tar.gz
cd ../build && tar -zxvf ../src/pylibpcap-0.6.2.tar.gz && cd pylibpcap-0.6.2 && python setup.py install
# install scapy
cd /usr/local/src
wget http://www.secdev.org/projects/scapy/files/scapy-latest.tar.gz
cd ../build && tar -zxvf ../src/scapy-latest.tar.gz && cd scapy-2.1.0 && sudo python setup.py install && cd ../../src
echo 'Installing additional requirements (for r4702)'
# install pcapy
cd /usr/local/src
wget http://oss.coresecurity.com/repo/pcapy-0.10.5.tar.gz
cd ../build && tar -zxvf ../src/pcapy-0.10.5.tar.gz && cd pcapy-0.10.5 && sudo python setup.py install && cd ../../src
echo 'Installing w3af'
cd /usr/local/src
wget 'http://downloads.sourceforge.net/project/w3af/w3af/w3af%201.1/w3af-1.1.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fw3af%2Ffiles%2Fw3af%2Fw3af%25201.1%2F&ts=1330636307&use_mirror=voxel'
cd ../build && tar -jxvf ../src/w3af-1.1.tar.bz2 && cd w3af && python setup.py install && cd ../../src
echo 'Now run:'
echo 'cd /usr/local/build/w3af && ./w3af_console'
echo
echo "Don't forget to read the User Guide:"
echo " http://w3af.sourceforge.net/documentation/user/w3afUsersGuide.pdf"
echo
@Daemonbit
Copy link

Quick and dirty. I like it. It works.
For a moment, I was hung up on the fact that MacPorts and PyDev didn't have a a repo for the use of scapy while using python 2.6.

Note: I changed the target path:

. /op/local/src/
. opt/local/build/

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment