声明:Linux(Ubuntu) 系统 |
package main
import (
"fmt"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/google/gopacket/pcap"
"log"
"net"
"time"
)
devices, err := pcap.FindAllDevs()
if err != nil {
log.Fatal(err)
}
fmt.Println("Devices found:")
index:=1
for _, d := range devices {
fmt.Printf("\n%d———— Name:%s\n", index, d.Name)
fmt.Println("Description: ", d.Description)
fmt.Println("Devices addresses: ", d.Addresses)
index++
for _, address := range d.Ad