This commit is contained in:
crusader 2018-09-05 05:57:18 +09:00
parent bf6b3901c2
commit 3135a11708
11 changed files with 36 additions and 12 deletions

View File

@ -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(),
}

View File

@ -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(),
}

View File

@ -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(),
}

View File

@ -72,6 +72,7 @@ SERVICE_LOOP:
Address: ipv4.String(),
Meta: meta,
Zone: discoverySession.Zone(),
DiscoveredBy: "mDNS",
DiscoveredDate: omu.NowPtr(),
})
@ -84,6 +85,8 @@ SERVICE_LOOP:
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(),
})
@ -114,6 +120,8 @@ SERVICE_LOOP:
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(),
})
}
}

View File

@ -144,6 +144,7 @@ func scanV2(target net.IP, discoverySession session.DiscoverySession, credential
Address: target.String(),
Meta: meta,
Zone: discoverySession.Zone(),
DiscoveredBy: "SNMP V2c",
DiscoveredDate: omu.NowPtr(),
})
@ -152,6 +153,8 @@ func scanV2(target net.IP, discoverySession session.DiscoverySession, credential
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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -44,6 +44,7 @@ LOOP:
"UPC": rd.UPC,
},
Zone: discoverySession.Zone(),
DiscoveredBy: "UPnP",
DiscoveredDate: omu.NowPtr(),
})

View File

@ -83,6 +83,7 @@ LOOP:
Key: discoveredMatcher.Key(),
Name: discoveredMatcher.Name(matchCtx),
Meta: matchCtx.GetAttributes(),
DiscoveredBy: "Service Matcher",
DiscoveredDate: omu.NowPtr(),
Port: targetPort,
})