# Description: tools for network auditing and penetration testing
# URL:         http://monkey.org/~dugsong/dsniff
# Maintainer:  Thomas Penteker, tek at serverop dot de
# Depends on:  libpcap libnids libnet glib

name=dsniff
version=2.4b1
release=1
source=(http://monkey.org/~dugsong/dsniff/beta/$name-$version.tar.gz
        2.3-makefile.patch dsniff-2.4_beta1-debian-r1.patch
        dsniff-httppostfix.patch)

build() {
    cd  $name-2.4
    patch -i ../2.3-makefile.patch
    patch -i ../dsniff-2.4_beta1-debian-r1.patch
    patch -i ../dsniff-httppostfix.patch
    sed -i -e 's/CLK_TCK/CLOCKS_PER_SEC/g' sshow.c
    export LDFLAGS="`pkg-config --libs gthread-2.0`" 
    export CFLAGS="`pkg-config --cflags gthread-2.0`" 
    ./configure --prefix=/usr
    make
    install -d -m 755 $PKG/usr/sbin
    for prog in arpspoof dnsspoof dsniff filesnarf macof mailsnarf msgsnarf \
    sshmitm sshow tcpkill tcpnice  urlsnarf webmitm webspy; do \
      install -m 755 $prog $PKG/usr/sbin/; done
    install -d -m 755 $PKG/usr/man/man8
    for man in *.8; do install -D -m 644 $man $PKG/usr/man/man8; done
    install -d -m 755 $PKG/usr/share/dsniff
    for shares in dnsspoof.hosts dsniff.magic dsniff.services; do \
      install -m 644 $shares $PKG/usr/share/dsniff; done

}
