ing
This commit is contained in:
parent
bf6b3901c2
commit
3135a11708
|
@ -135,6 +135,7 @@ func handlePacketARP(zone *omd.Zone, targetHosts []net.IP, hosts map[string]*omd
|
|||
Address: ip.String(),
|
||||
Mac: net.HardwareAddr(packet.SourceHwAddress).String(),
|
||||
Zone: zone,
|
||||
DiscoveredBy: "ARP",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ func handlePacketICMP4(zone *omd.Zone, targetHosts []net.IP, hosts map[string]*o
|
|||
Address: ip.String(),
|
||||
Mac: net.HardwareAddr(ethLayer.SrcMAC).String(),
|
||||
Zone: zone,
|
||||
DiscoveredBy: "ICMP",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
}
|
||||
|
||||
|
|
|
@ -142,6 +142,7 @@ func handlePacketICMP6(zone *omd.Zone, targetHosts []net.IP, hosts map[string]*o
|
|||
Address: ip.String(),
|
||||
Mac: net.HardwareAddr(ethLayer.SrcMAC).String(),
|
||||
Zone: zone,
|
||||
DiscoveredBy: "ICMP",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ SERVICE_LOOP:
|
|||
Address: ipv4.String(),
|
||||
Meta: meta,
|
||||
Zone: discoverySession.Zone(),
|
||||
DiscoveredBy: "mDNS",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
|
||||
|
@ -80,10 +81,12 @@ SERVICE_LOOP:
|
|||
}
|
||||
|
||||
p := discoverySession.AddPort(&omd.Port{
|
||||
MetaPortType: metaPortType,
|
||||
PortNumber: json.Number(strconv.Itoa(port)),
|
||||
Meta: meta,
|
||||
Host: h,
|
||||
MetaPortType: metaPortType,
|
||||
PortNumber: json.Number(strconv.Itoa(port)),
|
||||
Meta: meta,
|
||||
Host: h,
|
||||
DiscoveredBy: "mDNS",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
|
||||
discoverySession.AddService(&omd.Service{
|
||||
|
@ -91,6 +94,8 @@ SERVICE_LOOP:
|
|||
Key: serviceName,
|
||||
Name: name,
|
||||
Port: p,
|
||||
DiscoveredBy: "mDNS",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -102,6 +107,7 @@ SERVICE_LOOP:
|
|||
Address: ipv6.String(),
|
||||
Meta: meta,
|
||||
Zone: discoverySession.Zone(),
|
||||
DiscoveredBy: "mDNS",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
|
||||
|
@ -110,10 +116,12 @@ SERVICE_LOOP:
|
|||
}
|
||||
|
||||
p := discoverySession.AddPort(&omd.Port{
|
||||
MetaPortType: metaPortType,
|
||||
PortNumber: json.Number(strconv.Itoa(port)),
|
||||
Meta: meta,
|
||||
Host: h,
|
||||
MetaPortType: metaPortType,
|
||||
PortNumber: json.Number(strconv.Itoa(port)),
|
||||
Meta: meta,
|
||||
Host: h,
|
||||
DiscoveredBy: "mDNS",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
|
||||
discoverySession.AddService(&omd.Service{
|
||||
|
@ -121,6 +129,8 @@ SERVICE_LOOP:
|
|||
Key: serviceName,
|
||||
Name: name,
|
||||
Port: p,
|
||||
DiscoveredBy: "mDNS",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,14 +144,17 @@ func scanV2(target net.IP, discoverySession session.DiscoverySession, credential
|
|||
Address: target.String(),
|
||||
Meta: meta,
|
||||
Zone: discoverySession.Zone(),
|
||||
DiscoveredBy: "SNMP V2c",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
|
||||
p := discoverySession.AddPort(&omd.Port{
|
||||
MetaPortType: omm.ToMetaPortType(omm.MetaPortTypeEnumUDP),
|
||||
PortNumber: credential.Port,
|
||||
Meta: meta,
|
||||
Host: h,
|
||||
MetaPortType: omm.ToMetaPortType(omm.MetaPortTypeEnumUDP),
|
||||
PortNumber: credential.Port,
|
||||
Meta: meta,
|
||||
Host: h,
|
||||
DiscoveredBy: "SNMP V2c",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
|
||||
discoverySession.AddService(&omd.Service{
|
||||
|
@ -159,6 +162,8 @@ func scanV2(target net.IP, discoverySession session.DiscoverySession, credential
|
|||
Key: "SNMP",
|
||||
Name: "SNMP V2c",
|
||||
Port: p,
|
||||
DiscoveredBy: "SNMP V2c",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
|
||||
// log.Printf("Host: %v, Port: %v, Service: %v", h, p, s)
|
||||
|
|
|
@ -96,6 +96,7 @@ func tryConnect(discoverySession session.DiscoverySession, ports map[int]*omd.Po
|
|||
p := &omd.Port{
|
||||
MetaPortType: omm.ToMetaPortType(omm.MetaPortTypeEnumTCP),
|
||||
PortNumber: json.Number(strconv.Itoa(port)),
|
||||
DiscoveredBy: "TCP Connection",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
}
|
||||
p.Host = targetHost
|
||||
|
|
|
@ -132,6 +132,7 @@ func handlePacketTCP4(discoverySession session.DiscoverySession, host *omd.Host,
|
|||
p := &omd.Port{
|
||||
MetaPortType: omm.ToMetaPortType(omm.MetaPortTypeEnumTCP),
|
||||
PortNumber: json.Number(strconv.Itoa(port)),
|
||||
DiscoveredBy: "TCP SYN",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
}
|
||||
p.Host = host
|
||||
|
|
|
@ -96,6 +96,7 @@ func tryConnect(discoverySession session.DiscoverySession, ports map[int]*omd.Po
|
|||
p := &omd.Port{
|
||||
MetaPortType: omm.ToMetaPortType(omm.MetaPortTypeEnumTCP),
|
||||
PortNumber: json.Number(strconv.Itoa(port)),
|
||||
DiscoveredBy: "UDP Connection",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
}
|
||||
p.Host = targetHost
|
||||
|
|
|
@ -149,6 +149,7 @@ func handlePacketUDP4(discoverySession session.DiscoverySession, host *omd.Host,
|
|||
MetaPortType: omm.ToMetaPortType(omm.MetaPortTypeEnumUDP),
|
||||
PortNumber: json.Number(strconv.Itoa(port)),
|
||||
UDPLayer: udpLayer,
|
||||
DiscoveredBy: "UDP Matcher",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
}
|
||||
p.Host = host
|
||||
|
|
|
@ -44,6 +44,7 @@ LOOP:
|
|||
"UPC": rd.UPC,
|
||||
},
|
||||
Zone: discoverySession.Zone(),
|
||||
DiscoveredBy: "UPnP",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
})
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ LOOP:
|
|||
Key: discoveredMatcher.Key(),
|
||||
Name: discoveredMatcher.Name(matchCtx),
|
||||
Meta: matchCtx.GetAttributes(),
|
||||
DiscoveredBy: "Service Matcher",
|
||||
DiscoveredDate: omu.NowPtr(),
|
||||
Port: targetPort,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user