Linux command
scapy 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start the interactive scapy
scapy
Start scapy
scapy -d
Start scapy
scapy -c [path/to/startup.py]
Start scapy
scapy -C -P
Start scapy
scapy -H
Send a ping packet
sr1(IP(dst="[8.8.8.8]")/ICMP())
Perform a TCP SYN scan
sr1(IP(dst="[target]")/TCP(dport=[80], flags="S"))
说明
Scapy is a Python-based interactive packet manipulation program and library. It can forge, decode, send, and capture packets for a wide range of network protocols. Scapy uses the Python interpreter as its command interface, allowing full use of Python syntax including variables, loops, and functions. The tool can replace or complement utilities like hping, nmap, arpspoof, arping, tcpdump, and tshark. Unlike traditional tools that reduce responses to simple states like "open" or "closed," Scapy provides access to the complete packet data for detailed analysis. Common functions include send() for layer 3 packets, sendp() for layer 2, sr() for send-receive, sr1() for single response, sniff() for packet capture, and wrpcap()/rdpcap() for PCAP file operations.
参数
- -h
- Display usage information
- -H
- Header-less mode; also reduces verbosity
- -d
- Increase log verbosity; can be used multiple times for more detail
- -s _file_
- Use file to save/load session values (variables, functions, instances)
- -p _prestart_file_
- Use specified file instead of ~/.config/scapy/prestart.py as pre-startup file
- -P
- Do not run the prestart file
- -c _startup_file_
- Use specified file instead of ~/.config/scapy/startup.py as startup file
- -C
- Do not run the startup file
FAQ
What is the scapy command used for?
Scapy is a Python-based interactive packet manipulation program and library. It can forge, decode, send, and capture packets for a wide range of network protocols. Scapy uses the Python interpreter as its command interface, allowing full use of Python syntax including variables, loops, and functions. The tool can replace or complement utilities like hping, nmap, arpspoof, arping, tcpdump, and tshark. Unlike traditional tools that reduce responses to simple states like "open" or "closed," Scapy provides access to the complete packet data for detailed analysis. Common functions include send() for layer 3 packets, sendp() for layer 2, sr() for send-receive, sr1() for single response, sniff() for packet capture, and wrpcap()/rdpcap() for PCAP file operations.
How do I run a basic scapy example?
Run `scapy` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -h do in scapy?
Display usage information