1 # Contributer: fnord0 <fnord0 AT riseup DOT net>
7 pkgdesc="A cross-platform fuzzing framework written in Python"
9 url="http://peachfuzzer.com/"
11 depends=('pyrex' 'gtk2' 'unzip' 'tar' 'twisted' 'pyasn1' 'wxpython' 'zope-interface')
12 provides=('python-cdeepcopy' 'python-cpeach' 'peach-pypcap' 'python-pydbgeng' 'python-vdebug' 'python-4suite-xml' 'python-multiprocessing' 'python-psutil' 'python-pyvmware')
13 conflicts=('4suite' 'python-multiprocessing')
14 optdepends=('pygtk: VDB gui support'
15 'pango: VDB gui support')
16 source=("http://downloads.sourceforge.net/project/peachfuzz/${_pkgname}/${pkgver}/${_pkgname}-${pkgver}-src.zip"
17 "https://launchpadlibrarian.net/24301374/python2.6.patch.txt")
18 options=(!emptydirs !strip)
19 md5sums=('aaaccbddc6553b23056e61aa44464e6e'
20 'f4cfec5f5f9f58c3d18f0e7f337353ed')
21 sha1sums=('c1cc4b885b340baff96a55ae104e45f5c3b44188'
22 'cc84a76bd16683fa29e1c96c1931bc6534c7b644')
23 install=('peach.install')
27 install -d ${pkgdir}/usr/bin || return 1
28 install -d ${pkgdir}/usr/share/${pkgname} || return 1
29 install -d ${pkgdir}/usr/share/${pkgname}/docs || return 1
30 install -d ${pkgdir}/usr/share/${pkgname}/samples || return 1
31 install -d ${pkgdir}/usr/share/${pkgname}/test || return 1
32 install -d ${pkgdir}/usr/share/${pkgname}/tools || return 1
33 install -d ${pkgdir}/usr/share/${pkgname}/Peach || return 1
34 install -d ${pkgdir}/usr/share/licenses/${pkgname} || return 1
36 # python-cdeepcopy install
37 msg "Building and installing python-cdeepcopy ..."
38 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/cDeepCopy
39 python2 setup.py install --root=${pkgdir}/ --optimize=1 || return 1
41 # python-cpeach install
42 msg "Building and installing python-cpeach ..."
43 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/cPeach
44 python2 setup.py config || return 1
45 python2 setup.py install --root=${pkgdir}/ --optimize=1 || return 1
47 # peach-pypcap install
48 msg "Patching peach-pypcap ..."
49 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/peach-pypcap
50 #sed -i 's|pyrexc|pyrexc2.5|' Makefile
51 sed -i '/print/d' setup.py
52 sed -i '/#include <pcap.h>/ i\#define HAVE_PCAP_FILE' pcap_ex.c
53 sed -i '/ conf = self._pcap_config([ self.with_pcap ])/ conf = self._pcap_config([ self.with_pcap ])/' setup.py
54 msg "Building and installing a modified version of the pypcap library to support saving captures as pcap files..."
55 python2 setup.py config || return 1
56 python2 setup.py install --root=${pkgdir}/ --optimize=1 || return 1
57 # peach-pycap post install
58 install -d ${pkgdir}/usr/share/peach-pypcap || return 1
59 install -d ${pkgdir}/usr/share/peach-pypcap/doc || return 1
60 install -d ${pkgdir}/usr/share/licenses/peach-pypcap || return 1
61 install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/peach-pypcap/LICENSE || 1
63 ##install -D -m755 testsniff.py ${pkgdir}/usr/share/peach-pypcap/testsniff.py || return 1
64 ##ln -sf /usr/share/peach-pypcap/testsniff.py ${pkgdir}/usr/bin/testsniff.py || return 1
65 for pcapdoc in CHANGES README README-Peach.txt; do
66 install -Dm644 ${pcapdoc} ${pkgdir}/usr/share/peach-pypcap/doc/${pcapdoc} || return 1
69 # python-pydbgeng install
70 msg "Building and installing python-pydbgeng ..."
71 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src
72 unzip PyDbgEng-0.14.zip || return 1
73 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/PyDbgEng-0.14
74 python2 setup.py config || return 1
75 python2 setup.py build || return 1
76 python2 setup.py install --root=${pkgdir}/ --optimize=1 || return 1
77 # python-pydbgeng post install
78 install -d ${pkgdir}/usr/share/pydbgeng || return 1
79 install -d ${pkgdir}/usr/share/pydbgeng/doc || return 1
80 install -d ${pkgdir}/usr/share/pydbgeng/Examples || return 1
81 install -d ${pkgdir}/usr/share/licenses/pydbgeng || return 1
82 install -D -m644 LICENSE.txt ${pkgdir}/usr/share/licenses/pydbgeng/LICENSE.txt || return 1
83 for dbgdoc in CHANGELOG.txt README.txt; do
84 install -Dm644 ${dbgdoc} ${pkgdir}/usr/share/pydbgeng/doc/${dbgdoc} || return 1
86 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/PyDbgEng-0.14/Examples
88 install -Dm644 ${dbgex} ${pkgdir}/usr/share/pydbgeng/Examples/${dbgex} || return 1
92 msg "Patching 4Suite-XML to work with Python 2.7.x ..."
93 # bug details @ https://bugs.launchpad.net/ubuntu/jaunty/+source/python-4suite/+bug/338079
94 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/4Suite-XML-1.0.2
95 patch -p1 < ${srcdir}/python2.6.patch.txt || return 1
96 msg "Building and installing 4Suite-XML, be aware this may take a while ..."
97 python2 setup.py config || return 1
98 python2 setup.py build || return 1
99 install -d ${pkgdir}/usr/share/4suite-xml || return 1
100 install -d ${pkgdir}/usr/share/4suite-xml/docs || return 1
101 install -d ${pkgdir}/usr/share/4suite-xml/locale || return 1
102 install -d ${pkgdir}/usr/share/4suite-xml/etc || return 1
103 sed -i "s|/local/|/|" config.cache || return 1
104 sed -i "s|/usr/local/doc/|/usr/share/4suite-xml/docs/|" config.cache || return 1
105 sed -i "s|\$name|4share-xml|" config.cache || return 1
106 sed -i "s|/usr/share/locale|/usr/share/4share-xml/locale|" config.cache || return 1
107 sed -i "s|/usr/etc/4share-xml|/usr/share/4share-xml/etc|" config.cache || return 1
108 python2 setup.py install --root=${pkgdir}/ --optimize=1 --with-docs || return 1
109 # 4suite-xml post install
110 install -d ${pkgdir}/usr/share/licenses/4suite-xml || return 1
111 install -D -m644 COPYRIGHT ${pkgdir}/usr/share/licenses/4suite-xml || return 1
112 cp -pR README docs test ${pkgdir}/usr/share/4suite-xml/ || return 1
114 # python-vdebug install
115 msg "Building and installing python-vdebug ..."
116 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src
117 unzip vdebug-022710.zip || return 1
118 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/vdebug-022710
119 python2 setup.py install --root=${pkgdir}/ --optimize=1 || return 1
120 # vdebug post install
121 ####install -d ${pkgdir}/usr/share/vdebug || return 1
122 ####install -D -m644 README ${pkgdir}/usr/share/vdebug/README || return 1
124 # python-psutil install
125 msg "Building and installing python-psutil ..."
126 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src
127 tar xzf psutil-0.2.0.tar.gz || return 1
128 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/psutil-0.2.0
129 python2 setup.py config || return 1
130 python2 setup.py build || return 1
131 python2 setup.py install --root=${pkgdir}/ --optimize=1 || return 1
133 # python-pyvmware install
134 msg "Building and installing python-pyvmware ..."
135 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src
136 unzip -d pyvmware pyvmware-0.1-src.zip || return 1
137 cd ${srcdir}/${_pkgname}-${pkgver}-src/dependencies/src/pyvmware
138 python2 setup.py config || return 1
139 python2 setup.py build || return 1
140 python2 setup.py install --root=${pkgdir}/ --optimize=1 || return 1
143 msg "Building and installing peach ..."
144 cd ${srcdir}/${_pkgname}-${pkgver}-src
145 for pfuzzcp in defaults.xml peach.py peach.xsd peachvalidator.pyw repro.xml template.xml docs samples test tools Peach; do
146 cp -pR ${pfuzzcp} ${pkgdir}/usr/share/${pkgname}/ || return 1
148 for pfuzzdocscp in changelist.txt readme.html; do
149 cp -pR ${pfuzzdocscp} ${pkgdir}/usr/share/${pkgname}/docs/ || return 1
154 msg "Creating a startup app => /usr/bin/peach"
155 echo "#!/bin/sh" > ${pkgdir}/usr/bin/${pkgname}
156 echo "cd /usr/share/peach" >> ${pkgdir}/usr/bin/${pkgname}
157 echo "python2 peach.py \"\$@\"" >> ${pkgdir}/usr/bin/${pkgname}
158 echo "cd -" >> ${pkgdir}/usr/bin/${pkgname}
159 chmod +x ${pkgdir}/usr/bin/${pkgname}