Scapy - Packet Manipulation in Kali Linux - GeeksforGeeks

15 Apr, 2021
Scapy is a free and open-source tool available on Github. Scapy is written in Python language. Scapy is used for packet manipulation programs. Scapy tool forges the data packet that is coming from a source. Scapy decodes data packets and captures them. This tool reads packets using pcap files, and then it matches the request and replies. Scapy tool also performs scannings such as trace-routing, unit tests, You can also perform nmap scanning using scapy tool. 
This tool also performs very well at a lot of other specific tasks that most other tools can’t handle, like sending invalid frames, VLAN hopping+ARP cache poisoning, VoIP decoding on WEP protected channel can be performed by scapy tool. As this tool is written in Python language that’s why scapy tool supports Python2.7 Python 3 (3.4 to 3.7). This tool is a multi-platform tool this is available for Windows, Linux OSX, *BSD operating systems.
 Scapy tool can be used as a shell to interact with incoming traffic and outgoing traffic of the network. To use scapy tool you don’t need to install any external Python module on Linux and BSD like operating systems you just need to install some dependencies as described in the documentation of the tool.
Features of scapy:
Scapy is a free and open-source tool that is available on Github.
Scapy is written in Python language.
Using Scapy network can be manipulated easily.
Scapy can decode data packets and can capture them.
Scapy tool can be used as a shell to interact with incoming traffic and outgoing traffic of the network.
Scapy can work with built-in modules you don’t need any external module to work.
Scapy can be used for trace-routing with built-in modules.
Uses of Scapy:
Scapy is used for packet manipulation programs.
Scapy tool forges the data packet that is coming from a source.
Scapy decodes data packets and captures them.
Scapy tool can be used as a shell to interact with incoming traffic and outgoing traffic of the network.
VoIP decoding on WEP-protected channels can be performed by scapy tool.
You can use Scapy tool on any operating system it’s available for all operating systems.
Linux’s users can clone the tool from this link. It’s a free and open-source tool available on GitHub, Linux users can download it freely.
Step 1. Open your Kali Linux. And move to the desktop using the following command.
cd Desktop
Step 2. Now you are on the desktop. Create a new directory here on the desktop because you have to install the scapy tool here. Create a new directory using the following command.
 mkdir scapy
Step 3. A new directory has been created. Now move to this directory using the following command.
cd scapy
Step 4. Now you are in scapy directory here you have to clone the tool from GitHub. Use the following command to clone the tool in this directory.
git clone https://github.com/secdev/scapy
Step 5. Scapy tool has been downloaded into your Kali linux. Now to list out the contents of this tool use the following command.
ls
Step 6. As you listed out the contents of the tool you found the directory that has been downloaded with the tool. Move to this directory using the following command.
cd scapy
Step 7. On this step you have to list out the contents of the directory using the following command.
ls
Step 8. You can see the files of tool, License of tool etc, Now to run the tool use the following command.
./run_scapy
This is the first interface of the tool. The tool is running now. All the installation process has been done. Now it’s time to see some examples of the tool.
Example 1. Show the configuration of the tool and show the details of packets.
To show the configuration of the tool use the following command. This command not only shows the configurations but also shows the packets that are coming from a source.
conf
Example 2. Show the routing table of networks.
The following command will show the route table. You can add and delete data in this table as per your requirements. Use following command for routing.
conf.route
Example 3. List out all the commands of scapy tool that you can use with the tool.
To know all the commands of the tool use the following command.
lsc()
Kali-Linux
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Thread functions in C/C++
mv command in Linux with examples
nohup Command in Linux with Examples
scp command in Linux with Examples
Docker - COPY Instruction
chown command in Linux with Examples
nslookup command in Linux with Examples
SED command in Linux | Set 2
Named Pipe or FIFO with example C program
uniq Command in LINUX with examples