summaryrefslogtreecommitdiff
path: root/community/john/APKBUILD
blob: 4e6e9694580def26ad6156bffd28bc6da9f24951 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Contributor: Ivan Tham <pickfire@riseup.net>
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=john
pkgver=1.8.0
_pkgrel=jumbo-1
pkgrel=8
pkgdesc="John the Ripper password cracker"
url="http://www.openwall.com/john"
arch="x86_64 armhf ppc64le"
license="GPL2"
depends="nss"
options="!strip"
makedepends="libpcap-dev libressl-dev gmp-dev yasm-dev zlib-dev"
install=""
subpackages="$pkgname-doc
	$pkgname-scripts-py:py:noarch
	$pkgname-scripts-perl:perl:noarch
	$pkgname-scripts-ruby:ruby:noarch
	$pkgname-misc::noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-jumbo:jumbo:noarch
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/magnumripper/JohnTheRipper/archive/$pkgver-$_pkgrel.tar.gz
	truecrypt_fmt_plug.patch
	params-h.patch
	gcc5-support.patch
	libressl.patch
	"
builddir="$srcdir/JohnTheRipper-$pkgver-$_pkgrel"

build() {
	cd "$builddir"/src
	sed -i -e "s/ac_default_prefix.*/ac_default_prefix=\/usr/g" configure
	export OPENSSL_LIBS="-lssl -lcrypto"
	./configure \
		--disable-openmp
	make || return 1
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/bin
	mkdir -p "$pkgdir"/usr/share/doc/$pkgname

	install -Dm644 run/john.conf "$pkgdir"/etc/john/john.conf
	install -Dm644 run/john.local.conf "$pkgdir"/etc/john/john.local.conf
	install -Dm644 doc/* "$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 doc/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	rm "$pkgdir"/usr/share/doc/$pkgname/LICENSE*

	local john_bins="john calc_stat genmkvpwd mkvcalcproba relbench
			tgtsnarf raw2dyna"
	for bin in ${john_bins}; do
		install -Dm755 run/${bin} "$pkgdir"/usr/bin
	done

	local john_links="hccap2john keepass2john mozilla2john pdf2john
			pfx2john pwsafe2john racf2john rar2john ssh2john
			unafs unique unsahdow undrop zip2john"
	for link in ${john_links}; do
		ln -s john "$pkgdir"/usr/bin/${link}
	done
}

py() {
	depends="libxml2 libgsf"
	_script python "*.py"
}

perl() {
	_script perl "*.pl benchmark-unify"
}

ruby() {
	_script ruby "*.rb"
}

_script() {
	local lang="$1"

	depends="$depends $lang"
	pkgdesc="John the Ripper ($lang scripts)"
	_install 755 "$2"
}

misc() {
	pkgdesc="Misc tools for John the Ripper: password list and charset files"
	local john_pwd="password.lst dictionary.rfc2865 stats"
	local john_chr="*.chr"
	local john_cfg="dumb*.conf repeats*.conf dynamic*.conf
			korelogic.conf regex_alphabets.conf"
	_install 644 "$john_pwd $john_cfg $john_chr"
}

_install() {
	local perm="$1"
	local files="$2"

	mkdir -p "$subpkgdir"/usr/share/$pkgname
	cd "$builddir"/run
	for f in ${files}; do
		install -Dm${perm} ${f} "$subpkgdir"/usr/share/john
	done
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	cd "$builddir"
	install -Dm644 run/john.bash_completion \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname || return 1
}

zshcomp() {
	depends=""
	pkgdesc="Zsh completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	cd "$builddir"
	install -Dm644 run/john.zsh_completion \
		"$subpkgdir"/usr/share/zsh/site-functions/$pkgname || return 1
}

jumbo() {
	pkgdesc="$pkgdesc (jumbo pack)"
	depends="$pkgname-scripts-py $pkgname-scripts-perl
		$pkgname-scripts-ruby $pkgname-misc"
	mkdir "$subpkgdir"
}

sha512sums="8b7fad7a6330b5ff1afc306218ba698aaa27776b566f82c2e76102d5ceb10aeafa69d71fa6fff67c81996ea2c6a04384bab4696ed192306c6d074873562e7089  john-1.8.0.tar.gz
80be6cc1b1b35c6a85392008638b2f8b6d8a518ee35f59405e2f5682e025e4b8beecf964148311e6f62d76b59153f04427024fa81aaf56ee2062ac2dbf0a9bcb  truecrypt_fmt_plug.patch
a5c22feb8bf11509c306a2f236f2bd4891fdfc3b01882f07d85015e0895d82f28df0dff78ba8d3a3862d8d95877a88a9eb8138e6c407b40881fa1455079b98fc  params-h.patch
4ebe8b41b1d0c3839348dcf5348332f9d7ce25919077fa054db64b7106150f299c6b177d117f7c18c1db672a494a6de6be8b5afe502f5ca3639602ba3aef6866  gcc5-support.patch
fb46431fe3e42e36c72361c13460e8ac626d2f146fa84c8f6e17e5407e69530a84ceb1de6bc9910c1a03a6e907fc113f7000a2cbc3936ae0860103d3e2d489b0  libressl.patch"