Skip to content
Snippets Groups Projects
Commit a57b6ebd authored by Pierre LALET's avatar Pierre LALET
Browse files

Fix crash when an unpriv user builds an Ether() packet without dst set

When an Ether() / IP() packet is built with IP.dst set and Ether.dst
not set, Scapy tries to fix Ether.dst by sending an ARP request. This
fails when the user cannot send packets.

Before:

    >>> p = str(Ether()/IP(dst="1.2.3.4"))
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/scapy/packet.py", line 272, in __str__
        return self.build()
      [...]
      File "/usr/local/lib/python2.7/dist-packages/scapy/arch/linux.py", line 414, in __init__
        self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
      File "/usr/lib/python2.7/socket.py", line 187, in __init__
        _sock = _realsocket(family, type, proto)
    error: [Errno 1] Operation not permitted

After:

    >>> p = str(Ether()/IP(dst="1.2.3.4"))
    WARNING: Mac address to reach destination not found. Using broadcast.
parent 96996823
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment