Documentation
¶
Overview ¶
Package ndpspoof is a library for performing NDP spoofing with ICMPv6 router/neighbor advertisement
Index ¶
- Constants
- Variables
- type NDPSpoofConfig
- type NDPSpoofer
- func (nr *NDPSpoofer) GatewayIP() *netip.Addr
- func (nr *NDPSpoofer) GatewayMAC() *net.HardwareAddr
- func (nr *NDPSpoofer) HostIP() *netip.Addr
- func (nr *NDPSpoofer) HostIPGlobal() *netip.Addr
- func (nr *NDPSpoofer) HostMAC() *net.HardwareAddr
- func (nr *NDPSpoofer) Interface() *net.Interface
- func (nr *NDPSpoofer) NeighCache() *NeighCache
- func (nr *NDPSpoofer) Start()
- func (nr *NDPSpoofer) Stop() error
- type NeighCache
- type NeighCacheEntry
Constants ¶
const Version string = "nf v0.0.9"
Variables ¶
var (
AutoConfigSupportedOS = []string{"linux", "android"}
)
Functions ¶
This section is empty.
Types ¶
type NDPSpoofConfig ¶
type NDPSpoofConfig struct {
Targets string
Gateway *netip.Addr
Interface string
FullDuplex bool
Prefix *netip.Prefix
RouterLifetime time.Duration
Logger *zerolog.Logger
RA bool
NA bool
RDNSS string
Debug bool
Auto bool
PacketInterval time.Duration
MTU uint32
PacketQuery string
NoColor bool
}
func NewNDPSpoofConfig ¶
func NewNDPSpoofConfig(s string, logger *zerolog.Logger) (*NDPSpoofConfig, error)
NewNDPSpoofConfig creates NDPSpoofConfig from a list of options separated by semicolon and logger.
Example: "ra true;na true;targets fe80::3a1c:7bff:fe22:91a4,fe80::b6d2:4cff:fe9a:5f10;rdnss 2001:4860:4860::8888;gateway fe80::1;fullduplex false;debug true;interface eth0;prefix 2001:db8:7a31:4400::/64;router_lifetime 30s;auto true;interval 10s;mtu 1500;packet HRD F2 DSDS;nocolor true".
When ra (router advertisement) and na (neighbor advertisement) are both false or not specified, ra set to true.
If na is enabled, at least one target should be provided. The gateway value (or default one) will be used in neighbor advertisement.
For boolean fields value can be specified as 0 or 1.
type NDPSpoofer ¶
type NDPSpoofer struct {
// contains filtered or unexported fields
}
func NewNDPSpoofer ¶
func NewNDPSpoofer(conf *NDPSpoofConfig) (*NDPSpoofer, error)
func (*NDPSpoofer) GatewayIP ¶
func (nr *NDPSpoofer) GatewayIP() *netip.Addr
func (*NDPSpoofer) GatewayMAC ¶
func (nr *NDPSpoofer) GatewayMAC() *net.HardwareAddr
func (*NDPSpoofer) HostIP ¶
func (nr *NDPSpoofer) HostIP() *netip.Addr
func (*NDPSpoofer) HostIPGlobal ¶
func (nr *NDPSpoofer) HostIPGlobal() *netip.Addr
func (*NDPSpoofer) HostMAC ¶
func (nr *NDPSpoofer) HostMAC() *net.HardwareAddr
func (*NDPSpoofer) Interface ¶
func (nr *NDPSpoofer) Interface() *net.Interface
func (*NDPSpoofer) NeighCache ¶
func (nr *NDPSpoofer) NeighCache() *NeighCache
func (*NDPSpoofer) Start ¶
func (nr *NDPSpoofer) Start()
func (*NDPSpoofer) Stop ¶
func (nr *NDPSpoofer) Stop() error
type NeighCache ¶
type NeighCache struct {
sync.RWMutex
Ifname string
Entries map[string]NeighCacheEntry
}
func (*NeighCache) Delete ¶
func (nc *NeighCache) Delete(ip netip.Addr)
func (*NeighCache) Get ¶
func (nc *NeighCache) Get(ip netip.Addr) (NeighCacheEntry, bool)
func (*NeighCache) Refresh ¶
func (nc *NeighCache) Refresh() error
func (*NeighCache) Set ¶
func (nc *NeighCache) Set(ip netip.Addr, nce NeighCacheEntry)
func (*NeighCache) String ¶
func (nc *NeighCache) String() string
type NeighCacheEntry ¶ added in v0.0.9
type NeighCacheEntry struct {
MAC net.HardwareAddr
Vendor string
Domain string
}
func (NeighCacheEntry) String ¶ added in v0.0.9
func (nce NeighCacheEntry) String() string
