new: syn.scan can now resolve port services too

This commit is contained in:
evilsocket 2019-04-09 10:52:15 +03:00
commit 0b430dd488
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
2 changed files with 563 additions and 2 deletions

View file

@ -10,6 +10,13 @@ import (
"github.com/google/gopacket/layers"
)
type OpenPort struct {
Proto string `json:"proto"`
Banner string `json:"banner"`
Service string `json:"service"`
Port int `json:"port"`
}
func (mod *SynScanner) isAddressInRange(ip net.IP) bool {
for _, a := range mod.addresses {
if a.Equal(ip) {
@ -53,8 +60,16 @@ func (mod *SynScanner) onPacket(pkt gopacket.Packet) {
}
if host != nil {
ports := host.Meta.GetIntsWith("tcp-ports", port, true)
host.Meta.SetInts("tcp-ports", ports)
ports := host.Meta.GetOr("ports", map[int]OpenPort{}).(map[int]OpenPort)
if _, found := ports[port]; !found {
ports[port] = OpenPort{
Proto: "tcp",
Port: port,
Service: network.GetServiceByPort(port, "tcp"),
}
}
host.Meta.Set("ports", ports)
}
NewSynScanEvent(from, host, port).Push()