https://github.com/iesreza/arp
ARP implementation in go
https://github.com/iesreza/arp
arp arp-poisoning arp-request arp-scan arp-spoof-attack arp-spoofing go golang
Last synced: 3 months ago
JSON representation
ARP implementation in go
- Host: GitHub
- URL: https://github.com/iesreza/arp
- Owner: iesreza
- Created: 2019-10-08T13:39:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-17T21:19:04.000Z (about 1 year ago)
- Last Synced: 2025-01-01T16:52:52.166Z (5 months ago)
- Topics: arp, arp-poisoning, arp-request, arp-scan, arp-spoof-attack, arp-spoofing, go, golang
- Language: Go
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ARP Library
This package implements two function of "WhoHas" and "IsAt" functions and also listen for arp packets using pcap.An ARP spoofer has implemented as a test.
```
//Ask who has 192.168.0.1
packetBytes := arp.WhoHas(net.ParseIP("192.168.0.1"))
//Tell to target that 192.168.0.1 is at my desired mac
var fakeDevice := arp.Address{
IP:net.ParseIP("192.168.0.1"),
HardwareAddr : net.ParseMAC("xx:xx:xx:xx:xx")
}
var target := arp.Address{
IP:net.ParseIP("192.168.0.2"),
HardwareAddr : net.ParseMAC("yy:yy:yy:yy:yy")
}
packetBytes = arp.IsAt(fakeDevice,target)
//Listen to incoming arp packets
handler, err := pcap.OpenLive("eth0", 65535, true, pcap.BlockForever)
if err != nil {
log.Fatal(err)
}
defer handler.Close()
arp.Listen(handler, func(srcAddress arp.Address,replyTo arp.Address) {
log.Info("%s is at %s \n",srcAddress.IP.String(),srcAddress.HardwareAddr.String())
}, func(ip net.IP,replyTo arp.Address) {
log.Info("Who has %s? Tell %s \n",ip.String(),replyTo.IP.String())
})
```