SlideShare a Scribd company logo
2
Most read
3
Most read
6
Most read
Null
SecurityXploded
                          Ashwin Patil
Garage4hackers         GCIH, RHCE,CCNA
                  Information Security Enginner
OWASP
Agenda

   Introduction
   Why Scapy ?
   Basic Commands
   Building your first packet
   Assembling full packet
   Write your own Port scanner
   Demo: SYN Scan and IP Spoofing
   Built-in Sniffer Functionality
   Scapy Strengths
   References
Introduction

 Powerful interactive packet manipulation program

 Enable to send, sniff, dissect and forge network packets

 Can manipulate and process packets at every layer of TCP/IP

 Supports wide range of Protocols and adding your own.

 Interactive shell OR Python module

 Today : Interactive shell and TCP/IP
Why Scapy ?

 Flexible unlike other packet crafting tools with limited
  functionalities.

 Little knowledge required to build your own tools

 Single Replacement for Multiple tools such as wireshark, nmap,
  hping etc.

 Build your own tools with Combined Techniques
e.g. VLAN hopping + ARP Cache poisoning

 Any field in every TCP/ IP layer can be altered

 Decode packets ( Received a TCP Reset on port 80),
and not Interprets ( Port 80 is Closed)
Basic Commands
 Scapy Start



 List of Supported Protocols




 Available Commands in Scapy
IP Header




IP Fields in Scapy
TCP Header




TCP Fields in Scapy
Building your first packet



Building packet at IP layer




Building packet at TCP layer
Assembling full packet
Assembling full packet at TCP/IP   Packet ready to send with Calculated values
Write your own port scanner

Port Scanning :
“An attack that sends client requests to a range of server port addresses on a host,
   with the goal of finding an active port”

Result Status :

Open : The host sent a reply indicating that a service is listening on the port.

Closed : The host sent a reply indicating that connections will be denied to the
    port.

Filtered: There was no reply from
the host.
Demo Time




            DEMO
Demo : SYN Scan



SYN Scan: a.k.a. Half Open scanning
Sends : SYN Packet
Response:
SYN, ACK- Open,
RST, ACK – Closed,
No response - Filtered

and if Port is open then doesnt send ACK to complete 3way
   handshake.
Built-in Sniffing Functionality

Sniffing:
”Captures traffic on all or just parts of the network from single
   machine within the network”
Scapy Strengths

 Rogue Router Advertisements with Scapy
http://samsclass.info/ipv6/proj/flood-router6a.htm


 Malicious Content Harvesting with Python, WebKit, and Scapy
http://dvlabs.tippingpoint.com/blog/2011/11/28/malicious-content-harvesting


 DEEPSEC: Extending Scapy by a GSM Air Interface
http://blog.c22.cc/2011/11/17/deepsec-extending-scapy-by-a-gsm-air-interface/


 Use Scapy to test snort rules

And many more …..
References

 Scapy Documentation
ww.secdev.org/projects/scapy/files/scapydoc.pdf
 Nmap port scanning techniques
http://nmap.org/book/man-port-scanning-techniques.html
 http://en.wikipedia.org/wiki/Port_scanner
 http://en.wikipedia.org/wiki/Packet_analyzer


Images:
 http://www.wtcs.org/snmp4tpc/images/IP-Header.jpg
 http://www.wtcs.org/snmp4tpc/images/TCP-Header.jpg
Thank You !!!




Comments ,Feedbacks, Suggestions

Twitter : @ashwinpatil
LinkedIn :
http://in.linkedin.com/in/ashwinrp
Slideshare : ashwin_patil
http://www.slideshare.net/ashwin_patil




                                         Image Credit: http://shirtshovel.com/products/geek/tcpip-434.jpg

More Related Content

PPTX
How TOR works?
PDF
VXLAN BGP EVPN: Technology Building Blocks
PPT
L2_Wireshark.ppt
PPT
Cisco ACL
PPT
Juniper mpls best practice part 1
DOCX
Packet Tracer: Nat protocol
PPTX
Open Shortest Path First
How TOR works?
VXLAN BGP EVPN: Technology Building Blocks
L2_Wireshark.ppt
Cisco ACL
Juniper mpls best practice part 1
Packet Tracer: Nat protocol
Open Shortest Path First

What's hot (20)

