icmp_spoofer

package
v0.0.0-...-88cdd03 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger4 = fastlog.New("icmp4")
View Source
var Logger6 = fastlog.New("icmp6")
View Source
var (
	RDNSSCLoudflare = &packet.RecursiveDNSServer{
		Lifetime: time.Minute * 10,
		Servers:  []net.IP{packet.DNSv6Cloudflare1.AsSlice(), packet.DNSv6Cloudflare2.AsSlice()},
	}
)

Functions

This section is empty.

Types

type Handler4

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

Handler4 maintains the underlying socket connection

func New4

func New4(engine *packet.Session) (h *Handler4, err error)

New4 creates an ICMPv4 handler

func (*Handler4) Close

func (h *Handler4) Close() error

Close terminates all internal goroutines

func (*Handler4) ProcessPacket

func (h *Handler4) ProcessPacket(frame packet.Frame) error

ProcessPacket parses an ICMP4 packet and log the frame.

This is a simple processor to common ICMP4 packets includin echo request/reply, destination unreacheable and redirect. It does not contain any logic beyond logging.

type Handler6

type Handler6 struct {
	Router     *Router
	LANRouters map[netip.Addr]*Router

	sync.Mutex
	// contains filtered or unexported fields
}

Handler implements ICMPv6 Neighbor Discovery Protocol see: https://mdlayher.com/blog/network-protocol-breakdown-ndp-and-go/

func New6

func New6(session *packet.Session) (*Handler6, error)

New creates an ICMP6 handler

func (*Handler6) Close

func (h *Handler6) Close() error

Close releases underlying resources. The handler is not longer usable after calling Close().

func (*Handler6) FindRouter

func (h *Handler6) FindRouter(ip netip.Addr) Router

func (*Handler6) PingAll

func (h *Handler6) PingAll() error

PingAll sends an echo request to the IPv6 multicast address to encourage hosts to reply.

func (*Handler6) PrintTable

func (h *Handler6) PrintTable()

PrintTable logs ICMP6 tables to standard out

func (*Handler6) ProcessPacket

func (h *Handler6) ProcessPacket(pkt packet.Frame) (err error)

ProcessPacket handles icmp6 packets and executes neighbor advertising spoofing for target LLAs.

func (*Handler6) StartHunt

func (h *Handler6) StartHunt(addr packet.Addr) (packet.HuntStage, error)

StartHunt will actively poison the target IP with fake icmp6 NA to redirect all traffic to us. Poisoning will continue until StopHunt() is called.

The target IP must be a IPv6 LLA or nil. If IP is nil, we use unicast ethernet address but the multicast ip address to get the packet to the target host.

func (*Handler6) StartRADVS

func (h *Handler6) StartRADVS(managed bool, other bool, prefixes []packet.PrefixInformation, rdnss *packet.RecursiveDNSServer) (*RADVS, error)

func (*Handler6) StopHunt

func (h *Handler6) StopHunt(addr packet.Addr) (packet.HuntStage, error)

StopHunt stop poisoning attack for target IP.

type RADVS

type RADVS struct {
	Router *Router
	// contains filtered or unexported fields
}

func (*RADVS) SendRA

func (r *RADVS) SendRA() error

func (*RADVS) Stop

func (r *RADVS) Stop()

type Router

type Router struct {
	Addr packet.Addr

	ManagedFlag     bool // if true, hosts should get IP from DHCP, if false, use SLAAC IP
	OtherCondigFlag bool // if true, hosts should get other info from DHCP
	Preference      byte
	MTU             uint32
	ReacheableTime  int // Must be no greater than 3,600,000 milliseconds (1hour)
	RetransTimer    int //
	CurHopLimit     uint8
	DefaultLifetime time.Duration // A value of zero means the router is not to be used as a default router
	Prefixes        []packet.PrefixInformation
	RDNSS           *packet.RecursiveDNSServer // Pointer to facilitate comparison
	Options         packet.NewOptions
	// contains filtered or unexported fields
}

Router holds a router identification and is useful to implement Router Advertisement Servers.

As of April 22, THIS IS INCOMPLETE and not working yet

func (*Router) String

func (r *Router) String() string

Jump to

Keyboard shortcuts

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