Metadata-Version: 2.4
Name: teamdev-dcblock
Version: 2.0.0
Summary: DC/VPN/Proxy/Tor IP detection engine — 30+ sources, binary search, full geo enrichment
Author-email: MR ARMAN <teamdevmail@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/MR-ARMAN-08/dcblock
Project-URL: Repository, https://github.com/MR-ARMAN-08/dcblock
Keywords: datacenter,ip,vpn,proxy,tor,security,blocking,firewall,cidr
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Internet :: Proxy Servers
Classifier: Topic :: Security
Classifier: Topic :: System :: Networking :: Firewalls
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28
Requires-Dist: aiohttp>=3.8
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.100; extra == "fastapi"
Requires-Dist: starlette>=0.27; extra == "fastapi"
Requires-Dist: uvicorn>=0.22; extra == "fastapi"
Provides-Extra: flask
Requires-Dist: flask>=2.3; extra == "flask"
Provides-Extra: django
Requires-Dist: django>=4.0; extra == "django"
Provides-Extra: bot
Requires-Dist: pyTelegramBotAPI>=4.14; extra == "bot"
Provides-Extra: all
Requires-Dist: fastapi>=0.100; extra == "all"
Requires-Dist: starlette>=0.27; extra == "all"
Requires-Dist: uvicorn>=0.22; extra == "all"
Requires-Dist: flask>=2.3; extra == "all"
Requires-Dist: pyTelegramBotAPI>=4.14; extra == "all"

# 🛡 TeamDev DCBlock v2.0

**Supercharged DC / VPN / Proxy / Tor IP detection engine**  
30+ CIDR sources · Binary-search O(log n) · Full geo enrichment · Multi-platform

---

## Features

- **30+ sources** — AWS, GCP, Azure, Hetzner, OVH, Heroku, Render, Railway, GitHub, Tor, Spamhaus, and more
- **Fallback CIDRs** — works offline with bundled ranges when fetch fails
- **Full enrichment** — org, ISP, ASN, city, region, country, lat/lon, reverse DNS, risk score
- **Zero 404 errors** — fixed Azure/firehol/vultr URLs, fallback-first approach
- **Fast** — binary-search lookup handles 500k+ CIDRs in microseconds
- **Multi-platform** — CLI, FastAPI, Flask, Django, Telegram Bot, Website

---

## Install

```bash
pip install -r requirements.txt
```

---

## CLI Usage

```bash
# Check one IP (card view)
python3 cli/dcblock_cli.py check 3.108.66.217

# Check multiple (table view)
python3 cli/dcblock_cli.py check 1.2.3.4 8.8.8.8 45.33.32.156

# Check from file
python3 cli/dcblock_cli.py batch ips.txt

# JSON output + save
python3 cli/dcblock_cli.py check 1.2.3.4 --json --out result.json

# Force refresh all lists
python3 cli/dcblock_cli.py update

# Show stats
python3 cli/dcblock_cli.py stats

# Disable enrichment (faster, CIDR-only)
python3 cli/dcblock_cli.py check 1.2.3.4 --no-enrich
```

---

## Python Module

```python
from dcblock import DatacenterBlocker

blocker = DatacenterBlocker(enrich_asn=True).load()

result = blocker.check("3.108.66.217")
print(result.status_label())   # DATACENTER / CLEAN / TOR / PROXY / VPN
print(result.to_dict())        # Full JSON-serializable dict

# Bulk check
results = blocker.check_bulk(["1.2.3.4", "8.8.8.8"])

# Async bulk
import asyncio
results = asyncio.run(blocker.async_check_bulk(["1.2.3.4", "8.8.8.8"]))
```

---

## FastAPI

```python
from dcblock import DatacenterBlocker, make_fastapi_middleware
from fastapi import FastAPI

blocker = DatacenterBlocker().load()
app = FastAPI()
app.add_middleware(make_fastapi_middleware(blocker))
```

Run: `uvicorn examples.fastapi_app:app --reload`  
Endpoints: `GET /check/{ip}` · `POST /check/bulk` · `GET /stats`

---

## Flask

```python
from dcblock import DatacenterBlocker, make_flask_middleware
from flask import Flask

blocker = DatacenterBlocker().load()
app = make_flask_middleware(Flask(__name__), blocker)
```

---

## Django

```python
from dcblock import DatacenterBlocker, make_django_middleware

blocker = DatacenterBlocker().load()
DatacenterMiddleware = make_django_middleware(blocker)

# In settings.py
MIDDLEWARE = ["myapp.middleware.DatacenterMiddleware", ...]
```

---

## Telegram Bot

```bash
pip install pyTelegramBotAPI
# Set BOT_TOKEN in examples/telegram_bot.py
python3 examples/telegram_bot.py
```

Commands: `/check 1.2.3.4` · `/bulk 1.2.3.4 8.8.8.8` · `/stats`

---

## Website

Open `examples/website.html` in browser with FastAPI running at `localhost:8000`.

---

## Docker

```bash
docker-compose up -d
# API at http://localhost:8000
```

---

## CheckResult fields

| Field | Type | Description |
|---|---|---|
| `ip` | str | Input IP |
| `is_datacenter` | bool | Blocked or not |
| `status_label()` | str | CLEAN / DATACENTER / PROXY / VPN / TOR / HOSTING |
| `reason` | str | cidr_match / proxy / hosting_flag / asn_keyword / tor |
| `source` | str | Which source list matched |
| `org` | str | Organization name |
| `isp` | str | ISP name |
| `asn` | str | ASN name |
| `asn_number` | str | ASN number (e.g. AS16509) |
| `country` | str | Country name |
| `country_code` | str | 2-letter code |
| `city` | str | City |
| `region` | str | Region/state |
| `latitude` | float | Geo latitude |
| `longitude` | float | Geo longitude |
| `reverse_dns` | str | rDNS hostname |
| `risk_score` | int | 0–100 risk score |
| `tags` | list | Labels like ["proxy", "hosting"] |
| `is_tor` | bool | Tor exit node |
| `is_proxy` | bool | Proxy detected |
| `is_vpn` | bool | VPN detected |
| `is_hosting` | bool | Hosting flag |
| `checked_at` | float | Unix timestamp |

---

## Sources (30+)

| Provider | Category |
|---|---|
| Amazon AWS | cloud |
| Google Cloud | cloud |
| Microsoft Azure | cloud |
| DigitalOcean | cloud |
| Vultr | cloud |
| Oracle Cloud | cloud |
| Linode/Akamai | cloud |
| Hetzner | cloud |
| OVH | cloud |
| Contabo | cloud |
| Leaseweb | cloud |
| IBM Cloud | cloud |
| Alibaba Cloud | cloud |
| Tencent Cloud | cloud |
| Huawei Cloud | cloud |
| Scaleway | cloud |
| Cloudflare IPv4/v6 | cdn |
| Fastly | cdn |
| Heroku | paas |
| Render.com | paas |
| Railway.app | paas |
| Vercel | paas |
| Netlify | paas |
| GitHub Actions | devops |
| M247 / VPN Hosting | vpn_hosting |
| Choopa | cloud |
| ColoCrossing | cloud |
| Tor Exit Nodes | anonymizer |
| Spamhaus DROP | abuse |

---

**TeamDev** · [@MR_ARMAN_08](https://t.me/MR_ARMAN_08) · Support: [@TEAM_X_OG](https://t.me/TEAM_X_OG)
