MCPcopy Create free account
hub / github.com/secdev/scapy / make_reply

Method make_reply

scapy/layers/l2.py:1186–1209  ·  view source on GitHub ↗
(self, req)

Source from the content-addressed store, hash-verified

1184 )
1185
1186 def make_reply(self, req):
1187 # type: (Packet) -> Packet
1188 ether = req[Ether]
1189 arp = req[ARP]
1190
1191 if 'iface' in self.optsend:
1192 iff = cast(Union[NetworkInterface, str], self.optsend.get('iface'))
1193 else:
1194 iff, a, gw = conf.route.route(arp.psrc)
1195 self.iff = iff
1196 if self.ARP_addr is None:
1197 try:
1198 ARP_addr = get_if_hwaddr(iff)
1199 except Exception:
1200 ARP_addr = "00:00:00:00:00:00"
1201 else:
1202 ARP_addr = self.ARP_addr
1203 resp = Ether(dst=ether.src,
1204 src=ARP_addr) / ARP(op="is-at",
1205 hwsrc=ARP_addr,
1206 psrc=arp.pdst,
1207 hwdst=arp.hwsrc,
1208 pdst=arp.psrc)
1209 return resp
1210
1211 def send_reply(self, reply, send_function=None):
1212 # type: (Packet, Any) -> None

Callers

nothing calls this directly

Calls 5

get_if_hwaddrFunction · 0.90
EtherClass · 0.85
ARPClass · 0.85
getMethod · 0.45
routeMethod · 0.45

Tested by

no test coverage detected