Skip to content

EliasM02/AttackDefendLab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AttackDefendLab

AttackDefendLab is a modular cybersecurity simulation framework built in Python.

The project demonstrates how attacker behaviour generates telemetry, how real-time detections are triggered, and how threat hunting can uncover gaps, anomalies and repeat offenders.

It is designed to model the relationship between:

  • adversary activity
  • logging pipelines
  • detection engineering
  • historical analysis
  • analyst decision making

Objectives

  • Simulate reconnaissance activity across multiple attacker profiles
  • Generate realistic service telemetry
  • Trigger real-time detections
  • Identify detection blind spots
  • Build behavioural baselines
  • Track repeat offenders through reputation
  • Translate analytics into investigation narratives

System Architecture

Attacker → Target → connections.log

Defender → alerts.log

Hunter → scoring, baselines, reputation, narrative, visualization


Components

Attacker Layer

Multiple offensive behaviours are implemented:

  • Fast scanner (burst activity)
  • Slow scanner (low-and-slow evasion)
  • Normal client (benign baseline traffic)

Each attacker can simulate a unique source identity.


Target Layer

The target simulates exposed services.

For every connection it:

  • accepts the request
  • attributes an actor/persona
  • writes telemetry
  • signals the defender

Defender Layer

The defender represents a real-time detection engine.

It maintains short-term memory and applies threshold logic to identify bursts of suspicious behaviour.

Alerts are written to logs/alerts.log.


Hunter Layer

The hunting engine performs deeper analysis on collected telemetry.

Capabilities include:

  • unique port analysis
  • detection gap discovery
  • risk scoring
  • policy enforcement
  • baseline vs current behaviour
  • reputation growth across incidents
  • automated incident narrative
  • attack heatmap visualization

Features

  • Modular function-based architecture
  • Separation between telemetry, detection and analytics
  • Persistent memory via reputation system
  • Time-aware investigations
  • Multiple attacker personas
  • Extensible design for future plugins

Technology

  • Python
  • TCP sockets
  • Multithreading
  • File-based telemetry
  • Data analysis & visualization (matplotlib, numpy)

How to Run

Start components from the project root.

Defender

python defender\detector.py

Target

python target\server.py

Normal traffic

python attacker/normal_client.py

Fast attack

python attacker/scanner.py

Slow attack

python attacker/slow_scanner.py

Hunting & analytics

python hunter/analyze.py

Example Use Cases

  • Demonstrate why alerts alone are insufficient
  • Show how attackers evade thresholds
  • Validate detection coverage
  • Explain baseline drift
  • Illustrate reputation accumulation
  • Teach SOC & threat hunting workflows

What This Project Demonstrates

This lab shows the practical interaction between:

  • offensive tradecraft
  • defensive monitoring
  • detection engineering
  • analytical reasoning

It aims to simulate how real security teams move from signals → to context → to decisions.


Future Roadmap

Planned expansions include:

  • pluggable detection modules
  • service fingerprinting
  • anomaly modelling improvements
  • timeline reconstruction
  • multi-host simulation
  • enrichment data

Disclaimer

This project is for educational and research purposes only.


Maintainer

Elias Security Enthusiast

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages