16
Scapy, a packet manipula0on tool Guillaume Valadon RIPE 70 May, 14 2015

Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Scapy,  a  packet  manipula0on  tool  

Guillaume  Valadon  RIPE  70  -­‐  May,  14  2015  

Page 2: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

What  is  Scapy  ?  

•  fast  packet  manipulaAon  in  Python  – send,  receive,  inject,  save,  modify,  ...  

•  default  values  that  work  •  hidden  tricks:  checksum  computaAons,  interface  selecAon,  ...  

•  developped  by  Philippe  Biondi  since  2003  •  maintained  by  Pierre  Lalet  and  Guillaume  Valadon  since  2013  

Page 3: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Scapy  as  a  command  line  tool  

Page 4: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Packet  built  layer  by  layer  (Ether,  IP,  TCP,  ...)  using  the  slash  operator,  such  as:  

 

Page 5: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Scapy  matches  queries  and  replies:  

Page 6: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Some  useful  funcAons,  for  example:  

Page 7: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Scapy  as  a  Python  module  

Page 8: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

A  simple  ping6  with  Scapy:  

Page 9: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Supported  protocols  

•  IP,  IPv6,  UDP,  TCP,  ICMP,  ICMPv6,  ...  •  DNS/DNSSEC,  SNMP,  DHCP,  DHCPv6,  HSRP,  ...  •  RIP,  BGP,  Mobile  IPv6,  ...  

•  contribuAons:  OpenFlow,  MPLS,  HomePlug  AV,  ..  

Page 10: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Adding  a  new  protocol  

Page 11: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Let's  add  a  new  protocol  on  top  of  Ethernet:  

Page 12: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

More  features  are  available  

•  answering  machines  •  automaAon  •  ...    

Page 13: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets
Page 14: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets
Page 15: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

Where  ?  

•  Scapy  works  on  Linux,  *BSD,  MAC  OS  X  –  the  Windows  port  does  not  work  anymore  

•  stable  version:  2.3.1  – pip,  arch,  and  gentoo  

•  development  version  on  bitbucket:  – hg  clone  hbps://bitbucket.org/secdev/scapy/  

Page 16: Guillaume!Valadon! RIPE!70!3!May,!14!2015! · In [41: out[41: query reply srI (query) Received 22 packets got I answers Begin ion Finished to send I packets. remaining O packets

How  can  you  help  ?  

•  tell  that  you  use  Scapy  •  report  issues  on  Bitbucket  •  share  your  protocols  •  invite  use  to  give  tutorials