#Packager: Frédéric Galusik <fredg~at~salixos~dot~org>
#
# source location:http://hashcat.net/hashcat/#downloadlatest
# No way to get them with wget/curl
#
pkgname=hashcat
pkgver=0.34
pkgrel=1fg
# You need a CPU capable of SSE2 instruction set
arch=i686
source=(hashcat-$pkgver.rar)
sourcetemplate=http://people.salixos.org/fredg/packages/$pkgname/$pkgver/
url=http://hashcat.net/hashcat

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"haschcat (Advanced password recovery)"
"Hashcat is a Multithreaded cross platform hash cracker."
"Some features:"
"All Attack-Modes except Brute-Force and Permutation can be extended"
"by rules, very fast Rule-engine Rules mostly compatible with JTR and"
"PasswordsPro, Possible to resume or limit session, automatically"
"recognizes recovered hashes from outfile at startup, 33+ Algorithms"
"implemented with performance in mind, ... and much more"
""
"Warning: this software is free to use, but is NOT OpenSource."
)

build() {
	cd $startdir
	unrar x $pkgname-$pkgver.rar
	mkdir -p $startdir/pkg/usr/bin
	mkdir -p $startdir/pkg/usr/lib/$pkgname-$pkgver
	mkdir -p $startdir/pkg/usr/doc/$pkgname-$pkgver
	cp -Rf $pkgname-$pkgver/{examples,rules,salts,hashcat-cli.bin} \
		$startdir/pkg/usr/lib/$pkgname-$pkgver
	cp $pkgname-$pkgver/docs/* $startdir/pkg/usr/doc/$pkgname-$pkgver

	echo "#!/bin/sh" > $startdir/pkg/usr/bin/hashcat
	echo "exec /usr/lib/$pkgname-$pkgver/hashcat-cli.bin \"\$@\"" >> \
		$startdir/pkg/usr/bin/hashcat
	echo "Hashcat is free to use but it is NOT Open Source." > \
		$startdir/pkg/usr/doc/$pkgname-$pkgver/LICENCE
	echo "It is a proprietary software." >> \
		$startdir/pkg/usr/doc/$pkgname-$pkgver/LICENCE
	echo "Use it at your own risk." >> \
		$startdir/pkg/usr/doc/$pkgname-$pkgver/LICENCE
	echo "" >> $startdir/pkg/usr/doc/$pkgname-$pkgver/LICENCE
	echo "Visit http://hashcat.net/hashcat/ for more informations" >> \
		$startdir/pkg/usr/doc/$pkgname-$pkgver/LICENCE
	
	chmod 755 $startdir/pkg/usr/bin/hashcat
	cd $startdir/pkg/usr/lib/$pkgname-$pkgver
	find . -type f -exec chmod 644 '{}' +
	find . -type d -exec chmod 755 '{}' +
	chmod 755 hashcat-cli.bin
}