PDF
IOS Cisco - Cheat sheets
PDF
mpeg2ts1_es_pes_ps_ts_psi
PDF
Layer-2 VPN
PDF
Kamailio - Large Unified Communication Platforms
PDF
Cisco vs. huawei CLI Commands
PPTX
OSPF Basics
PPT
PPTX
IPv4 addressing and subnetting
PDF
BPF Internals (eBPF)
PDF
Segment Routing Advanced Use Cases - Cisco Live 2016 USA
PDF
IOS Zone based Firewall
PDF
Receive side scaling (RSS) with eBPF in QEMU and virtio-net
PPT
Wireshark Basics
PDF
Hacking With Nmap - Scanning Techniques
PPT
NAT and PAT
PPT
PPTX
Stateful Flow Table - SFT 2020 DPDK users pace summit
ODP
Scanning with nmap
PPT
OSPF Configuration
IOS Cisco - Cheat sheets
mpeg2ts1_es_pes_ps_ts_psi
Layer-2 VPN
Kamailio - Large Unified Communication Platforms
Cisco vs. huawei CLI Commands
OSPF Basics
IPv4 addressing and subnetting
BPF Internals (eBPF)
Segment Routing Advanced Use Cases - Cisco Live 2016 USA
IOS Zone based Firewall
Receive side scaling (RSS) with eBPF in QEMU and virtio-net
Wireshark Basics
Hacking With Nmap - Scanning Techniques
NAT and PAT
Stateful Flow Table - SFT 2020 DPDK users pace summit
Scanning with nmap
OSPF Configuration
Ad

Viewers also liked (14)

PPTX
BSides London - Scapy Workshop
PDF
New Ideas on CAA, CT and Public Key Pinning for a Safer Internet
PPTX
Pentesting custom TLS stacks
PDF
Docker security introduction-task-2016
PPT
Emerging Threats and Strategies of Defense
PDF
Unit 08: Security for Web Applications
PPTX
Seeing Purple: Hybrid Security Teams for the Enterprise - BSides Jackson 2013
PDF
Security Attacks on RSA
PPTX
BSidesLV 2016 - Powershell - Hunting on the Endpoint - Gerritz
PDF
Introduction to Enterprise Architecture and TOGAF 9.1
PPT
Introduction to Cyber Security
PPTX
Webinar: Accelerate Your Cloud Business With CloudHealth
PPTX
Linkedin 101 ppt
PPTX
Who am i powerpoint
BSides London - Scapy Workshop
New Ideas on CAA, CT and Public Key Pinning for a Safer Internet
Pentesting custom TLS stacks
Docker security introduction-task-2016
Emerging Threats and Strategies of Defense
Unit 08: Security for Web Applications
Seeing Purple: Hybrid Security Teams for the Enterprise - BSides Jackson 2013
Security Attacks on RSA
BSidesLV 2016 - Powershell - Hunting on the Endpoint - Gerritz
Introduction to Enterprise Architecture and TOGAF 9.1
Introduction to Cyber Security
Webinar: Accelerate Your Cloud Business With CloudHealth
Linkedin 101 ppt
Who am i powerpoint
Ad

Similar to Scapy talk (20)

PDF
8 Ways Network Engineers use Snabb (RIPE 77)
PDF
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
PDF
Snabb, a toolkit for building user-space network functions (ES.NOG 20)
DOCX
Lab 7 manual.docx Of Information security for students
PPTX
NMAP - The Network Scanner
PPTX
Attacks and their mitigations
PDF
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
PPTX
Hunting for APT in network logs workshop presentation
PPT
Module 3 Scanning
PPT
Port Scanning in computer networks with .ppt
PDF
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
PDF
Node-RED and Minecraft - CamJam September 2015
PPTX
Stupid iptables tricks
PPSX
Node finder presentation
PPT
Week 10 - Packet Sssdssssssssniffers.ppt
PDF
Docker at Flux7
PPTX
Livy: A REST Web Service for Spark
PDF
scapy_pacsec05.pdf
PDF
How to Leverage Go for Your Networking Needs
PDF
SREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
8 Ways Network Engineers use Snabb (RIPE 77)
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
Snabb, a toolkit for building user-space network functions (ES.NOG 20)
Lab 7 manual.docx Of Information security for students
NMAP - The Network Scanner
Attacks and their mitigations
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Hunting for APT in network logs workshop presentation
Module 3 Scanning
Port Scanning in computer networks with .ppt
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
Node-RED and Minecraft - CamJam September 2015
Stupid iptables tricks
Node finder presentation
Week 10 - Packet Sssdssssssssniffers.ppt
Docker at Flux7
Livy: A REST Web Service for Spark
scapy_pacsec05.pdf
How to Leverage Go for Your Networking Needs
SREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite

Recently uploaded (20)

