network enabled verified medium v1.0.0

scapy

Python-based packet crafting and network manipulation framework for packet generation, sniffing, protocol analysis, and network attack development.

📋 Live Preview
python3 {script} {flags}
๐Ÿ“Ž script ๐Ÿ“Ž flags
python3 {script} {flags}

Sandbox: execFile · Timeout: 300s

Capabilities

network.packet.craft
network.sniff.traffic
network.protocol.analyze
network.attack.arp
network.attack.dns
network.attack.dhcp
network.manipulation.ip

Parameters

Name Type Required Default Description Aliases
script string No - Python script file containing Scapy commands -
flag-i string No - Network interface -i, --interface
flag-t string No - Target IP or hostname -t, --target
count integer No - Number of packets to send or capture -c, --count

Artifacts

TypeDescriptionMIMESchemaTrust
network.capture.pcapCaptured network packets in PCAP formatapplication/vnd.tcpdump.pcap-verified
network.analysis.jsonPacket analysis results as JSONapplication/json-verified

Contract

Inputs

network.target.ip

Target IP address for packet destination

network.interface

Network interface to use

network.port.number

Target port number

Outputs

network.capture.pcap

Captured or crafted packet data

network.analysis.json

Protocol analysis results

Side effects: raw_socket_accessnetwork_traffic

Workflow Edges

Produces

network.capture.pcapnetwork.analysis.json

Consumes

network.target.ipnetwork.interfacenetwork.port.number

Resource Profile

ResourceValue
CPUlow
Memory64 MB
Networkmedium
Disk I/Olow

Examples

ICMP ping sweep

python3 -c "from scapy.all import *; sr1(IP(dst=\"10.0.0.1\")/ICMP(), timeout=2)"

TCP SYN scan

python3 -c "from scapy.all import *; sr1(IP(dst=\"10.0.0.1\")/TCP(dport=80, flags=\"S\"), timeout=2)"

ARP scan local network

python3 -c "from scapy.all import *; arp_request = ARP(pdst=\"10.0.0.0/24\"); result = srp(arp_request, timeout=2)[0]; result.summary()"

Sniff traffic on interface

python3 -c "from scapy.all import *; packets = sniff(iface=\"eth0\", count=10); wrpcap(\"capture.pcap\", packets)"

DNS query

python3 -c "from scapy.all import *; sr1(IP(dst=\"8.8.8.8\")/UDP(dport=53)/DNS(rd=1, qd=DNSQR(qname=\"example.com\")), timeout=2)"

Documentation

Scapy โ€” Packet Crafting and Network Manipulation

Scapy is a powerful Python library for packet manipulation, protocol analysis, and network attack development. It can craft arbitrary packets, sniff traffic, perform network scans, and implement custom protocols.

Basic Examples

from scapy.all import *

# TCP SYN scan
ans = sr1(IP(dst="10.0.0.1")/TCP(dport=80, flags="S"), timeout=2)
print(ans.summary())

# ARP request
ans = srp(ARP(pdst="10.0.0.1"), timeout=2)[0]
for req, res in ans:
    print(f"{res.psrc} - {res.hwsrc}")

# Simple packet sniffer
pkts = sniff(filter="tcp port 80", count=10)
wrpcap("http.pcap", pkts)

Common Use Cases

  • Custom packet generation
  • Network scanning and discovery
  • Protocol fuzzing
  • ARP spoofing / MITM
  • DNS manipulation
  • Traffic sniffing and analysis
  • Packet crafting for exploitation

Dependencies

python3

Related Tools

wiresharktcpdumpnmapbettercap

References