misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2019-04-21 20:53:27 +02:00
parent cd249687da
commit df8ebd2525
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -113,11 +113,14 @@ func (mod *SynScanner) Author() string {
func (mod *SynScanner) Configure() (err error) {
if mod.Running() {
return session.ErrAlreadyStarted(mod.Name())
} else if mod.handle, err = pcap.OpenLive(mod.Session.Interface.Name(), 65536, true, pcap.BlockForever); err != nil {
}
if mod.handle == nil {
if mod.handle, err = pcap.OpenLive(mod.Session.Interface.Name(), 65536, true, pcap.BlockForever); err != nil {
return err
} else if err = mod.handle.SetBPFFilter(fmt.Sprintf("tcp dst port %d", synSourcePort)); err != nil {
return err
}
}
return nil
}
@ -204,7 +207,6 @@ func (mod *SynScanner) synScan() error {
mod.State.Store("progress", 0.0)
mod.State.Store("scanning", &mod.addresses)
mod.packets <- nil
mod.handle.Close()
})
mod.stats.openPorts = 0