forked from broderickhyman/albiondata-client
-
Notifications
You must be signed in to change notification settings - Fork 29
/
net_interface_filter.go
34 lines (30 loc) · 1.26 KB
/
net_interface_filter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package client
import (
"strings"
)
// Mac Address parts to look for, and identify non physical devices. There may be more, update me!
var macAddrPartsToFilter = []string{
"ac:de:48:00:11:22", // Mac OS touchbar (en5)
"00:03:FF", // Microsoft Hyper-V, Virtual Server, Virtual PC
"00:15:5D", // Windows WSL2 or Hyper-V related
"0A:00:27", // VirtualBox
"00:00:00:00:00", // Teredo Tunneling Pseudo-Interface
"00:50:56", // VMware ESX 3, Server, Workstation, Player
"00:1C:14", // VMware ESX 3, Server, Workstation, Player
"00:0C:29", // VMware ESX 3, Server, Workstation, Player
"00:05:69", // VMware ESX 3, Server, Workstation, Player
"00:1C:42", // Microsoft Hyper-V, Virtual Server, Virtual PC
"00:0F:4B", // Virtual Iron 4
"00:16:3E", // Red Hat Xen, Oracle VM, XenSource, Novell Xen
"08:00:27", // Sun xVM VirtualBox
}
// Filters the possible physical interface address by comparing it to known popular VM Software adresses
// and Teredo Tunneling Pseudo-Interface.
func isPhysicalInterface(addr string) bool {
for _, macPart := range macAddrPartsToFilter {
if strings.HasPrefix(strings.ToLower(addr), strings.ToLower(macPart)) {
return false
}
}
return true
}