https://github.com/arvid-berndtsson/protocol-angus-cortex
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.9%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: arvid-berndtsson
- License: mit
- Language: Go
- Default Branch: main
- Size: 13.7 MB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Protocol Argus Cortex
An advanced, real-time network traffic analysis engine using machine learning to detect and classify bot activity over modern internet protocols like HTTP/2, HTTP/3, and QUIC.
🎯 Overview
The digital landscape is rife with sophisticated bots that can evade traditional detection methods based on simple signatures or IP blacklists. Protocol Argus Cortex is designed to address this challenge by operating at a deeper level.
- Argus Engine: The "all-seeing" eye that captures and performs deep inspection of network packets in real-time. It extracts a rich set of behavioral features and metadata, rather than just inspecting payloads.
- Cortex Engine: The "brain" of the operation. It feeds the features extracted by Argus into a machine learning model to classify traffic as human or bot, providing a confidence score and reasoning for its verdict.
This project focuses on the behavioral fingerprint of a connection—how it communicates, not just what it says.
✨ Core Features
- Real-time Packet Capture: High-performance packet capture using
gopacketwith BPF filtering - Advanced Protocol Support: Parsers for identifying behavioral patterns in TCP, UDP, QUIC, HTTP/1.1, HTTP/2, HTTP/3, and TLS
- Machine Learning Inference: Simulated neural network inference for fast, in-process traffic classification
- Behavioral Feature Extraction: Generates 128-dimensional feature vectors from traffic flow, including:
- Packet size distributions and patterns
- Timing intervals and variance analysis
- Protocol-specific behavioral markers
- Flow duration and packet count statistics
- REST API: Comprehensive HTTP API with health checks, statistics, and manual analysis endpoints
- Prometheus Metrics: Built-in monitoring with custom metrics for bot detection statistics
- Graceful Shutdown: Proper resource cleanup and signal handling
- Extensible Architecture: Easily add new protocol parsers and analysis modules
- Production Ready: Docker support, configuration management, and comprehensive logging
🏗️ Architecture
+-----------------------+
| Cortex Engine |
| (ML Model Inference) |
+-----------+-----------+
^
| (Feature Vector)
+----------------+ +-------------------+ | +----------------------+
| Live Network |----->| Argus Engine |-->| Detection Results |
| Traffic (NIC) | | (Packet Capture & | | (API / Prometheus / |
+----------------+ | Feature Extractor)| | Logging) |
+-------------------+ +----------------------+
🚀 Getting Started
Prerequisites
- Go 1.21+
libpcaplibrary installed (sudo apt-get install libpcap-devon Debian/Ubuntu)- Docker (optional, for containerized deployment)
Quick Start
Clone the repository:
sh git clone https://github.com/arvid-berndtsson/protocol-argus-cortex.git cd protocol-argus-cortexInstall dependencies:
sh go mod tidyBuild the application:
sh make buildConfigure the application: ```sh cp config.yml.example config.yml
Edit config.yml with your settings
```
Run the application:
sh sudo ./build/protocol-argus-cortex --config config.yml --verbose
Configuration
The application uses YAML configuration with sensible defaults:
```yaml server: apiport: 8080 metricsport: 9090
capture: interface: "eth0" bpffilter: "tcp or udp port 443" buffersize: 1048576 # 1MB
cortex: modelpath: "./models/botdetectionv1.onnx" detectionthreshold: 0.85 batchsize: 32 inferencetimeout: 1000 ```
🧪 Testing
The project includes comprehensive test coverage:
```sh
Run all tests
make test
Run tests with coverage
make test-coverage
Run tests with verbose output
go test -v ./... ```
All tests pass successfully, covering: - ✅ Cortex engine initialization and inference - ✅ Argus engine packet capture and flow analysis - ✅ Feature extraction and behavioral analysis - ✅ Configuration loading and validation - ✅ API server functionality
📊 API Endpoints
The application exposes a REST API on port 8080:
GET /- API information and available endpointsGET /health- Health check endpointGET /api/v1/status- System status and statisticsGET /api/v1/statistics- Detailed detection statisticsGET /api/v1/flows- Active network flowsPOST /api/v1/analyze- Manual feature analysisGET /metrics- Prometheus metrics
Example API Usage
```sh
Check system status
curl http://localhost:8080/api/v1/status
Get detection statistics
curl http://localhost:8080/api/v1/statistics
Manual analysis
curl -X POST http://localhost:8080/api/v1/analyze \ -H "Content-Type: application/json" \ -d '{"features": [0.1, 0.2, ...], "flow_id": "test-flow"}' ```
🐳 Docker Deployment
Using Docker Compose (Recommended)
```sh
Start the full stack with Prometheus and Grafana
docker-compose up -d
View logs
docker-compose logs -f argus-cortex
Stop the stack
docker-compose down ```
Manual Docker Build
```sh
Build the image
make docker-build
Run the container
make docker-run
Stop the container
make docker-stop ```
📈 Monitoring
The application integrates with Prometheus and Grafana for monitoring:
- Prometheus: Scrapes metrics from
/metricsendpoint - Grafana: Pre-configured dashboards for bot detection analytics
- Custom Metrics: Bot detections, human detections, active flows, packet counts
Access Grafana at http://localhost:3000 (admin/admin) to view dashboards.
🛠️ Development
Available Make Targets
sh
make help # Show all available targets
make build # Build the application
make test # Run tests
make fmt # Format code
make lint # Run linter
make clean # Clean build artifacts
make run # Run the application
make docker-build # Build Docker image
Project Structure
├── cmd/protocol-argus-cortex/
│ └── main.go # Main application entry point
├── internal/
│ ├── api/ # REST API and metrics server
│ └── cortex/ # ML inference engine
├── pkg/
│ ├── argus/ # Packet capture and feature extraction
│ ├── config/ # Configuration management
│ └── protocol/ # Protocol parsers (HTTP/2, QUIC, TLS)
├── models/ # ML model storage
├── config.yml.example # Configuration template
├── Dockerfile # Multi-stage container build
├── docker-compose.yml # Full stack deployment
├── Makefile # Development automation
└── README.md # This file
🔧 Advanced Usage
Custom Protocol Parsers
Add new protocol support by implementing the Parser interface:
go
type Parser interface {
ParsePacket(data []byte) (*ProtocolInfo, error)
IsSupportedProtocol(protocol string) bool
}
Feature Extraction
The system extracts 128-dimensional feature vectors including: - Packet size statistics (mean, variance, distribution) - Timing patterns (intervals, regularity, burst patterns) - Protocol-specific features (headers, methods, paths) - Flow characteristics (duration, packet count, direction)
Machine Learning Integration
The Cortex engine is designed to integrate with real ML models: - Replace the simulation with actual ONNX/TensorFlow inference - Add model versioning and A/B testing capabilities - Implement model retraining pipelines
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
make test) - Format code (
make fmt) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Guidelines
- Follow Go best practices and conventions
- Add tests for new functionality
- Update documentation for API changes
- Use conventional commit messages
- Ensure all tests pass before submitting
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- gopacket for packet capture capabilities
- Prometheus for metrics collection
- Grafana for visualization
- The Go community for excellent tooling and libraries
Protocol Argus Cortex - Advanced bot detection through behavioral analysis 🚀
Owner
- Name: Arvid Berndtsson
- Login: arvid-berndtsson
- Kind: user
- Location: Sweden
- Company: @LimeTip
- Website: https://arvidberndtsson.com
- Repositories: 1
- Profile: https://github.com/arvid-berndtsson
Based in Malmö, Sweden, I specialize in software development and digital sustainability. Founder of @LimeTip and Co-Founder of @merely-emissions
GitHub Events
Total
- Delete event: 2
- Push event: 8
- Pull request event: 4
- Create event: 2
Last Year
- Delete event: 2
- Push event: 8
- Pull request event: 4
- Create event: 2
Issues and Pull Requests
Last synced: 11 months ago
Dependencies
- alpine latest build
- golang 1.21-alpine build
- grafana/grafana latest
- prom/prometheus latest
- github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40
- github.com/awalterschulze/gographviz v2.0.3+incompatible
- github.com/beorn7/perks v1.0.1
- github.com/cespare/xxhash/v2 v2.2.0
- github.com/chewxy/hm v1.0.0
- github.com/chewxy/math32 v1.10.1
- github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
- github.com/fsnotify/fsnotify v1.7.0
- github.com/gogo/protobuf v1.3.2
- github.com/golang/protobuf v1.5.3
- github.com/google/flatbuffers v2.0.6+incompatible
- github.com/google/gopacket v1.1.19
- github.com/google/uuid v1.3.0
- github.com/gorilla/mux v1.8.0
- github.com/hashicorp/hcl v1.0.0
- github.com/leesper/go_rng v0.0.0-20190531154944-a612b043e353
- github.com/magiconair/properties v1.8.7
- github.com/matttproud/golang_protobuf_extensions v1.0.4
- github.com/mitchellh/mapstructure v1.5.0
- github.com/pelletier/go-toml/v2 v2.1.0
- github.com/pkg/errors v0.9.1
- github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
- github.com/prometheus/client_golang v1.17.0
- github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16
- github.com/prometheus/common v0.44.0
- github.com/prometheus/procfs v0.11.1
- github.com/sagikazarmark/locafero v0.3.0
- github.com/sagikazarmark/slog-shim v0.1.0
- github.com/sourcegraph/conc v0.3.0
- github.com/spf13/afero v1.10.0
- github.com/spf13/cast v1.5.1
- github.com/spf13/pflag v1.0.5
- github.com/spf13/viper v1.17.0
- github.com/stretchr/testify v1.8.4
- github.com/subosito/gotenv v1.6.0
- github.com/xtgo/set v1.0.0
- go.uber.org/atomic v1.9.0
- go.uber.org/multierr v1.9.0
- go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760
- golang.org/x/exp v0.0.0-20230905200255-921286631fa9
- golang.org/x/net v0.17.0
- golang.org/x/sys v0.13.0
- golang.org/x/text v0.23.0
- golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
- gonum.org/v1/gonum v0.16.0
- google.golang.org/protobuf v1.31.0
- gopkg.in/ini.v1 v1.67.0
- gopkg.in/yaml.v3 v3.0.1
- gorgonia.org/cu v0.9.4
- gorgonia.org/dawson v1.2.0
- gorgonia.org/gorgonia v0.9.18
- gorgonia.org/tensor v0.9.24
- gorgonia.org/vecf32 v0.9.0
- gorgonia.org/vecf64 v0.9.0
- 700 dependencies