mcpField
A
analyzing-network-packets-with-scapy

analyzing-network-packets-with-scapy

github.com/mukul975Security35.2k443 installsUpdated 8w ago
Repository

About analyzing-network-packets-with-scapy

A security-analysis skill for using Scapy to inspect and craft network packets. It serves incident responders and SOC analysts with workflows for pcap analysis, traffic statistics, anomaly detection, and authorized packet testing.

Key features

  1. 01Offline pcap and pcapng parsing
  2. 02Protocol-layer and field extraction
  3. 03Traffic and port statistics
  4. 04SYN flood and DNS anomaly detection
  5. 05Custom probe packet crafting
  6. 06Structured JSON reporting

Use cases

  1. 01Investigating packet captures during incidents
  2. 02Identifying SYN floods or DNS exfiltration indicators
  3. 03Testing networks with authorized custom probes

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-network-packets-with-scapy

After installing, type/analyzing-network-packets-with-scapyin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

LICENSE
references/
api-reference.md
scripts/
agent.py

Details

From the project README

Analyzing Network Packets with Scapy

Overview

Scapy is a Python packet manipulation library that enables crafting, sending, sniffing, and dissecting network packets at granular protocol layers. This skill covers using Scapy for security-relevant tasks including TCP/UDP/ICMP packet crafting, pcap file analysis, protocol field extraction, SYN scan implementation, DNS query analysis, and detecting anomalous traffic patterns such as unusually fragmented packets or malformed headers.

When to Use

  • When investigating security incidents that require analyzing network packets with scapy
  • When building detection rules or threat hunting queries for this domain
  • When SOC analysts need structured procedures for this analysis type
  • When validating security monitoring coverage for related attack techniques

Prerequisites

  • Python 3.8+ with scapy library installed (pip install scapy)
  • Root/administrator privileges for raw socket operations (sniffing, sending)
  • Npcap (Windows) or libpcap (Linux) for packet capture
  • Authorization to perform packet operations on target network

Steps

  1. Read and parse pcap/pcapng files with rdpcap() for offline analysis
  2. Extract protocol layers (IP, TCP, UDP, DNS, HTTP) and field values
  3. Compute traffic statistics: top talkers, protocol distribution, port frequency
  4. Detect SYN flood patterns by analyzing TCP flag ratios
  5. Identify DNS exfiltration indicators via query length and entropy analysis
  6. Craft custom probe packets for authorized network testing
  7. Export findings as structured JSON report

Expected Output

JSON report containing packet statistics, protocol distribution, top source/destination IPs, detected anomalies (SYN floods, DNS tunneling indicators, fragmentation attacks), and per-flow summaries.

Comments

Markdown supported