diff --git a/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go b/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go index 639942e6869..aa1d10e222f 100644 --- a/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go +++ b/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go @@ -65,15 +65,13 @@ TODO: document me if !noFilter { switch protocolType { case "bacnet": - bacnetFilter, err := cmd.Flags().GetString("default-bacnet-filter") - if err != nil { - log.Fatal().Err(err).Msg("could not get default-bacnet-filter argument") - } - if bacnetFilter != "" { - filter = bacnetFilter + if filter != "" && bacnetFilter != "" { log.Debug().Str("filter", filter).Msg("Setting bacnet filter") + filter = bacnetFilter } } + } else { + log.Info().Msg("All filtering disabled") } analyzer.Analyze(pcapFile, protocolType, filter, onlyParse, noBytesCompare) }, @@ -84,6 +82,8 @@ func init() { analyzeCmd.Flags().StringVarP(&filter, "filter", "f", "", "BFF filter to apply") analyzeCmd.Flags().BoolVarP(&noFilter, "no-filter", "n", false, "disable filter") + analyzeCmd.Flags().BoolVarP(&onlyParse, "onlyParse", "o", false, "only parse messaged") + analyzeCmd.Flags().BoolVarP(&noBytesCompare, "noBytesCompare", "c", false, "don't compare original bytes with serialized bytes") analyzeCmd.PersistentFlags().StringVarP(&bacnetFilter, "default-bacnet-filter", "", "udp port 47808 and udp[4:2] > 29", "Defines the default filter when bacnet is selected") // TODO: support other protocols } diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go index f454f6afbaa..83d80ffaa19 100644 --- a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go +++ b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go @@ -33,8 +33,9 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo log.Info().Msgf("Analyzing pcap file '%s' with protocolType '%s' and filter '%s' now", pcapFile, protocolType, filter) handle, numberOfPackage, timestampToIndexMap := pcaphandler.GetIndexedPcapHandle(pcapFile, filter) + log.Info().Msgf("Starting to analyze %d packages", numberOfPackage) defer handle.Close() - log.Debug().Interface("handle", handle).Int("numberOfPackage", numberOfPackage).Interface("timestampToIndexMap", timestampToIndexMap).Msg("got handle") + log.Debug().Interface("handle", handle).Int("numberOfPackage", numberOfPackage).Msg("got handle") source := pcaphandler.GetPacketSource(handle) var packageParse func(string, []byte) (interface{}, error) var serializePackage func(interface{}) ([]byte, error)