pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/55446 (scapy function send() does not work)



On 07/15/20 05:25, David H. Gutteridge wrote:
> The following reply was made to PR pkg/55446; it has been noted by GNATS.
>
> From: "David H. Gutteridge" <david%gutteridge.ca@localhost>
> To: gnats-bugs%netbsd.org@localhost
> Cc: 
> Subject: Re: pkg/55446 (scapy function send() does not work)
> Date: Tue, 14 Jul 2020 22:22:45 -0400
>
>  On Fri, 2020-07-10 at 23:43 +0300, tmp%bh0.amt.ru@localhost wrote:
>  > On 07/10/20 23:35, tmp%bh0.amt.ru@localhost wrote:
>  > >  On 07/06/20 01:25, David H. Gutteridge wrote:
>  > >  >  I hadn't had occasion to try interacting with a loopback device with
>  > >  >  Scapy before, but I borrowed that example from the Scapy test suite
>  > >  >  (where it recorded a pass for me on NetBSD 8.1 when I ran it while
>  > >  >  doing the last package update), but, the difference is, their test
>  > >  >  example targets the IP address "8.8.8.8".
>  > >  
>  > >  I tried "8.8.8.8", the result was:
>  [...]                                
>  > >  >>> sendp(IP(dst="8.8.8.8")/ICMP()/"test"
>  > >  ... help
>  > >    File "<console>", line 2
>  > >      help
>  > >         ^
>  > >  SyntaxError: invalid syntax
>  > >  >>> 
>  > 
>  > I'm sorry for the mistake, the right output is:
>  > 
>  > > > > send(IP(dst="8.8.8.8")/ICMP()/"test"
>  > ... help
>  >   File "<console>", line 2
>  >     help
>  >        ^
>  > SyntaxError: invalid syntax
>  > >  I realized that something went wrong.
>  
>  I think you're missing a closing bracket in those examples?

Yes, I'm sorry, the right output is:

# scapy
INFO: Can't import matplotlib. Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
INFO: No IPv6 support in kernel
WARNING: No route found for IPv6 destination :: (no default route?)
INFO: Can't import python-cryptography v1.7+. Disabled WEP decryption/encryption. (Dot11)
INFO: Can't import python-cryptography v1.7+. Disabled IPsec encryption/authentication.
WARNING: IPython not available. Using standard Python shell instead.
AutoCompletion, History are disabled.
                                      
                     aSPY//YASa       
             apyyyyCY//////////YCa       |
            sY//////YSpcs  scpCY//Pp     | Welcome to Scapy
 ayp ayyyyyyySCP//Pp           syY//C    | Version git-archive.dev304758016
 AYAsAYYYYYYYY///Ps              cY//S   |
         pCCCCY//p          cSSps y//Y   | https://github.com/secdev/scapy
         SPPPP///a          pP///AC//Y   |
              A//A            cyP////C   | Have fun!
              p///Ac            sC///a   |
              P////YCpc           A//A   | To craft a packet, you have to be a
       scccccp///pSP///p          p//Y   | packet, and learn how to swim in
      sY/////////y  caa           S//P   | the wires and in the waves.
       cayCyayP//Ya              pY/Ya   |        -- Jean-Claude Van Damme
        sY/PsY////YCc          aC//Yp    |
         sc  sccaCY//PCypaapyCP//YSs  
                  spCPY//////YPSps    
                       ccaacs         
                                      
>>> send(IP(dst="8.8.8.8")/ICMP()/"test")
ERROR: --- Error sending packets
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.7/site-packages/scapy/sendrecv.py", line 197, in _sndrcv_snd
    self.pks.send(p)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/arch/bpf/supersocket.py", line 317, in send
    return os.write(self.outs, raw(x))
OSError: [Errno 47] Address family not supported by protocol family
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING: Could not get the source MAC: No MAC address found on tun4 !
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/pkg/lib/python3.7/site-packages/scapy/sendrecv.py", line 319, in send
    realtime=realtime, return_packets=return_packets)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/sendrecv.py", line 291, in __gen_send
    s.send(p)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/arch/bpf/supersocket.py", line 362, in send
    L2bpfSocket.send(self, frame)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/arch/bpf/supersocket.py", line 317, in send
    return os.write(self.outs, raw(x))
OSError: [Errno 47] Address family not supported by protocol family
>>> 

>  Taking Scapy's ICMP test cases "Sending an ICMP message at layer 2 and
>  layer 3" from their test/regression.uts (lines 1337-1344) and running
>  them manually (without any prior explicit configration of any kind) on
>  8.2_STABLE/amd64, I get something different:
>  
>  >>> send(IP(dst="8.8.8.8")/ICMP(), return_packets=True, realtime=True)
>  WARNING: Mac address to reach destination not found. Using broadcast.
>  .
>  Sent 1 packets.
>  <PacketList: TCP:0 UDP:0 ICMP:1 Other:0>

My output is:

>>> send(IP(dst="8.8.8.8")/ICMP(), return_packets=True, realtime=True)
ERROR: --- Error sending packets
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.7/site-packages/scapy/sendrecv.py", line 197, in _sndrcv_snd
    self.pks.send(p)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/arch/bpf/supersocket.py", line 317, in send
    return os.write(self.outs, raw(x))
OSError: [Errno 47] Address family not supported by protocol family
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING: Could not get the source MAC: No MAC address found on tun4 !
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/pkg/lib/python3.7/site-packages/scapy/sendrecv.py", line 319, in send
    realtime=realtime, return_packets=return_packets)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/sendrecv.py", line 291, in __gen_send
    s.send(p)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/arch/bpf/supersocket.py", line 362, in send
    L2bpfSocket.send(self, frame)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/arch/bpf/supersocket.py", line 317, in send
    return os.write(self.outs, raw(x))
OSError: [Errno 47] Address family not supported by protocol family
>>> 


>  >>> sendp(Ether()/IP(dst="8.8.8.8")/ICMP(), return_packets=True,
>  realtime=True)
>  WARNING: Mac address to reach destination not found. Using broadcast.
>  .
>  Sent 1 packets.
>  <PacketList: TCP:0 UDP:0 ICMP:1 Other:0>
>  >>> 
>  
>  (In my case, I have a wired wm0 active.)

My output is:

>>> sendp(Ether()/IP(dst="8.8.8.8")/ICMP(), return_packets=True, realtime=True)
ERROR: --- Error sending packets
Traceback (most recent call last):
  File "/usr/pkg/lib/python3.7/site-packages/scapy/sendrecv.py", line 197, in _sndrcv_snd
    self.pks.send(p)
  File "/usr/pkg/lib/python3.7/site-packages/scapy/arch/bpf/supersocket.py", line 317, in send
    return os.write(self.outs, raw(x))
OSError: [Errno 47] Address family not supported by protocol family
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING: Could not get the source MAC: No MAC address found on tun4 !


Home | Main Index | Thread Index | Old Index