28 lines
543 B
Go
28 lines
543 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"github.com/google/gopacket/pcap"
|
|
)
|
|
|
|
func main() {
|
|
devices, err := pcap.FindAllDevs()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
// Print: Device
|
|
fmt.Println("Device Found: ")
|
|
for _, device := range devices {
|
|
fmt.Println("\n[Name] ", device.Name)
|
|
fmt.Println("[Description] ", device.Description)
|
|
fmt.Println("[Devices addresses] ", device.Description)
|
|
for _, address := range device.Addresses {
|
|
fmt.Println("- IP address", address.IP)
|
|
fmt.Println("- Subnet mask", address.Netmask)
|
|
}
|
|
}
|
|
|
|
}
|