mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 14:03:17 -07:00
new: using wireshark manufacturers file instead of oui.dat (closes #303)
This commit is contained in:
parent
7ef447e726
commit
976465959e
13 changed files with 70433 additions and 45957 deletions
28
network/manuf.go.template
Normal file
28
network/manuf.go.template
Normal 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 ""
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue