NetScope is a research-oriented benchmark toolkit for network traffic analysis. It provides a unified workflow for two major directions:
- Traffic Classification
- Traffic Generation
The project keeps each experimental script independent, while exposing a single launcher entry point for task discovery, execution, and validation.
- classify/: classification benchmarks and analysis tools
- generate/: generation quality and utility evaluation tools
- netscope/tasks.py: centralized task registry
- run_netscope.py: unified launcher
- Recommended: Python 3.11
Conda:
conda create -n netscope python=3.11 -y
conda activate netscopepip install -r requirements.txtIf you need CUDA acceleration, install torch/torchvision following the official PyTorch instructions for your CUDA version.
Some classification scripts reference external repos by path (for example ET-BERT, TrafficFormer, YaTC). Make sure these repositories exist under your project root (or update paths in script config accordingly).
The flow/packet dataset build pipeline under classify/build uses SplitCap via mono:
- Install mono runtime
- Prepare SplitCap.exe
- Configure SPLITCAP_EXE path in classify/build/config.py
The dataset used in our experiments can be downloaded here:
python run_netscope.py listpython run_netscope.py search robustnesspython run_netscope.py show cls.robustness.perturbation_builderUse -- to forward arguments to the target script.
python run_netscope.py run cls.dataset.flow_packet_builder -- --in-root datasets/cstnet_120 --workers 12You can also run directly by task id:
python run_netscope.py cls.dataset.flow_packet_builder -- --in-root datasets/cstnet_120 --workers 12python run_netscope.py run-group cls.python run_netscope.py run-group gen. -- --helpContinue on failures when running a group:
python run_netscope.py run-group cls. --continue-on-errorpython run_netscope.py doctorValidate only one prefix:
python run_netscope.py doctor --prefix gen.Task IDs are semantic aliases:
- cls.*: classification evaluations
- gen.*: generation and preprocessing evaluations/utilities
Examples:
- cls.data_efficiency.subset_builder
- cls.cost.uer_inference_benchmark
- gen.correctness.protocol_compliance
- gen.preprocess.json_to_pcap
- Dataset Construction
- classify/build/main.py
- classify/pcap2tsv.py
- classify/pcap2png.py
- Data Efficiency
- classify/gen.py
- Robustness
- classify/robust.py
- Interpretability
- classify/explain_tsv.py
- classify/explain_png.py
- Computational Cost
- classify/uer_classifier_inference_benchmark.py
- classify/yatc_classifier_inference_benchmark.py
- Distribution Fidelity
- generate/pcap_similarity.py
- Protocol Correctness
- generate/eval_protocal.py
- Downstream Utility
- generate/pcap_merge_for_e2e.py
- Generation Diversity
- generate/generation_diversity.py
- The original code in this project is licensed under the MIT License.
- This project includes the third-party tool SplitCap, developed by NETRESEC/Erik Hjelmvik, which is provided under CC BY-ND 4.0: https://www.netresec.com/?page=SplitCap