🔄Update: Lecture-2
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user