CN-TU/go-flows

Error when creating feature with "and" function

reumar opened this issue · 0 comments

Hi,

I've created a configuration where a feature is designed that uses the "add" function:

{
  "active_timeout": 1800,
  "idle_timeout": 300,
  "bidirectional": true,
  "features": [
    "sourceIPAddress",
    "destinationIPAddress",
    "protocolIdentifier",
    "sourceTransportPort",
    "destinationTransportPort",
    {
      "count": [
        {
          "and": [
            {
              "select": [
                {
                  "greater": [
                    "ipTotalLength",
                    128
                  ]
                }
              ]
            },
            {
              "select": [
                {
                  "leq": [
                    "ipTotalLength",
                    256
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "key_features": [
    "sourceIPv4Address",
    "destinationIPv4Address",
    "sourceTransportPort",
    "destinationTransportPort",
    "protocolIdentifier"
  ]
}

The feature is inspired by an example found here: https://nta-meta-analysis.readthedocs.io/en/latest/features.html#example-features

However, when I run go-flows, I get an error:

./go-flows run features config.json export csv out.csv source libpcap file.pcap

panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
github.com/CN-TU/go-flows/flows.(*astCall).build(0xc0001cf900, 0x4)
        /home/rmarkham/Adhoc/go-flows/flows/ast.go:499 +0x770
github.com/CN-TU/go-flows/flows.(*astCall).build(0xc0001cf7c0, 0x5)
        /home/rmarkham/Adhoc/go-flows/flows/ast.go:511 +0x5eb
github.com/CN-TU/go-flows/flows.(*ast).build(0xc0000bf490)
        /home/rmarkham/Adhoc/go-flows/flows/ast.go:731 +0x86
github.com/CN-TU/go-flows/flows.(*ast).compile(0xc0000bf490, 0x0)
        /home/rmarkham/Adhoc/go-flows/flows/ast.go:974 +0x33d
github.com/CN-TU/go-flows/flows.(*RecordListMaker).AppendRecord(0xc00003fac0, {0xc0001c8200?, 0x0?, 0x0?}, {0x0?, 0x3?, 0xc0000240c0?}, {0x0, 0x0, 0x0}, ...)
        /home/rmarkham/Adhoc/go-flows/flows/record.go:300 +0xbe
main.parseArguments({0x93787e, 0x3}, {0xc0000240c0, 0x8, 0x8})
        /home/rmarkham/Adhoc/go-flows/run.go:307 +0x1148
main.main()
        /home/rmarkham/Adhoc/go-flows/go-flows.go:154 +0x610

go-flows was installed with go version go1.22.1 linux/amd64