Reputation: 53
ans,uans=srp(Ether(...)/ARP(pdst="x.x.x.x"),...)
for snd,rcv in ans:
return rcv.sprintf(r"%Ether.src%")
Let's say I find the mac address of an IP using the above method. What does r in sprintf() mean and what is returned here? This may be a silly question but I'm not able to find an answer and I'm new to python. That's why I posted it here.
Upvotes: 0
Views: 1975
Reputation: 5421
Have a look at the sprintf
documentation using either help(Packet.sprintf)
or using the online documentation: https://scapy.readthedocs.io/en/latest/api/scapy.packet.html#scapy.packet.Packet.sprintf
sprintf
is a function to format a packet's data in a human readable form.
Upvotes: 0
Reputation: 3920
The r prefix has nothing to do with scapy. r means raw string. This means that backslashes in the string are treated as literal characters. See python docs.
For instance:
>>> print(r'\n')
\n
Upvotes: 2