# Maintainer: Levente Polyak <levente[at]leventepolyak[dot]net>
# Contributor: Fabiano Furtado < fusca14 (at) gmail (dot) com >

pkgname=wifite
_gitcommit=918a499786afdfefcc9582a29df79d0959294ba2
pkgver=87.r139.918a499
pkgrel=2
epoch=1
pkgdesc='Tool to attack multiple WEP and WPA encrypted networks at the same time'
url='https://github.com/derv82/wifite'
arch=('any')
license=('GPL2')
depends=('python2' 'aircrack-ng')
optdepends=(
  'reaver: WPS attack support'
  'pyrit: detect WPA handshakes'
  'wireshark-cli: detect handshakes'
  'cowpatty: detect WPA handshakes'
  'macchanger: change MAC for attacks'
)
makedepends=('git')
source=(${pkgname}::"git+https://github.com/derv82/wifite#commit=${_gitcommit}")
sha512sums=('SKIP')

pkgver() {
  cd ${pkgname}
  printf "%s.r%s.%s" \
    "$(grep 'self.REVISION =' wifite.py|sed -r 's|.*REVISION = ([0-9]+).*|\1|g')" \
    "$(git rev-list --count HEAD)" \
    "$(git rev-parse --short HEAD)"
}

prepare() {
  cd ${pkgname}
  sed -e 's|usr/bin/python$|/usr/bin/env python2|g' -i wifite.py
}

package() {
  cd ${pkgname}
  install -Dm 755 wifite.py "${pkgdir}/usr/bin/${pkgname}"
  install -Dm 644 readme.md "${pkgdir}/usr/share/doc/${pkgname}/README"
}

# vim: ts=2 sw=2 et:
