mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 04:59:25 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
d54cac6355
commit
28f167285a
1 changed files with 12 additions and 4 deletions
|
@ -144,13 +144,21 @@ func (p *ArpSpoofer) pktRouter(eth *layers.Ethernet, ip4 *layers.IPv4, pkt gopac
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if this packet is from or to one of the spoofing targets
|
||||||
|
// and therefore needs patching and forwarding.
|
||||||
|
doForward := false
|
||||||
for _, target := range p.addresses {
|
for _, target := range p.addresses {
|
||||||
if bytes.Compare(ip4.SrcIP, target) == 0 {
|
if bytes.Compare(ip4.SrcIP, target) == 0 || bytes.Compare(ip4.DstIP, target) == 0 {
|
||||||
// TODO: get real mac && patch
|
doForward = true
|
||||||
} else if bytes.Compare(ip4.DstIP, target) == 0 {
|
break
|
||||||
// TODO: get real mac && patch
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if doForward == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: update mac address either in src or in dst and reinject the packet.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ArpSpoofer) Configure() error {
|
func (p *ArpSpoofer) Configure() error {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue