Documentation
¶
Overview ¶
Package ndpspoof is a library for performing NDP spoofing with ICMPv6 router/neighbor advertisement
Index ¶
- Constants
- Variables
- func NewDNSServer() (net.PacketConn, error)
- 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 Packet
Constants ¶
const Version string = "nf v0.0.3"
Variables ¶
var (
AutoConfigSupportedOS = []string{"linux", "android"}
)
Functions ¶
func NewDNSServer ¶ added in v0.0.3
func NewDNSServer() (net.PacketConn, error)
Types ¶
type NDPSpoofConfig ¶
type NDPSpoofConfig struct {
Targets string
DNSServers string
Gateway *netip.Addr
Interface string
FullDuplex bool
Prefix *netip.Prefix
RouterLifetime time.Duration
Logger *zerolog.Logger
RA bool
NA bool
RDNSS bool
Debug bool
Auto 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;rdnss true;targets fe80::3a1c:7bff:fe22:91a4,fe80::b6d2:4cff:fe9a:5f10;dns 2001:4860:4860::8888;gateway fe80::1;fullduplex false;debug true;interface eth0;prefix 2001:db8:7a31:4400::/64;router_lifetime 30s;auto 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 ¶
func (*NeighCache) Delete ¶
func (nc *NeighCache) Delete(ip netip.Addr)
func (*NeighCache) Get ¶
func (nc *NeighCache) Get(ip netip.Addr) (net.HardwareAddr, bool)
func (*NeighCache) Refresh ¶
func (nc *NeighCache) Refresh() error
func (*NeighCache) Set ¶
func (nc *NeighCache) Set(ip netip.Addr, hw net.HardwareAddr)
func (*NeighCache) String ¶
func (nc *NeighCache) String() string