arp

package
v0.0.0-...-0b588c2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REGISTER_NAME = "ARP"
)

Variables

View Source
var ARP_BROADCAST = net.HardwareAddr{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
View Source
var ETH_BROADCAST = net.HardwareAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}

Functions

This section is empty.

Types

type ARPScanResult

type ARPScanResult struct {
	IP     netip.Addr       `json:"ip"`     // 结果IP
	Mac    net.HardwareAddr `json:"mac"`    // 结果物理地址
	Vendor string           `json:"vendor"` // 结果物理地址厂商
}

type ARPScanResults

type ARPScanResults struct {
	Results []*ARPScanResult
}

type ARPScanner

type ARPScanner struct {
	// Deprecated: No longer available.
	Stop    chan struct{}             // ARP 扫描器状态
	Opts    gopacket.SerializeOptions // 包序列化选项
	Timeout time.Duration             // 抓包超时时间
	// Deprecated: Use Ifas instead.
	Ifaces   *[]common.GSInterface                            // 可用接口列表
	Ifas     *[]common.GSIface                                // 可用接口列表
	AHMap    cmap.ConcurrentMap[netip.Addr, net.HardwareAddr] // 获取到的IP <-> Mac 映射表
	OMap     *sync.Map                                        // Mac前缀 <-> 厂商 映射表
	Lock     sync.Mutex
	TargetCh chan *Target
	ResultCh chan *ARPScanResult
}

func GetARPScanner

func GetARPScanner() *ARPScanner

func (*ARPScanner) Close

func (a *ARPScanner) Close()

func (*ARPScanner) GenerateTarget

func (a *ARPScanner) GenerateTarget(timeoutCh chan struct{})

目标生产协程

func (*ARPScanner) Recv

func (a *ARPScanner) Recv()

接收协程

func (*ARPScanner) RecvARP

func (a *ARPScanner) RecvARP(packet gopacket.Packet) interface{}

接收协程

func (*ARPScanner) Scan

func (a *ARPScanner) Scan()

扫描协程

func (*ARPScanner) ScanLocalNet

func (a *ARPScanner) ScanLocalNet() chan struct{}

执行全局域网扫描

func (*ARPScanner) ScanMany

func (a *ARPScanner) ScanMany(ips []netip.Addr) chan struct{}

func (*ARPScanner) ScanPrefix

func (a *ARPScanner) ScanPrefix(prefix netip.Prefix) chan struct{}

func (*ARPScanner) SendARPReq

func (a *ARPScanner) SendARPReq(target *Target)

ARP发包

type Target

type Target struct {
	SrcMac net.HardwareAddr // 发包的源物理地址
	SrcIP  netip.Addr       // 发包的源协议IP
	DstIP  netip.Addr       // 目的IP
	Handle *pcap.Handle     // 发包的具体句柄地址
}

Jump to

Keyboard shortcuts

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