ndpspoof

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

README

NDP spoof

Go Reference GitHub go.mod Go version Go Report Card GitHub Release GitHub Downloads (all assets, all releases) GitHub Downloads (all assets, latest release)

Install

CGO_ENABLED=0 go install -ldflags "-s -w" -trimpath github.com/shadowy-pycoder/ndpspoof/cmd/nf@latest

Usage

Usage of nf:
  -I    Display list of interfaces and exit.
  -auto
        Automatically set kernel parameters and network settings for spoofing
  -d    Enable debug logging
  -dns-servers string
        Comma separated list of DNS servers for RDNSS mode. Example: "2001:4860:4860::8888,2606:4700:4700::1111"
  -f    Run NA spoofing in fullduplex mode
  -g string
        IPv6 address of custom gateway (Default: default gateway)
  -i string
        The name of the network interface. Example: eth0 (Default: default interface)
  -na
        Enable NA (neighbor advertisement) spoofing
  -nocolor
        Disable colored output
  -ra
        Enable RA (router advertisement) spoofing. It is enabled when no spoof mode specified)
  -rdnss
        Enable RDNSS spoofing. Enabling this option requires -dns-servers flag
  -rlt duration
        Router lifetime for RA spoofing (default 10m0s)
  -t string
        Targets for NA spoofing. Example: "fe80::3a1c:7bff:fe22:91a4,fe80::b6d2:4cff:fe9a:5f10"
  -v    Show version and build information
Usage as a library

See https://github.com/shadowy-pycoder/go-http-proxy-to-socks

Documentation

Overview

Package ndpspoof is a library for performing NDP spoofing with ICMPv6 router/neighbor advertisement

Index

Constants

View Source
const Version string = "nf v0.0.3"

Variables

View Source
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

type NeighCache struct {
	sync.RWMutex
	Ifname  string
	Entries map[string]net.HardwareAddr
}

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

type Packet

type Packet struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
cmd
nf command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL