summaryrefslogtreecommitdiff
blob: 83ae1132c88855c8b0e05533fc10fd78a0b525c2 (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-forensics/pyflag/pyflag-0.80.ebuild,v 1.1 2006/01/22 05:54:14 dragonheart Exp $

inherit eutils autotools

DESCRIPTION="Tool for analysing log files, tcpdump files and hard disk images"
HOMEPAGE="http://pyflag.sf.net"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"

IUSE=""
COMMON_DEPEND="
		virtual/libpcap
		sys-apps/file
		dev-python/mysql-python
		sys-libs/zlib
		app-antivirus/clamav
		>=app-forensics/sleuthkit-2.03
		dev-python/pexpect
		dev-python/imaging
		media-libs/ploticus"

RDEPEND="${COMMON_DEPEND}
		dev-db/mysql"

DEPEND=">=dev-lang/swig-1.3
		${COMMON_DEPEND}"

#
# TODO: init scripts
#
#		dev-python/pexpect
#		dev-python/imaging
#		media-libs/ploticus
#		app-forensics/sleuthkit to RDEPEND as it realy only checks they are
#		installed
#

src_unpack() {
	unpack "${A}"
	cd "${S}"
	epatch "${FILESDIR}/${P}-nodbtool.patch"
	sed -i -e 's/flag_version =.*/flag_version ="$Version: 0.80 Date: Thu Jan 19 00:50:12 EST 2006$"/' \
		src/pyflag/FlagFramework.py
	_elibtoolize --copy --force
	eaclocal -I config
	eautomake
	eautoconf

}

src_install() {
	make DESTDIR="${D}" install || die
	# don't include pyflag use include files - its just silly
	rm -rf "${D}/usr/include"

	#maybe later
	#newinitd "${FILESDIR}/${P}-init"  pyflag
	#newconfd "${FILESDIR}/${P}-conf"  pyflag
}

pkg_postinst() {
	einfo "Optionally enter database details in /etc/pyflagrc"
	einfo
	einfo "To start PyFlag just run \"pyflag\" as a normal user"
	einfo "then open your web browser on http://localhost:8000"
	einfo
	einfo "To create a database user \"emerge --config =${PF}\""
}

pkg_config() {
	ewarn "This creates the approprate adminstrative user for pyflag"
	ewarn "Run pyflag with the entered credentials to create the"
	ewarn "tables and database."
	einfo
	einfo "Enter user to create:"
	read USER
	einfo "Enter user's password:"
	read PASSWORD

	# note - poor privledge separation is used in pyflag
	# recommend not sharing with other security consious databases.
	# it may be possible to imporve this a bit using manual permission setting.
	einfo "Enter mysql root database password:"
	echo GRANT ALL PRIVILEGES ON "*.*" TO $USER@localhost \
		IDENTIFIED BY \"$PASSWORD\"\; FLUSH PRIVILEGES\;  \
		| /usr/bin/mysql -u root -p

	einfo "Do you want this data to be used for all users (y/n)?"
	ewarn "Warning - all credentials will be in a world readable file"
	ewarn "This overwrites settings in ${ROOT}/etc/pyflagrc"
	read  GLOBAL
	if [ "${GLOBAL}" == "y" ] || [ "${GLOBAL}" == "Y" ]; then
		einfo "updating global settings"
		sed -i -e "s:PYFLAG_DBUSER=.*:PYFLAG_DBUSER=$USER:" \
				-e "s:PYFLAG_DBPASSWD=.*:PYFLAG_DBPASSWD=$PASSWORD:" \
				"${ROOT}/etc/pyflagrc"
	fi
}