new: using wireshark manufacturers file instead of oui.dat (closes #303)

This commit is contained in:
evilsocket 2018-09-09 18:48:41 +03:00
commit 976465959e
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
13 changed files with 70433 additions and 45957 deletions

28
network/manuf.go.template Normal file
View file

@ -0,0 +1,28 @@
package network
import (
"fmt"
"strings"
"math/big"
)
var manuf = #MAP#
func ManufLookup(mac string) string {
macHex := strings.Replace(mac, ":", "", -1)
macInt := new(big.Int)
if _, ok := macInt.SetString(macHex, 16); ok == false {
return ""
}
for mask := uint(0); mask < 48; mask++ {
shifted := new(big.Int).Rsh(macInt, mask)
key := fmt.Sprintf("%d.%s", mask, shifted)
if vendor, found := manuf[key]; found {
return vendor
}
}
return ""
}