Home Hacking Tools Packet Manipulation With Scapy

Packet Manipulation With Scapy

653
0

Packet Manipulation With Scapy

Scapy is written in Python by Philippe Biondi. It is used for packet manipulation With Scapy in networks.  Scapy can forge or decode packets, send them on the wire, catch them, and match requests and replies. It can likewise deal with errands like scanning, tracerouting, probing, unit tests, attacks, and network discovery.

Scapy
Scapy banner

 

Features of Scapy:

  • Packet Manipulation
  • Packet Capture
  • Match Requests and Replies
  • Scanning
  • Tracerouting
  • Probing
  • Attacks
  • Network Discovery
How to install Scapy?

Step 1: Clone the repository

  Scapy Clone the repository
cloning the repository from github

git clone https://github.com/secdev/scapy

Step 2: Change the directory

Scapy Change the directory
Change the directory

cd scapy/

Step 3: Run the “run_scapy”

Scapy Run the “run_scapy”
run the installer file run_scapy

./run_scapy

How to install Scapy with pip?

How to install Scapy with pip?
scapy installation by pip

pip install scapy

 

How to packet manipulation with Scapy?

Send Packet 

send(): Send packets at Layer 3
IP(): Define Source IP and Destination IP
ICMP(): Internet Control Message Protocol
src: Source IP
dst: Destination IP

Syntax
send(IP(src=”Source IP”,dst=”Destination IP”)/ICMP()/”Text”)

Send Packet with scapy
Send Packet with scapy

Example:
send(IP(src=”192.168.1.2″,dst=”192.168.1.1 “)/ICMP()/”Hello World”)

Check response in Wireshark:

packets show on wireshark
packets show on wireshark
haxdump of packet
haxdump of packet

Sniff Packet

Iface: Name of interface
prn: function to apply to each packet
lambda: we can now perform custom actions with each sniffed packet.
X: variable
x.summary: Print the summary of the output

Syntax
sniff(iface=”Interface”, prn=lambda x:x.summary)

Example
sniff(iface=”wlan0″, prn=lambda x:x.summary)

sniff packets
sniff packets with scapy

Output:

Sniff Packet output
output of Sniff Packet

 

 

Send multiple packet
TCP: Transmission Control Protocol
sport: Source port
dport: Destination port
count: number of packets

Syntax
send(IP(src=”Source IP”,dst=”Destination IP”)/TCP(sport=Source port, dport=Destination port), count=number of packets)

Example
send(IP(src=”192.168.1.2″,dst=”192.168.1.1″)/TCP(sport=80, dport=80), count=10)

sending multiple packets with scapy
sending multiple packets with scapy

Check response in Wireshark:

Check response in Wireshark
Check response in Wireshark of sending packets

Home: – https://scapy.net/

You May Also Like To Read

How to protect yourself from hackers 2021

Joint Cyber program UK | US and Australia Press Release

Nuclei Vulnerability Scanner tools | fast and customizable

 

Previous articleCandiru’s Spyware Project Proposal Leaked
Next articleWhat is Machine learning And what Type Of Machine learning

LEAVE A REPLY

Please enter your comment!
Please enter your name here