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