arpspoof

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: GPL-3.0 Imports: 20 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ARP 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/arpspoof/cmd/af@latest

Usage

af -h
Usage of af:
  -I    Display list of interfaces and exit.
  -d    Enable debug logging
  -f    Run ARP spoofing in fullduplex mode
  -g string
        IPv4 address of custom gateway (Default: default gateway)
  -i string
        The name of the network interface. Example: eth0 (Default: default interface)
  -interval duration
        Interval between sent packets (default 5s)
  -n string
        The name or path of network namespace (Linux/Android) (Default: default namespace)
  -nocolor
        Disable colored output
  -t string
        Targets for ARP spoofing. Example: "10.0.0.1,10.0.0.5-10,192.168.1.*,192.168.10.0/24" (Default: entire subnet)
Usage as a library

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

Documentation

Overview

Package arpspoof This package uses https://github.com/bettercap/bettercap/tree/master/modules/arp_spoof as a reference implementation Issued under GPLv3 license https://www.gnu.org/licenses/gpl-3.0.en.html

Index

Constants

View Source
const Version string = "arpspoof v0.0.8"

Variables

View Source
var (
	FeatureSupportedOS = []string{"linux", "android"}
)

Functions

This section is empty.

Types

type ARPSpoofConfig

type ARPSpoofConfig struct {
	Targets        string
	Gateway        *netip.Addr
	Interface      string
	FullDuplex     bool
	Logger         *zerolog.Logger
	Debug          bool
	PacketInterval time.Duration
	NetNS          string
}

func NewARPSpoofConfig

func NewARPSpoofConfig(s string, logger *zerolog.Logger) (*ARPSpoofConfig, error)

NewARPSpoofConfig creates ARPSpoofConfig from logger and a list of options separated by semicolon.

Example: "targets 10.0.0.1,10.0.0.5-10,192.168.1.*,192.168.10.0/24;fullduplex false;debug true;interface eth0;gateway 192.168.1.1;interval 10s;netns ns1". All fields in configuration string are optional.

type ARPSpoofer

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

func NewARPSpoofer

func NewARPSpoofer(conf *ARPSpoofConfig) (*ARPSpoofer, error)

func (*ARPSpoofer) ARPTable

func (ar *ARPSpoofer) ARPTable() *ARPTable

func (*ARPSpoofer) GatewayIP

func (ar *ARPSpoofer) GatewayIP() netip.Addr

func (*ARPSpoofer) GatewayMAC

func (ar *ARPSpoofer) GatewayMAC() net.HardwareAddr

func (*ARPSpoofer) HostIP

func (ar *ARPSpoofer) HostIP() netip.Addr

func (*ARPSpoofer) HostMAC

func (ar *ARPSpoofer) HostMAC() net.HardwareAddr

func (*ARPSpoofer) Interface

func (ar *ARPSpoofer) Interface() *net.Interface

func (*ARPSpoofer) Start

func (ar *ARPSpoofer) Start()

func (*ARPSpoofer) Stop

func (ar *ARPSpoofer) Stop() error

type ARPTable

type ARPTable struct {
	sync.RWMutex
	Ifname  string
	Entries map[string]ARPTableEntry
}

func (*ARPTable) Delete

func (at *ARPTable) Delete(ip netip.Addr)

func (*ARPTable) Get

func (at *ARPTable) Get(ip netip.Addr) (ARPTableEntry, bool)

func (*ARPTable) Refresh

func (at *ARPTable) Refresh(resolve bool) error

func (*ARPTable) Set

func (at *ARPTable) Set(ip netip.Addr, ate ARPTableEntry)

func (*ARPTable) String

func (at *ARPTable) String() string

type ARPTableEntry added in v0.0.4

type ARPTableEntry struct {
	MAC    net.HardwareAddr
	Vendor string
	Domain string
}

func (ARPTableEntry) String added in v0.0.4

func (ate ARPTableEntry) String() string

type Packet

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

Directories

Path Synopsis
cmd
af command

Jump to

Keyboard shortcuts

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