# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem            1.0
PortGroup             python 1.0
PortGroup             github 1.0

name                  scapy

python.versions        27
python.default_version 27

categories            net security python
license               GPL-2
platforms             darwin
supported_archs       noarch
maintainers           {michaelld @michaelld} openmaintainer

description           A powerful packet manipulation tool
long_description      \
        Scapy is a powerful interactive packet manipulation program. It is \
        able to forge or decode packets of a wide number of protocols, send \
        them on the wire, capture them, match requests and replies, and much \
        more. It can easily handle most classical tasks like scanning, \
        tracerouting, probing, unit tests, attacks or network discovery (it \
        can replace hping, 85% of nmap, arpspoof, arp-sk, arping, tcpdump, \
        tethereal, p0f, etc.). It also performs very well at a lot of other \
        specific tasks that most other tools can't handle, like sending \
        invalid frames, injecting your own 802.11 frames, combining technics \
        (VLAN hopping+ARP cache poisoning, VOIP decoding on WEP encrypted \
        channel, ...), etc.

subport ${name}-devel {}

if {${subport} eq ${name}} {

    github.setup secdev ${name} 2.4.3 v
    checksums rmd160 71ef31e63c9de8e158bcc57dafe50b2a36c01a7b \
              sha256 d9f4d27553418463273b0aab7c11dea2f4121c53a493fe9dc91d7feaf057af60 \
              size   2970127
    revision  0

    conflicts       ${name}-devel

    # overload the github livecheck regex to look for versions that
    # are just numbers and '.', no letters (e.g., "3.7.3_rc2").

    github.livecheck.regex  {([0-9.]+)}

} else {

    github.setup secdev scapy b49af41caaea124669228df68876c66007e73175
    version   20191209-[string range ${github.version} 0 7]
    checksums rmd160 03500d55c9f6fde209d857730f08435fa017dbe3 \
              sha256 9ea4a3b3fe2ace2f0a9dfa0fb1e90e14082788770554a80454773ac8c761e94b \
              size   3082216
    revision  0

    long_description    ${long_description} \
        This port is kept up with the ${name} GIT 'master' branch, is typically updated weekly to monthly.
    conflicts       ${name}

}

homepage              http://www.secdev.org/projects/${name}

depends_lib-append    port:py${python.version}-gnureadline \
                      port:py${python.version}-pylibpcap \
                      port:py${python.version}-libdnet \
                      port:py${python.version}-crypto

default_variants +gnuplot +graphviz

## http://www.secdev.org/projects/scapy/doc/installation.html#optional-software-for-special-features
variant pyx description {" With PyX for creating PostScript figures"} {
    depends_lib-append              port:py${python.version}-pyx
}

variant gnuplot description { "With gnuplot export" } {
    depends_run-append              port:py${python.version}-gnuplot
}

variant graphviz description { "With graphviz export" } {
    depends_run-append              path:bin/dot:graphviz port:ImageMagick
}

variant sox description { "With sox export for VoIP" } {
    depends_run-append              port:sox
}