fix: whitelist
This commit is contained in:
parent
7cdbab467f
commit
b5e7abfa15
1 changed files with 7 additions and 3 deletions
|
@ -46,14 +46,18 @@ func (sd *SnifferDispatcher) TCPSniff(conn net.Conn, metadata *C.Metadata) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inWhitelist := false
|
||||||
for _, portRange := range *sd.portRanges {
|
for _, portRange := range *sd.portRanges {
|
||||||
if !portRange.Contains(uint16(port)) {
|
if portRange.Contains(uint16(port)) {
|
||||||
return
|
inWhitelist = true
|
||||||
} else {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !inWhitelist {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if host, err := sd.sniffDomain(bufConn, metadata); err != nil {
|
if host, err := sd.sniffDomain(bufConn, metadata); err != nil {
|
||||||
log.Debugln("[Sniffer] All sniffing sniff failed with from [%s:%s] to [%s:%s]", metadata.SrcIP, metadata.SrcPort, metadata.String(), metadata.DstPort)
|
log.Debugln("[Sniffer] All sniffing sniff failed with from [%s:%s] to [%s:%s]", metadata.SrcIP, metadata.SrcPort, metadata.String(), metadata.DstPort)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue