#!/usr/bin/env awk

BEGIN {
    _proto[1]  = "FTP"
    _proto[2]  = "POP3"
    _proto[3]  = "IMAP"
    _proto[4]  = "SMTP"
    _proto[5]  = "HTTP Basic"
    _proto[6]  = "HTTP Proxy"
    _proto[7]  = "HTTP GET"
    _proto[8]  = "HTTP POST"
    _proto[9]  = "IRC"
    _proto[10] = "Telnet"
    _proto[11] = "LDAP"
    _proto[12] = "PAP"
}

hdr() {
    next
}

strtonum($pwxType) && (!strisempty($pwxUser) || !strisempty($pwxPass)) {
    _atype = strtonum($pwxType)
    aggr(tuple2() OFS _proto[_atype] OFS unquote($pwxUser) OFS unquote($pwxPass), "flows", n)
}
