summaryrefslogtreecommitdiff
blob: a9890627e241d19f5a27c0498f0e44a3b934220a (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-crypt/johntheripper/johntheripper-1.6.37-r1.ebuild,v 1.6 2004/11/01 00:48:50 pylon Exp $

inherit eutils flag-o-matic

MY_P=${P/theripper/}
S=${WORKDIR}/${MY_P}
DESCRIPTION="fast password cracker"
HOMEPAGE="http://www.openwall.com/john/"
SRC_URI="http://www.openwall.com/john/b/${MY_P}.tar.gz
	mirror://gentoo/${PF/theripper/}-gentoo.patch.bz2"

#
# john-{$PV}-gentoo.patch is a heavly hacked combination of:
#        mirror://debian/pool/main/j/john/${DEBPATCH}.gz
#        ftp://ftp.openwall.com/pub/projects/john/contrib/john-ntlm-patch-v02.tgz
#        http://www.monkey.org/~dugsong/john-1.6.krb4.patch-3
#        http://www.monkey.org/~dugsong/john-1.6.skey.patch-1
#        ftp://ftp.openwall.com/pub/projects/john/contrib/john-1.6-mysql-1.diff
#        ftp://ftp.openwall.com/pub/projects/john/contrib/john-1.6.31-eggpatch-8.diff.gz
#


LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~sparc ppc ~alpha"
#KEYWORDS removed until "generic" target is fixed - "~mips ~hppa"
IUSE="mmx ntlm skey mysql kerberos"

RDEPEND="virtual/libc
	skey? ( app-admin/skey )
	kerberos? ( dev-libs/openssl )"

DEPEND="${RDEPEND}
	sys-devel/binutils
	sys-devel/gcc
	>=sys-apps/sed-4"

src_unpack() {
	unpack ${A}
	epatch ${PF/theripper/}-gentoo.patch
}

src_compile() {
	cd src
	sed -i -e "s:^\(CFLAGS =.*\):\1 ${CFLAGS}:" \
		Makefile

	sed -i -e 's:^#define CFG_ALT_NAME.*:#define CFG_ALT_NAME "/etc/john.ini":' \
	-e 's:^#define WORDLIST_NAME.*:#define WORDLIST_NAME "/usr/share/john/password.lst":' \
	params.h

	local OPTIONS="EGG=true"
	use kerberos && OPTIONS="${OPTIONS} KERBEROS=true"
	use ntlm && OPTIONS="${OPTIONS} NTLM=true"
	use skey && OPTIONS="${OPTIONS} SKEY=true"
	use mysql && OPTIONS="${OPTIONS} MYSQL=true"

	if use x86 ; then
		if use mmx ; then
			emake ${OPTIONS} linux-x86-mmx-elf || die "Make failed"
		elif is-flag "-march=k6-3" || is-flag "-march=k6-2" \
			|| is-flag "-march=k6"; then
			emake ${OPTIONS} linux-x86-k6-elf || die "Make failed"
		else
			emake ${OPTIONS} linux-x86-any-elf || die "Make failed"
		fi
	elif use alpha ; then
		emake ${OPTIONS} linux-alpha || die "Make failed"
	elif use sparc; then
		emake ${OPTIONS} linux-sparc  || die "Make failed"
	elif use ppc; then
		emake ${OPTIONS} linux-ppc  || die "Make failed"
	elif use amd64; then
		if use mmx; then
			emake ${OPTIONS} linux-x86-64-mmx  || die "Make failed"
		else
			emake ${OPTIONS} linux-x86-64  || die "Make failed"
		fi
	else
		emake ${OPTIONS} generic || die "Make failed"
	fi

	#use debug && emake bench

}

src_install() {
	insinto /etc
	doins run/john.ini debian/john-mail.msg debian/john-mail.conf
	insinto /usr/share/${PN/theripper/}
	doins run/password.lst \
		debian/john-dailyscript
	doman debian/*.1
	dosbin run/john debian/mailer debian/john-cronjob

	dosym john /usr/sbin/unafs
	dosym john /usr/sbin/unique
	dosym john /usr/sbin/unshadow

	# for EGG only
	dosym john /usr/sbin/undrop

	# use debug && dobin src/bench

	dodoc debian/{CONFIG.mailer,copyright} doc/*
}