From 4679521d9ae49908a2ae649004369e1112d72951 Mon Sep 17 00:00:00 2001 From: onura Date: Thu, 25 Jan 2018 15:51:21 +0300 Subject: [PATCH] fix: Add missing NormalizeMac call while arp_spoof getMac. (ref #10) --- modules/arp_spoof.go | 1 + net/endpoint.go | 4 ++-- net/oui_compiled.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/arp_spoof.go b/modules/arp_spoof.go index 88ce2ce5..1c5b6cb7 100644 --- a/modules/arp_spoof.go +++ b/modules/arp_spoof.go @@ -93,6 +93,7 @@ func (p *ArpSpoofer) getMAC(ip net.IP, probe bool) (net.HardwareAddr, error) { return nil, fmt.Errorf("Could not find hardware address for %s.", ip.String()) } + mac = network.NormalizeMac(mac) hw, err = net.ParseMAC(mac) if err != nil { return nil, fmt.Errorf("Error while parsing hardware address '%s' for %s: %s", mac, ip.String(), err) diff --git a/net/endpoint.go b/net/endpoint.go index 75a6901f..f2a7c776 100644 --- a/net/endpoint.go +++ b/net/endpoint.go @@ -35,7 +35,7 @@ func ip2int(ip net.IP) uint32 { return binary.BigEndian.Uint32(ip) } -func normalizeMac(mac string) string { +func NormalizeMac(mac string) string { parts := strings.Split(mac, ":") for i, p := range parts { if len(p) < 2 { @@ -47,7 +47,7 @@ func normalizeMac(mac string) string { func NewEndpointNoResolve(ip, mac, name string, bits uint32) *Endpoint { addr := net.ParseIP(ip) - mac = normalizeMac(mac) + mac = NormalizeMac(mac) hw, _ := net.ParseMAC(mac) now := time.Now() diff --git a/net/oui_compiled.go b/net/oui_compiled.go index 5f4beb1c..f151b0a2 100644 --- a/net/oui_compiled.go +++ b/net/oui_compiled.go @@ -83,7 +83,7 @@ func netOuiDat() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "net/oui.dat", size: 585353, mode: os.FileMode(420), modTime: time.Unix(1515886539, 0)} + info := bindataFileInfo{name: "net/oui.dat", size: 585353, mode: os.FileMode(420), modTime: time.Unix(1516884015, 0)} a := &asset{bytes: bytes, info: info} return a, nil }