mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
new: implemented can.filter
This commit is contained in:
parent
e45c9cc053
commit
d9a91d393e
4 changed files with 107 additions and 112 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"net"
|
||||
|
||||
"github.com/bettercap/bettercap/v2/session"
|
||||
"github.com/hashicorp/go-bexpr"
|
||||
"go.einride.tech/can/pkg/descriptor"
|
||||
"go.einride.tech/can/pkg/socketcan"
|
||||
)
|
||||
|
@ -14,6 +15,8 @@ type CANModule struct {
|
|||
|
||||
deviceName string
|
||||
transport string
|
||||
filter string
|
||||
filterExpr *bexpr.Evaluator
|
||||
dbcPath string
|
||||
dbc *descriptor.Database
|
||||
|
||||
|
@ -26,6 +29,8 @@ func NewCanModule(s *session.Session) *CANModule {
|
|||
mod := &CANModule{
|
||||
SessionModule: session.NewSessionModule("can", s),
|
||||
dbcPath: "",
|
||||
filter: "",
|
||||
filterExpr: nil,
|
||||
transport: "can",
|
||||
deviceName: "can0",
|
||||
}
|
||||
|
@ -45,6 +50,11 @@ func NewCanModule(s *session.Session) *CANModule {
|
|||
"",
|
||||
"Optional path to DBC file for decoding."))
|
||||
|
||||
mod.AddParam(session.NewStringParameter("can.filter",
|
||||
"",
|
||||
"",
|
||||
"Optional boolean expression to select frames to report."))
|
||||
|
||||
mod.AddHandler(session.NewModuleHandler("can.recon on", "",
|
||||
"Start CAN-bus discovery.",
|
||||
func(args []string) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue