CAPEX is a configurable framework for orchestrating network traffic capture and controlled attack generation for intrusion detection and concept drift research.
It is designed to support reproducible dataset creation for systems such as FIRE and conformal evaluation pipelines, with an emphasis on structured configuration, extensibility, and modern Python practices.
CAPEX provides:
- Config driven orchestration of network captures and attack execution
- Typed models and validation for devices and attack definitions
- Extensible attack system with registry based dispatch
- Structured logging and reproducible experiment outputs
- Integration with tcpdump and downstream flow generation tools
The system is intended for controlled environments such as lab networks, testbeds, or isolated research deployments.
.
├── configs/ # YAML configuration for devices and attacks
├── data/
│ ├── legacy/ # Historical datasets and artifacts
│ ├── logs/ # Attack event logs
│ └── raw/ # Captured PCAP files
├── scripts/ # Utility and legacy scripts
├── src/capex/ # Main application package
│ ├── attacks/ # Attack implementations and registry
│ ├── services/ # Capture orchestration logic
│ ├── cli.py # Command line interface
│ ├── models.py # Typed configuration models
│ ├── runner.py # Command execution wrapper
│ ├── scheduler.py # Attack scheduling logic
│ ├── capture.py # Tcpdump integration
│ ├── config.py # YAML loading
│ ├── validation.py # Runtime validation
│ ├── paths.py # Path helpers
│ ├── logging_utils.py # Logging configuration
│ └── exceptions.py # Custom exception types
├── tests/ # Unit and integration tests
├── pyproject.toml # Project configuration
└── Makefile # Development commands
CAPEX is driven by YAML configuration files.
configs/devices.yaml
devices:
- name: nestCam
ip: 192.168.1.196
enabled: trueconfigs/attacks.yaml
attacks:
- name: tcp_syn_flood
label: TCP_SYN_Flood
kind: command
enabled: true
repeats: 3
command:
- hping3
- -S
- -c
- "100"
- -p
- "443"
- "{target_ip}"Attack types are resolved through the internal registry and can be extended without modifying orchestration logic.
For a full walkthrough — prerequisites, system package install, lab setup, safety notes — see docs/USAGE.md. Quick reference:
make syncor directly:
uv sync --devCAPEX's attack library also shells out to real system tools (nmap,
hping3, hydra, etc.) — install those with ./scripts/install-deps.sh
(Debian/Ubuntu, run as root), or see docs/USAGE.md for other platforms.
make dry-runThis loads configs, validates them, and prints the execution plan without running anything.
make runmake run-device DEVICE=nestCammake test- PCAP files are written to
data/raw/ - Attack logs are written to
data/logs/
Each device produces:
data/raw/<device>_flow.pcap
data/logs/<device>_CE.txt
Logs include timestamped records of each attack execution.
CAPEX uses a registry based dispatch model.
Each attack is defined by a kind field and mapped to an executor:
commandexecutes external binaries such asnmaporhping3hulkruns an in-process HTTP flood (HULK) against the target device; configurable viaduration_secondsandthread_countssdp_discoverysends a unicast SSDP M-SEARCH probe to the target device; configurable viatimeout_secondsbanner_grabconnects to a device port and reports whatever banner it sends back; configurable viaport,timeout_seconds, and an optionalprobehydra_brute_forceruns realhydraagainst a device using a combo file built (and capped) fromusername_list/password_list/max_attempts, so the attempt cap is enforced in code rather than trusted to CLI flagshttp_fuzzsends malformed/fuzzed and traversal HTTP requests (paths) to a device's web UI on a configurableportc2_beaconsends a single jittered check-in request per invocation, mimicking botnet C2 callback traffic; configurable viaport,path, andjitter_secondsc2_dns_beaconsends a single jittered real DNS query per invocation as a C2 check-in beacon over UDP/53, distinct wire shape fromc2_beacon; configurable viaport,domain, andjitter_secondsexfil_simsends a bulk outbound POST burst simulating data-staging/exfil traffic; configurable viapayload_size_bytesandchunk_size_bytesconfig_tampersends a real config/firmware-tampering-shaped HTTP request (path,method,body, optionalcontent_type/soap_actionfor SOAP-based exploits) and reports the response status; defaults toenabled: falseat the model level - each entry needs per-device safety vetting before it's turned on, since a payload that succeeds could brick real hardwarearp_spoofruns realarpspoofagainst a device for a boundedduration_seconds, poisoning its ARP relationship withgateway_iponinterface(classic on-path MITM); setbidirectional: trueto also poison the gateway's cache entry for the device, redirecting return traffic toodns_tunnel_exfilencodes a staged payload as base32 subdomain labels sent via periodic real DNS queries, simulating DNS-tunneling exfiltration; configurable viapayload_size_bytes,chunk_size_bytes, andbase_domainplaceholderis a disabled stub for attacks not yet implemented (cannot beenabled: true)- additional attack types can be added via the registry
To add a new attack:
- Define a new config entry in
attacks.yaml - Implement an executor in
src/capex/attacks/ - Register it in
registry.py
No changes are required in the capture orchestration logic.
The following directory is retained for reproducibility of prior work:
scripts/oldCapScripts
This corresponds to tooling used in earlier FIRE experiments and concept drift studies.
- Packet capture is performed using
tcpdump - Flow extraction is typically performed using CICFlowMeter
- Python environment and dependency management is handled via
uv
- Running capture and certain attack tools may require elevated privileges
- This framework is intended for controlled and authorized environments only
- Ensure proper isolation when generating traffic datasets
Seth Barrett Augusta University School of Computer and Cyber Sciences