mirror of
https://github.com/mukul975/Anthropic-Cybersecurity-Skills.git
synced 2026-06-11 21:54:56 +03:00
27c6414ca5
Complete skill folder anatomy across all cybersecurity skills: - scripts/agent.py: 80-150 line Python agents using real libraries (impacket, boto3, azure-mgmt-*, kubernetes, pefile, yara, scapy, shodan, stix2, etc.) - references/api-reference.md: real API documentation with method signatures - LICENSE: MIT license for all skill folders
62 lines
1.6 KiB
Markdown
62 lines
1.6 KiB
Markdown
# API Reference: Packet Injection Attack
|
|
|
|
## Scapy Python API
|
|
|
|
```python
|
|
from scapy.all import IP, TCP, UDP, ICMP, Raw, sr1, send
|
|
|
|
# Craft and send TCP SYN
|
|
pkt = IP(dst="10.10.20.10") / TCP(dport=80, flags="S")
|
|
resp = sr1(pkt, timeout=2, verbose=0)
|
|
|
|
# Send without waiting for response
|
|
send(pkt, verbose=0)
|
|
|
|
# Fragment a packet
|
|
from scapy.all import fragment
|
|
frags = fragment(IP(dst="10.10.20.10") / ICMP() / Raw(load="X"*65500))
|
|
send(frags, verbose=0)
|
|
```
|
|
|
|
## Scapy Packet Layers
|
|
|
|
| Layer | Fields | Example |
|
|
|-------|--------|---------|
|
|
| `IP` | src, dst, ttl, flags, frag | `IP(dst="10.0.0.1", ttl=64)` |
|
|
| `TCP` | sport, dport, flags, seq, ack | `TCP(dport=80, flags="S")` |
|
|
| `UDP` | sport, dport | `UDP(dport=53)` |
|
|
| `ICMP` | type, code | `ICMP(type=8)` |
|
|
| `DNS` | qd, rd | `DNS(rd=1, qd=DNSQR(qname="test.com"))` |
|
|
|
|
## TCP Flag Values
|
|
|
|
| Flag | Value | Description |
|
|
|------|-------|-------------|
|
|
| S | SYN | Connection initiation |
|
|
| A | ACK | Acknowledgment |
|
|
| F | FIN | Connection termination |
|
|
| R | RST | Connection reset |
|
|
| P | PSH | Push data |
|
|
| U | URG | Urgent pointer |
|
|
|
|
## hping3 CLI
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `hping3 -S -p 80 <target>` | Send SYN packets |
|
|
| `hping3 -S --flood -c 100 <target>` | Limited SYN flood test |
|
|
| `hping3 -S -p 80 -w 0 <target>` | Zero window test |
|
|
|
|
## Python Libraries
|
|
|
|
| Library | Version | Purpose |
|
|
|---------|---------|---------|
|
|
| `scapy` | >=2.5 | Packet crafting, sending, and receiving |
|
|
|
|
## References
|
|
|
|
- Scapy documentation: https://scapy.readthedocs.io/
|
|
- hping3: http://www.hping.org/
|
|
- Nping (Nmap): https://nmap.org/nping/
|
|
- tcpreplay: https://tcpreplay.appneta.com/
|