mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
b8d9179def
commit
30d9415d8c
5 changed files with 25 additions and 24 deletions
|
@ -46,6 +46,12 @@ func (mod *SynScanner) onPacket(pkt gopacket.Packet) {
|
|||
from := ip.SrcIP.String()
|
||||
port := int(tcp.SrcPort)
|
||||
|
||||
openPort := &OpenPort{
|
||||
Proto: "tcp",
|
||||
Port: port,
|
||||
Service: network.GetServiceByPort(port, "tcp"),
|
||||
}
|
||||
|
||||
var host *network.Endpoint
|
||||
if ip.SrcIP.Equal(mod.Session.Interface.IP) {
|
||||
host = mod.Session.Interface
|
||||
|
@ -58,20 +64,13 @@ func (mod *SynScanner) onPacket(pkt gopacket.Packet) {
|
|||
if host != nil {
|
||||
ports := host.Meta.GetOr("ports", map[int]*OpenPort{}).(map[int]*OpenPort)
|
||||
if _, found := ports[port]; !found {
|
||||
openPort := &OpenPort{
|
||||
Proto: "tcp",
|
||||
Port: port,
|
||||
Service: network.GetServiceByPort(port, "tcp"),
|
||||
}
|
||||
|
||||
ports[port] = openPort
|
||||
|
||||
mod.bannerQueue.Add(async.Job(grabberJob{host, openPort}))
|
||||
}
|
||||
|
||||
host.Meta.Set("ports", ports)
|
||||
}
|
||||
|
||||
mod.bannerQueue.Add(async.Job(grabberJob{from, openPort}))
|
||||
|
||||
NewSynScanEvent(from, host, port).Push()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue