MCPcopy Create free account
hub / github.com/codeexpress/respounder / checkResponderOnInterface

Function checkResponderOnInterface

respounder.go:129–154  ·  view source on GitHub ↗

Test presence of responder on a given interface

(inf net.Interface)

Source from the content-addressed store, hash-verified

127
128// Test presence of responder on a given interface
129func checkResponderOnInterface(inf net.Interface) map[string]string {
130 var json map[string]string
131 addrs, _ := inf.Addrs()
132 logger.Printf("List of all addresses on interface [%s]: %+v\n",
133 inf.Name, addrs)
134 ip := getValidIPv4Addr(addrs)
135 logger.Printf("Bind IP address for interface %+v is %+v\n",
136 inf.Name, ip)
137
138 if ip != nil {
139 fmt.Fprintf(outFile, "%-10s Sending probe from %s...\t",
140 "["+inf.Name+"]", ip)
141 responderIP := sendLLMNRProbe(ip)
142 if responderIP != "" {
143 fmt.Fprintf(outFile, "responder detected at %s\n", responderIP)
144 json = map[string]string{
145 "interface": inf.Name,
146 "sourceIP": ip.String(),
147 "responderIP": responderIP,
148 }
149 } else {
150 fmt.Fprintln(outFile, "responder not detected")
151 }
152 }
153 return json
154}
155
156// Creates and sends a LLMNR request to the UDP multicast address.
157func sendLLMNRProbe(ip net.IP) string {

Callers 1

mainFunction · 0.85

Calls 2

getValidIPv4AddrFunction · 0.85
sendLLMNRProbeFunction · 0.85

Tested by

no test coverage detected