PDF
Architecture types and enterprise applications.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
Modernising the Digital Integration Hub
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
August Patch Tuesday
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Tartificialntelligence_presentation.pptx
PPTX
observCloud-Native Containerability and monitoring.pptx
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
Architecture types and enterprise applications.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Modernising the Digital Integration Hub
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
O2C Customer Invoices to Receipt V15A.pptx
cloud_computing_Infrastucture_as_cloud_p
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
August Patch Tuesday
Zenith AI: Advanced Artificial Intelligence
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
WOOl fibre morphology and structure.pdf for textiles
gpt5_lecture_notes_comprehensive_20250812015547.pdf
NewMind AI Weekly Chronicles – August ’25 Week III
Programs and apps: productivity, graphics, security and other tools
Getting Started with Data Integration: FME Form 101
Tartificialntelligence_presentation.pptx
observCloud-Native Containerability and monitoring.pptx
TLE Review Electricity (Electricity).pptx
1. Introduction to Computer Programming.pptx
NewMind AI Weekly Chronicles - August'25-Week II

Scapy talk

  • 1. Null SecurityXploded Ashwin Patil Garage4hackers GCIH, RHCE,CCNA Information Security Enginner OWASP
  • 2. Agenda  Introduction  Why Scapy ?  Basic Commands  Building your first packet  Assembling full packet  Write your own Port scanner  Demo: SYN Scan and IP Spoofing  Built-in Sniffer Functionality  Scapy Strengths  References
  • 3. Introduction  Powerful interactive packet manipulation program  Enable to send, sniff, dissect and forge network packets  Can manipulate and process packets at every layer of TCP/IP  Supports wide range of Protocols and adding your own.  Interactive shell OR Python module  Today : Interactive shell and TCP/IP
  • 4. Why Scapy ?  Flexible unlike other packet crafting tools with limited functionalities.  Little knowledge required to build your own tools  Single Replacement for Multiple tools such as wireshark, nmap, hping etc.  Build your own tools with Combined Techniques e.g. VLAN hopping + ARP Cache poisoning  Any field in every TCP/ IP layer can be altered  Decode packets ( Received a TCP Reset on port 80), and not Interprets ( Port 80 is Closed)
  • 5. Basic Commands  Scapy Start  List of Supported Protocols  Available Commands in Scapy
  • 8. Building your first packet Building packet at IP layer Building packet at TCP layer
  • 9. Assembling full packet Assembling full packet at TCP/IP Packet ready to send with Calculated values
  • 10. Write your own port scanner Port Scanning : “An attack that sends client requests to a range of server port addresses on a host, with the goal of finding an active port” Result Status : Open : The host sent a reply indicating that a service is listening on the port. Closed : The host sent a reply indicating that connections will be denied to the port. Filtered: There was no reply from the host.
  • 11. Demo Time DEMO
  • 12. Demo : SYN Scan SYN Scan: a.k.a. Half Open scanning Sends : SYN Packet Response: SYN, ACK- Open, RST, ACK – Closed, No response - Filtered and if Port is open then doesnt send ACK to complete 3way handshake.
  • 13. Built-in Sniffing Functionality Sniffing: ”Captures traffic on all or just parts of the network from single machine within the network”
  • 14. Scapy Strengths  Rogue Router Advertisements with Scapy http://samsclass.info/ipv6/proj/flood-router6a.htm  Malicious Content Harvesting with Python, WebKit, and Scapy http://dvlabs.tippingpoint.com/blog/2011/11/28/malicious-content-harvesting  DEEPSEC: Extending Scapy by a GSM Air Interface http://blog.c22.cc/2011/11/17/deepsec-extending-scapy-by-a-gsm-air-interface/  Use Scapy to test snort rules And many more …..
  • 15. References  Scapy Documentation ww.secdev.org/projects/scapy/files/scapydoc.pdf  Nmap port scanning techniques http://nmap.org/book/man-port-scanning-techniques.html  http://en.wikipedia.org/wiki/Port_scanner  http://en.wikipedia.org/wiki/Packet_analyzer Images:  http://www.wtcs.org/snmp4tpc/images/IP-Header.jpg  http://www.wtcs.org/snmp4tpc/images/TCP-Header.jpg
  • 16. Thank You !!! Comments ,Feedbacks, Suggestions Twitter : @ashwinpatil LinkedIn : http://in.linkedin.com/in/ashwinrp Slideshare : ashwin_patil http://www.slideshare.net/ashwin_patil Image Credit: http://shirtshovel.com/products/geek/tcpip-434.jpg