Merge pull request #1210 from kkrypt0nn/master

fix: `OnPacket` proxy plugin callback signature check
This commit is contained in:
Simone Margaritelli 2025-08-08 16:06:26 +02:00 committed by GitHub
commit a23ba5fcba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 7 deletions

View file

@ -16,15 +16,13 @@ import (
"github.com/evilsocket/islazy/fs" "github.com/evilsocket/islazy/fs"
) )
type hookFunc func(q *nfqueue.Nfqueue, a nfqueue.Attribute) int
type PacketProxy struct { type PacketProxy struct {
session.SessionModule session.SessionModule
chainName string chainName string
rule string rule string
queue *nfqueue.Nfqueue queue *nfqueue.Nfqueue
queueNum int queueNum int
queueCb hookFunc queueCb func(q *nfqueue.Nfqueue, a nfqueue.Attribute) int
pluginPath string pluginPath string
plugin *plugin.Plugin plugin *plugin.Plugin
} }
@ -151,7 +149,7 @@ func (mod *PacketProxy) Configure() (err error) {
return return
} else if sym, err = mod.plugin.Lookup("OnPacket"); err != nil { } else if sym, err = mod.plugin.Lookup("OnPacket"); err != nil {
return return
} else if mod.queueCb, ok = sym.(hookFunc); !ok { } else if mod.queueCb, ok = sym.(func(q *nfqueue.Nfqueue, a nfqueue.Attribute) int); !ok {
return fmt.Errorf("Symbol OnPacket is not a valid callback function.") return fmt.Errorf("Symbol OnPacket is not a valid callback function.")
} }

View file

@ -265,8 +265,8 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
mod.AddHandler(probe) mod.AddHandler(probe)
channelSwitchAnnounce := session.NewModuleHandler("wifi.channel_switch_announce bssid channel ", `wifi\.channel_switch_announce ((?:[a-fA-F0-9:]{11,}))\s+((?:[0-9]+))`, channelSwitchAnnounce := session.NewModuleHandler("wifi.channel_switch_announce BSSID CHANNEL ", `wifi\.channel_switch_announce ((?:[a-fA-F0-9:]{11,}))\s+((?:[0-9]+))`,
"Start a 802.11 channel hop attack, all client will be force to change the channel lead to connection down.", "Start a 802.11 channel hop attack, all client will be forced to change the channel lead to connection down.",
func(args []string) error { func(args []string) error {
bssid, err := net.ParseMAC(args[0]) bssid, err := net.ParseMAC(args[0])
if err != nil { if err != nil {