summaryrefslogtreecommitdiff
path: root/community/john/PKGBUILD
blob: ef02a0050dcb93fdcd3af758fa311010692d6b6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Maintainer: Thorsten Töpper <atsutane-tu@freethoughts.de>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Dale Blount <dale@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
# Contributor: Michal Krenek <mikos@sg1.cz>

pkgname=john
pkgver=1.7.6
pkgrel=2
pkgdesc="John The Ripper - A fast password cracker. Additional patches (NTLM, MySQL, Kerberos V5, etc.) included."
arch=('i686' 'x86_64')
url="http://www.openwall.com/$pkgname/"
license=('GPL2' 'custom')
depends=('openssl')
backup=('etc/john/john.conf')
source=(http://www.openwall.com/$pkgname/g/$pkgname-$pkgver.tar.bz2 
	http://www.openwall.com/john/contrib/john-$pkgver-jumbo-7.diff.gz 
	http://www2.psy.uq.edu.au/~ftp/Crypto/DES/libdes-4.04b.tar.gz 
	params.h.patch)
md5sums=('321ac0793f1aa4f0603b33a393133756'
         'bc87e7dd5c4ac1bb3d84bed87614028b'
         'e83785f17fde1f362b030792f1269bf1'
         'f69ed632eba8fb9e45847a4b4a323787')

build() {
	# jumbo patch
	cd ${srcdir}/$pkgname-$pkgver
	patch -p1 < ${srcdir}/$pkgname-$pkgver-jumbo-7.diff
	cd ${srcdir}/john-$pkgver/src/

	# patch default params
	patch -p0 < ${srcdir}/params.h.patch
	if [ "$CARCH" == "x86_64" ]; then
	    sed -i 's|CFLAGS = -c -Wall -O2|CFLAGS = -c -Wall -O2 -march=x86-64 -DJOHN_SYSTEMWIDE=1|' Makefile
	    sed -i 's|^LDFLAGS =\(.*\)|LDFLAGS =\1 -lm|' Makefile
	    sed -i -e 's|-m486||g' Makefile
	  else sed -i 's|CFLAGS = -c -Wall -O2|CFLAGS = -c -Wall -O2 -march=i686 -DJOHN_SYSTEMWIDE=1|' Makefile
	fi
	sed -i 's|LIBS = -ldes|LIBS = -ldes -Ldes|' Makefile
	sed -i 's|#include <des.h>|#include "des/des.h"|' KRB5_fmt.c
	sed -i 's|#include <des.h>|#include "des/des.h"|' KRB5_std.h

	# build john
	if [ "$CARCH" == "x86_64" ]; then
	    make linux-x86-64
	  else make linux-x86-mmx
	fi
}

package() {
	# config file
	sed -i 's|$JOHN|/usr/share/john|g' ${srcdir}/john-$pkgver/run/john.conf
	install -Dm644 ${srcdir}/john-$pkgver/run/john.conf ${pkgdir}/etc/john/john.conf
	
	# docs
	install -d ${pkgdir}/usr/share/doc/john
	install -m644 ${srcdir}/john-$pkgver/doc/* ${pkgdir}/usr/share/doc/john/
	install -d ${pkgdir}/usr/share/john/
	install -m644 ${srcdir}/john-$pkgver/run/*.chr ${pkgdir}/usr/share/john/
	install -m644 ${srcdir}/john-$pkgver/run/password.lst ${pkgdir}/usr/share/john/
	install -Dm644 ${srcdir}/john-$pkgver/doc/LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE

	# install password list and charset files
	install -m644 ${srcdir}/${pkgname}-${pkgver}/run/{{all,alnum,alpha,digits,lanman}.chr,password.lst} \
          ${pkgdir}/usr/share/john/

	# install binaries
	install -Dm755 ${srcdir}/john-$pkgver/run/john ${pkgdir}/usr/bin/john
	install -Dm755 ${srcdir}/john-$pkgver/run/mailer ${pkgdir}/usr/bin/john-mailer
	cd ${pkgdir}/usr/bin
	ln -s john unafs
	ln -s john unique
	ln -s john unshadow
	ln -s john undrop
}