# -*- 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           select 1.0

name                py-scapy
version             2.6.1
revision            0

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

homepage            https://scapy.net/

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.

checksums           rmd160  442870fbf42666de859e38d0fae65e6d02e3e76c \
                    sha256  7600d7e2383c853e5c3a6e05d37e17643beebf2b3e10d7914dffcc3bc3c6e6c5 \
                    size    2247754


python.versions     27 39 310 311 312 313

if {${subport} ne ${name}} {
    if {${python.version} == 27} {
        version     2.5.0
        revision    0
        checksums   rmd160  1c5576ae4282cd17cd9512382f5e4987bf8ef2e3 \
                    sha256  5b260c2b754fd8d409ba83ee7aee294ecdbb2c235f9f78fe90bc11cb6e5debc2 \
                    size    1279162
        depends_build-append \
                    port:py${python.version}-setuptools
    }

    depends_lib-append \
                    port:libpcap \
                    port:py${python.version}-cryptography

    default_variants +matplotlib +graphviz

    ## https://scapy.readthedocs.io/en/latest/installation.html#optional-dependencies
    variant pyx description { "With PyX for creating PostScript figures" } {
        depends_lib-append  port:py${python.version}-pyx
    }

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

    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
    }

    depends_run-append      port:scapy_select

    select.group            scapy
    select.file             ${filespath}/${subport}

    notes "
To make the Python ${python.branch} version of scapy the one that is run when\
you execute the commands without a version suffix, e.g. 'scapy', run:

port select --set ${select.group} [file tail ${select.file}]
"
}
