# christophetd/cloudflair architecture

> Architecture diagram of the GitHub repository christophetd/cloudflair, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/christophetd/cloudflair
- Repository: https://github.com/christophetd/cloudflair

## Overview

CloudFlair is a command-line scanner for identifying likely exposed origin servers behind Cloudflare or CloudFront. The user supplies a domain and Censys credentials; the CLI hands the scan to the main workflow, which validates the domain and CDN, searches Censys for matching certificates and hosts, excludes CDN addresses, then compares candidate responses with the target homepage and can save likely origins. The excerpts show these orchestration calls and the CDN range lookups; unsampled behavior is not inferred.

Main entry points: [`cloudflair.py`](https://github.com/christophetd/cloudflair/blob/master/cloudflair.py) (Scan workflow), [`cloudflare_utils.py`](https://github.com/christophetd/cloudflair/blob/master/cloudflare_utils.py) (Cloudflare detection), [`cloudfront_utils.py`](https://github.com/christophetd/cloudflair/blob/master/cloudfront_utils.py) (CloudFront detection), [`dns_utils.py`](https://github.com/christophetd/cloudflair/blob/master/dns_utils.py) (Domain validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and orchestration"]
  node_cli["CLI options<br/>[cli.py]"]
  node_workflow["Scan workflow<br/>[cloudflair.py]"]
end

subgraph group_detection["Domain and CDN detection"]
  node_domain_check["Domain validation<br/>[dns_utils.py]"]
  node_cloudflare_check["Cloudflare detection"]
  node_cloudfront_check["CloudFront detection"]
end

subgraph group_discovery["Censys discovery"]
  node_censys_search["Certificate search<br/>[censys_search.py]"]
  node_censys_hosts["Host search<br/>[censys_search.py]"]
end

subgraph group_verification["Origin verification"]
  node_origin_test["Response comparison<br/>[cloudflair.py]"]
end

node_user(("Domain scanner user"))
node_dns["DNS resolver"]
node_cf_ranges["Cloudflare ranges"]
node_cfront_ranges["CloudFront ranges"]
node_censys["Censys API"]
node_target["Target website"]
node_candidates["Candidate servers"]
node_output["Origins output file"]

node_user -->|"provides options"| node_cli
node_workflow -->|"parses arguments"| node_cli
node_workflow -->|"validates domain"| node_domain_check
node_domain_check -->|"queries A record"| node_dns
node_workflow -->|"checks Cloudflare"| node_cloudflare_check
node_workflow -->|"checks CloudFront"| node_cloudfront_check
node_cloudflare_check -->|"queries A record"| node_dns
node_cloudfront_check -->|"queries A record"| node_dns
node_cloudflare_check -->|"fetches ranges"| node_cf_ranges
node_cloudfront_check -->|"fetches ranges"| node_cfront_ranges
node_workflow -->|"searches certificates"| node_censys_search
node_workflow -->|"searches hosts"| node_censys_hosts
node_censys_search -->|"queries certificates"| node_censys
node_censys_hosts -->|"queries hosts"| node_censys
node_workflow -->|"filters addresses"| node_cloudflare_check
node_workflow -->|"filters addresses"| node_cloudfront_check
node_workflow -->|"tests candidates"| node_origin_test
node_origin_test -->|"retrieves homepage"| node_target
node_origin_test -->|"requests responses"| node_candidates
node_workflow -->|"writes likely origins"| node_output

click node_cli "https://github.com/christophetd/cloudflair/blob/master/cli.py"
click node_workflow "https://github.com/christophetd/cloudflair/blob/master/cloudflair.py"
click node_domain_check "https://github.com/christophetd/cloudflair/blob/master/dns_utils.py"
click node_cloudflare_check "https://github.com/christophetd/cloudflair/blob/master/cloudflare_utils.py"
click node_cloudfront_check "https://github.com/christophetd/cloudflair/blob/master/cloudfront_utils.py"
click node_censys_search "https://github.com/christophetd/cloudflair/blob/master/censys_search.py"
click node_censys_hosts "https://github.com/christophetd/cloudflair/blob/master/censys_search.py"
click node_origin_test "https://github.com/christophetd/cloudflair/blob/master/cloudflair.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_cli,node_workflow,node_user toneBlue
class node_domain_check,node_cloudflare_check,node_cloudfront_check toneAmber
class node_censys_search,node_censys_hosts,node_censys,node_candidates toneMint
class node_origin_test toneRose
class node_dns,node_cf_ranges,node_cfront_ranges,node_target,node_output toneIndigo
```

## Components

### Entry and orchestration

- [CLI options](https://github.com/christophetd/cloudflair/blob/master/cli.py): `cli.py`
- [Scan workflow](https://github.com/christophetd/cloudflair/blob/master/cloudflair.py): `cloudflair.py`

### Domain and CDN detection

- [Domain validation](https://github.com/christophetd/cloudflair/blob/master/dns_utils.py): `dns_utils.py`
- [Cloudflare detection](https://github.com/christophetd/cloudflair/blob/master/cloudflare_utils.py): `cloudflare_utils.py`
- [CloudFront detection](https://github.com/christophetd/cloudflair/blob/master/cloudfront_utils.py): `cloudfront_utils.py`

### Censys discovery

- [Certificate search](https://github.com/christophetd/cloudflair/blob/master/censys_search.py): `censys_search.py`
- [Host search](https://github.com/christophetd/cloudflair/blob/master/censys_search.py): `censys_search.py`

### Origin verification

- [Response comparison](https://github.com/christophetd/cloudflair/blob/master/cloudflair.py): `cloudflair.py`

### Other components

- **Domain scanner user**
- **DNS resolver**
- **Cloudflare ranges**
- **CloudFront ranges**
- **Censys API**
- **Target website**
- **Candidate servers**
- **Origins output file**

## Connections

- Domain scanner user → CLI options: provides options (evidence: `README.md`)
- Scan workflow → CLI options: parses arguments (evidence: `cloudflair.py`)
- Scan workflow → Domain validation: validates domain (evidence: `cloudflair.py`)
- Domain validation → DNS resolver: queries A record (evidence: `dns_utils.py`)
- Scan workflow → Cloudflare detection: checks Cloudflare (evidence: `cloudflair.py`)
- Scan workflow → CloudFront detection: checks CloudFront (evidence: `cloudflair.py`)
- Cloudflare detection → DNS resolver: queries A record (evidence: `cloudflare_utils.py`)
- CloudFront detection → DNS resolver: queries A record (evidence: `cloudfront_utils.py`)
- Cloudflare detection → Cloudflare ranges: fetches ranges (evidence: `cloudflare_utils.py`)
- CloudFront detection → CloudFront ranges: fetches ranges (evidence: `cloudfront_utils.py`)
- Scan workflow → Certificate search: searches certificates (evidence: `cloudflair.py`)
- Scan workflow → Host search: searches hosts (evidence: `cloudflair.py`)
- Certificate search → Censys API: queries certificates (evidence: `censys_search.py`)
- Host search → Censys API: queries hosts (evidence: `censys_search.py`)
- Scan workflow → Cloudflare detection: filters addresses (evidence: `cloudflair.py`)
- Scan workflow → CloudFront detection: filters addresses (evidence: `cloudflair.py`)
- Scan workflow → Response comparison: tests candidates (evidence: `cloudflair.py`)
- Response comparison → Target website: retrieves homepage (evidence: `cloudflair.py`)
- Response comparison → Candidate servers: requests responses (evidence: `cloudflair.py`)
- Scan workflow → Origins output file: writes likely origins (evidence: `cloudflair.py`)
