# ersindurmuskaya/ml-based-waf-mitmproxy-tool architecture

> Architecture diagram of the GitHub repository ersindurmuskaya/ml-based-waf-mitmproxy-tool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool
- Repository: https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool

## Overview

This repository is a collection of experiments and prototypes for machine-learning-based web attack detection, rather than one integrated application. Its clearest runtime workflow is an intercepted HTTP request being decoded, converted to features, scaled, and classified in the LFI mitmproxy script. Separate scripts prepare or label datasets, compare classifiers, and assess prediction results. The tree also identifies SQL, XSS, and LFI runtime modules, but their connections and behavior are not established by the excerpts; no README was provided.

Main entry points: [`waf/3_webserver_log_files/cısc2010/csic2010_class.py`](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/3_webserver_log_files/c%C4%B1sc2010/csic2010_class.py) (Attack labeling), [`waf/1_making_dataset_and_ml_model_comparing/1-xss/xss_gridsearch_cv.py`](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/1-xss/xss_gridsearch_cv.py) (XSS grid search), [`waf/1_making_dataset_and_ml_model_comparing/2-sql/sql_roc_auc_deneme.py`](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/2-sql/sql_roc_auc_deneme.py) (SQL comparison), [`waf/1_making_dataset_and_ml_model_comparing/3-osc/osc_roc_auc_deneme.py`](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/3-osc/osc_roc_auc_deneme.py) (OSC comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Dataset preparation"]
  node_labeler["Attack labeling<br/>[csic2010_class.py]"]
  node_sql_data["SQL request samples"]
  node_osc_data["OSC request samples"]
  node_lfi_data["LFI request samples"]
end

subgraph group_evaluation["Model experiments"]
  node_xss_grid["XSS grid search"]
  node_sql_compare["SQL comparison"]
  node_osc_compare["OSC comparison"]
  node_lfi_compare["LFI comparison"]
end

subgraph group_runtime["Request classifiers"]
  node_waf_base["WAF classifier prototype<br/>[dene_waf_kod.py]"]
  node_waf_sql["SQL classifier<br/>[waf_sql_kod.py]"]
  node_waf_xss["XSS classifier<br/>[waf_xss_kod.py]"]
  node_waf_lfi["LFI classifier<br/>[waf_lfi_kod.py]"]
  node_waf_lfi_good["LFI good classifier"]
end

subgraph group_reporting["Log evaluation"]
  node_all_metrics["Overall log metrics"]
  node_sql_metrics["SQL log metrics"]
end

node_web_logs[("Web request dataset")]
node_http_client(("HTTP request"))

node_web_logs -->|"reads content"| node_labeler
node_labeler -->|"adds labels"| node_web_logs
node_xss_grid -->|"loads CSV"| node_web_logs
node_sql_compare -->|"loads CSV"| node_web_logs
node_osc_compare -->|"loads CSV"| node_web_logs
node_lfi_compare -->|"loads CSV"| node_web_logs
node_http_client -->|"sends request"| node_waf_lfi
node_web_logs -->|"loads predictions"| node_all_metrics
node_web_logs -->|"loads predictions"| node_sql_metrics

click node_labeler "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/3_webserver_log_files/c%C4%B1sc2010/csic2010_class.py"
click node_xss_grid "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/1-xss/xss_gridsearch_cv.py"
click node_sql_compare "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/2-sql/sql_roc_auc_deneme.py"
click node_osc_compare "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/3-osc/osc_roc_auc_deneme.py"
click node_lfi_compare "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/4-lfi/lfi_roc_auc_deneme.py"
click node_sql_data "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/2-sql/good/kitapsatisata_kitap_good.py"
click node_osc_data "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/3-osc/good/osc_good_request_log_to_csv.py"
click node_lfi_data "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/4-lfi/good/bad_request_log_to_csv.py"
click node_waf_base "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/dene_waf_kod.py"
click node_waf_sql "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/waf_sql_kod.py"
click node_waf_xss "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/waf_xss_kod.py"
click node_waf_lfi "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/lfi/waf_lfi_kod.py"
click node_waf_lfi_good "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/lfi/waf_lfi_good_kod.py"
click node_all_metrics "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/3_webserver_log_files/0_all/all_conf_matrix_0_1.py"
click node_sql_metrics "https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/3_webserver_log_files/1-sql/sql_conf_matrix_0_1.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_labeler,node_sql_data,node_osc_data,node_lfi_data toneBlue
class node_xss_grid,node_sql_compare,node_osc_compare,node_lfi_compare,node_web_logs toneAmber
class node_waf_base,node_waf_sql,node_waf_xss,node_waf_lfi,node_waf_lfi_good,node_http_client toneMint
class node_all_metrics,node_sql_metrics toneRose
```

## Components

### Dataset preparation

- [Attack labeling](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/3_webserver_log_files/c%C4%B1sc2010/csic2010_class.py): `waf/3_webserver_log_files/cısc2010/csic2010_class.py`
- [SQL request samples](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/2-sql/good/kitapsatisata_kitap_good.py): `waf/1_making_dataset_and_ml_model_comparing/2-sql/good/kitapsatisata_kitap_good.py`
- [OSC request samples](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/3-osc/good/osc_good_request_log_to_csv.py): `waf/1_making_dataset_and_ml_model_comparing/3-osc/good/osc_good_request_log_to_csv.py`
- [LFI request samples](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/4-lfi/good/bad_request_log_to_csv.py): `waf/1_making_dataset_and_ml_model_comparing/4-lfi/good/bad_request_log_to_csv.py`

### Model experiments

- [XSS grid search](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/1-xss/xss_gridsearch_cv.py): `waf/1_making_dataset_and_ml_model_comparing/1-xss/xss_gridsearch_cv.py`
- [SQL comparison](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/2-sql/sql_roc_auc_deneme.py): `waf/1_making_dataset_and_ml_model_comparing/2-sql/sql_roc_auc_deneme.py`
- [OSC comparison](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/3-osc/osc_roc_auc_deneme.py): `waf/1_making_dataset_and_ml_model_comparing/3-osc/osc_roc_auc_deneme.py`
- [LFI comparison](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/1_making_dataset_and_ml_model_comparing/4-lfi/lfi_roc_auc_deneme.py): `waf/1_making_dataset_and_ml_model_comparing/4-lfi/lfi_roc_auc_deneme.py`

### Request classifiers

- [WAF classifier prototype](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/dene_waf_kod.py): `waf/2_ml_env3/dene_waf_kod.py`
- [SQL classifier](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/waf_sql_kod.py): `waf/2_ml_env3/waf_sql_kod.py`
- [XSS classifier](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/waf_xss_kod.py): `waf/2_ml_env3/waf_xss_kod.py`
- [LFI classifier](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/lfi/waf_lfi_kod.py): `waf/2_ml_env3/lfi/waf_lfi_kod.py`
- [LFI good classifier](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/2_ml_env3/lfi/waf_lfi_good_kod.py): `waf/2_ml_env3/lfi/waf_lfi_good_kod.py`

### Log evaluation

- [Overall log metrics](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/3_webserver_log_files/0_all/all_conf_matrix_0_1.py): `waf/3_webserver_log_files/0_all/all_conf_matrix_0_1.py`
- [SQL log metrics](https://github.com/ersindurmuskaya/ml-based-waf-mitmproxy-tool/blob/main/waf/3_webserver_log_files/1-sql/sql_conf_matrix_0_1.py): `waf/3_webserver_log_files/1-sql/sql_conf_matrix_0_1.py`

### Other components

- **Web request dataset**
- **HTTP request**

## Connections

- Web request dataset → Attack labeling: reads content (evidence: `waf/3_webserver_log_files/cısc2010/csic2010_class.py`)
- Attack labeling → Web request dataset: adds labels (evidence: `waf/3_webserver_log_files/cısc2010/csic2010_class.py`)
- XSS grid search → Web request dataset: loads CSV (evidence: `waf/1_making_dataset_and_ml_model_comparing/1-xss/xss_gridsearch_cv.py`)
- SQL comparison → Web request dataset: loads CSV (evidence: `waf/1_making_dataset_and_ml_model_comparing/2-sql/sql_roc_auc_deneme.py`)
- OSC comparison → Web request dataset: loads CSV (evidence: `waf/1_making_dataset_and_ml_model_comparing/3-osc/osc_roc_auc_deneme.py`)
- LFI comparison → Web request dataset: loads CSV (evidence: `waf/1_making_dataset_and_ml_model_comparing/4-lfi/lfi_roc_auc_deneme.py`)
- HTTP request → LFI classifier: sends request (evidence: `waf/2_ml_env3/lfi/waf_lfi_kod.py`)
- Web request dataset → Overall log metrics: loads predictions (evidence: `waf/3_webserver_log_files/0_all/all_conf_matrix_0_1.py`)
- Web request dataset → SQL log metrics: loads predictions (evidence: `waf/3_webserver_log_files/1-sql/sql_conf_matrix_0_1.py`)
