mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-10 18:38:22 +00:00
fix matcher generation if both sport and dport are defined
This commit is contained in:
parent
64a449e9b4
commit
25b230e9c2
1 changed files with 8 additions and 2 deletions
|
@ -17,14 +17,20 @@ func GenerateServiceMatcher(service object.Service) string {
|
|||
res = "tcp sport " + service.GetSPort()
|
||||
}
|
||||
if service.GetDPort() != "" {
|
||||
res = res + "tcp dport " + service.GetDPort()
|
||||
if len(res) != 0 {
|
||||
res += " "
|
||||
}
|
||||
res += "tcp dport " + service.GetDPort()
|
||||
}
|
||||
case object.UDP:
|
||||
if service.GetSPort() != "" {
|
||||
res = "udp sport " + service.GetSPort()
|
||||
}
|
||||
if service.GetDPort() != "" {
|
||||
res = res + "udp dport " + service.GetDPort()
|
||||
if len(res) != 0 {
|
||||
res += " "
|
||||
}
|
||||
res += "udp dport " + service.GetDPort()
|
||||
}
|
||||
case object.ICMP:
|
||||
res = "icmp codes " + fmt.Sprint(service.ICMPCode)
|
||||
|
|
Loading…
Add table
Reference in a new issue