arpspoof

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: GPL-3.0 Imports: 18 Imported by: 1

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)
  -nocolor
        Disable colored output
  -t string
        Targets for ARP spoofing. Example: "targets 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.1"

Variables

This section is empty.

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
}

func NewARPSpoofConfig

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

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

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". 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]net.HardwareAddr
}

func (*ARPTable) Delete

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

func (*ARPTable) Get

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

func (*ARPTable) Refresh

func (at *ARPTable) Refresh() error

func (*ARPTable) Set

func (at *ARPTable) Set(ip netip.Addr, hw net.HardwareAddr)

func (*ARPTable) String

func (at *ARPTable) 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