1 <p align="center"> 2 <img src="doc/scapy_logo.png" width=200> 3 </p> 4 5 # Scapy # 6 7 [![Travis Build Status](https://travis-ci.org/secdev/scapy.svg?branch=master)](https://travis-ci.org/secdev/scapy) 8 [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/secdev/scapy?svg=true)](https://ci.appveyor.com/project/secdev/scapy) 9 [![Codecov Status](https://codecov.io/gh/secdev/scapy/branch/master/graph/badge.svg)](https://codecov.io/gh/secdev/scapy) 10 [![PyPI Version](https://img.shields.io/pypi/v/scapy.svg)](https://pypi.python.org/pypi/scapy/) 11 [![Python Versions](https://img.shields.io/pypi/pyversions/scapy.svg)](https://pypi.python.org/pypi/scapy/) 12 [![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](LICENSE) 13 [![Join the chat at https://gitter.im/secdev/scapy](https://badges.gitter.im/secdev/scapy.svg)](https://gitter.im/secdev/scapy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 14 15 16 Scapy is a powerful Python-based interactive packet manipulation program and 17 library. 18 19 It is able to forge or decode packets of a wide number of protocols, send them 20 on the wire, capture them, store or read them using pcap files, match requests 21 and replies, and much more. It is designed to allow fast packet prototyping by 22 using default values that work. 23 24 It can easily handle most classical tasks like scanning, tracerouting, probing, 25 unit tests, attacks or network discovery (it can replace `hping`, 85% of `nmap`, 26 `arpspoof`, `arp-sk`, `arping`, `tcpdump`, `wireshark`, `p0f`, etc.). It also 27 performs very well at a lot of other specific tasks that most other tools can't 28 handle, like sending invalid frames, injecting your own 802.11 frames, combining 29 techniques (VLAN hopping+ARP cache poisoning, VoIP decoding on WEP protected 30 channel, ...), etc. 31 32 Scapy supports Python 2.7 and Python 3 (3.3 to 3.6). It's intended to 33 be cross platform, and runs on many different platforms (Linux, OSX, 34 *BSD, and Windows). 35 36 ## Hands-on ## 37 38 ### Interactive shell ### 39 40 Scapy can easily be used as an interactive shell to interact with the network. 41 The following example shows how to send an ICMP Echo Request message to 42 `github.com`, then display the reply source IP address: 43 44 ```python 45 sudo ./run_scapy 46 Welcome to Scapy 47 >>> p = IP(dst="github.com")/ICMP() 48 >>> r = sr1(p) 49 Begin emission: 50 .Finished to send 1 packets. 51 * 52 Received 2 packets, got 1 answers, remaining 0 packets 53 >>> r[IP].src 54 '192.30.253.113' 55 ``` 56 57 ### Python module ### 58 59 It is straightforward to use Scapy as a regular Python module, for example to 60 check if a TCP port is opened. First, save the following code in a file names 61 `send_tcp_syn.py` 62 63 ```python 64 from scapy.all import * 65 conf.verb = 0 66 67 p = IP(dst="github.com")/TCP() 68 r = sr1(p) 69 print(r.summary()) 70 ``` 71 72 Then, launch the script with: 73 ```python 74 sudo python send_tcp_syn.py 75 IP / TCP 192.30.253.113:http > 192.168.46.10:ftp_data SA / Padding 76 ``` 77 78 ### Resources ### 79 80 To begin with Scapy, you should check [the notebook 81 hands-on](doc/notebooks/Scapy%20in%2015%20minutes.ipynb) and the [interactive 82 tutorial](http://scapy.readthedocs.io/en/latest/usage.html#interactive-tutorial). 83 If you want to learn more, see [the quick demo: an interactive 84 session](http://scapy.readthedocs.io/en/latest/introduction.html#quick-demo) 85 (some examples may be outdated), or play with the 86 [HTTP/2](doc/notebooks/HTTP_2_Tuto.ipynb) and [TLS](doc/notebooks/tls) 87 notebooks. 88 89 The [documentation](http://scapy.readthedocs.io/en/latest/) contains more 90 advanced use cases, and examples. 91 92 ## Installation ## 93 94 Scapy works without any external Python modules on Linux and BSD like operating 95 systems. On Windows, you need to install some mandatory dependencies as 96 described in [the 97 documentation](http://scapy.readthedocs.io/en/latest/installation.html#windows). 98 99 On most systems, using Scapy is as simple as running the following commands: 100 ``` 101 git clone https://github.com/secdev/scapy 102 cd scapy 103 ./run_scapy 104 >>> 105 ``` 106 107 To benefit from all Scapy features, such as plotting, you might want to install 108 Python modules, such as `matplotlib` or `cryptography`. See the 109 [documentation](http://scapy.readthedocs.io/en/latest/installation.html) and 110 follow the instructions to install them. 111 112 ## Contributing ## 113 114 Want to contribute? Great! Please take a few minutes to 115 [read this](CONTRIBUTING.md)! 116