🛡️ IP Security Analyzer
A lightweight Cloudflare Worker dashboard for IP intelligence, reputation analysis, and browser-side WebRTC exposure testing.
نسخه فارسی پایین همین فایل قرار دارد
🚀 Live Demo · GitHub Repository · X / Twitter · Telegram
Overview
IP Security Analyzer is a single-file Cloudflare Worker that analyzes the public network identity of a visitor. It combines Cloudflare request metadata, IPinfo Lite ASN enrichment, AbuseIPDB reputation data, request-header consistency checks, and a browser-side WebRTC leak test.
The project is designed to be transparent: it separates network classification from risk scoring. For example, a datacenter, CDN, cloud, or transit IP is shown as infrastructure, but it is not penalized by default unless stronger risk indicators exist, such as abuse reports, Tor status, suspicious automation headers, VPN/proxy naming signals, or WebRTC public IP mismatch.
This makes the project useful for:
- Personal IP/security dashboards
- VPN/proxy visibility testing
- Network identity inspection
- Abuse/reputation checks
- Browser WebRTC exposure testing
- Edge-based IP intelligence demos
- Lightweight forensic-style network analysis
Key Features
🌐 Public IP and Network Identity
The Worker detects the public IP address visible to Cloudflare and displays:
- IP address
- IP version, IPv4 or IPv6
- ASN
- ISP / organization
- Country, region, city
- Cloudflare edge colo
- HTTP protocol
- TLS version
- Cloudflare Ray ID
🧠 ASN and Network Classification
The project classifies the visible network into categories such as:
- Hosting / Datacenter
- Mobile / Cellular
- Corporate / Business
- Education / Campus
- Likely Residential
- VPN / Proxy / Privacy name match
- Unknown
🧩 IPinfo Lite Enrichment
IPinfo Lite is used to enrich the IP address with:
- ASN
- AS name
- AS domain
- Country
- Continent
is_vpn, is_proxy, is_tor, or is_hosting fields. Because of that, this project does not claim definitive VPN detection from IPinfo Lite alone. It uses Lite data as attribution and context.
🧯 AbuseIPDB Reputation Layer
AbuseIPDB adds reputation and abuse context, including:
- Abuse confidence score
- Total abuse reports
- Number of distinct reporting users
- Tor status
- Usage type
- ISP
- Domain
- Hostnames
- Last reported time
Data Center/Web Hosting/Transit is displayed as network context only and does not reduce the score by itself.
🕵️ Request Consistency Checks
The Worker checks request headers and Cloudflare signals for suspicious or inconsistent patterns:
- Missing User-Agent
- Automation clients such as
curl,wget,python,requests, Selenium, Playwright, Puppeteer - Browser-like User-Agent without modern browser headers
- Missing
Accept-Language - Non-TLS 1.3 connection
- Optional Cloudflare Bot Management score, if available
🔌 WebRTC Exposure Test
The dashboard includes a browser-side WebRTC test. It creates a temporary RTCPeerConnection, gathers ICE candidates, and sends them to the Worker through /report.
The WebRTC test can detect:
- Public IP candidates exposed by the browser
- Public IP mismatch between WebRTC and HTTP
- Private/local candidate exposure
- mDNS-masked local candidates
- Cases where WebRTC is blocked or protected
📊 Transparent Risk Score
The score starts at 100.
The score decreases only for stronger signals such as:
| Signal | Effect | |---|---:| | Tor flag from AbuseIPDB | High penalty | | High AbuseIPDB confidence score | High penalty | | Abuse reports | Low to high penalty depending on report count | | VPN/proxy/privacy keyword match | Penalty | | Suspicious automation User-Agent | Penalty | | Low Cloudflare Bot Management score | Penalty | | WebRTC public IP mismatch | Penalty | | WebRTC local/private exposure | Small penalty |
The score does not decrease simply because the IP belongs to hosting, datacenter, cloud, CDN, or transit infrastructure.
Scoring Philosophy
This project intentionally avoids treating infrastructure as automatically malicious.
A clean datacenter IP with:
- Abuse score
0 - No abuse reports
- Not Tor
- No WebRTC mismatch
- No suspicious headers
A residential-looking IP can still become risky if it has:
- Abuse history
- Tor status
- Automation indicators
- VPN/proxy naming patterns
- WebRTC mismatch
- Suspicious request consistency signals
Endpoints
| Endpoint | Method | Description |
|---|---:|---|
| / | GET | HTML dashboard |
| /json | GET | Full server-side analysis as JSON |
| /api | GET | Alias for /json |
| /report | POST | Receives browser WebRTC candidate report and returns combined risk |
| /health | GET | Basic status and version endpoint |
Example JSON Structure
{
"status": "success",
"ip": {
"address": "203.0.113.42",
"version": "IPv4"
},
"network": {
"asn": 15169,
"isp": "Google LLC",
"localClassification": {
"type": "Hosting / Datacenter",
"flags": {
"hostingName": true,
"vpnProxyName": false,
"abuseDatacenterUsage": true
}
}
},
"externalIntel": {
"ipinfoLite": {
"enabled": true,
"ok": true
},
"abuseipdb": {
"enabled": true,
"ok": true
}
},
"risk": {
"score": 100,
"verdict": "Low Risk",
"tags": ["Hosting/Datacenter"],
"findings": []
}
}
Deployment
Option 1: Cloudflare Dashboard
- Open Cloudflare Dashboard.
- Go to Workers & Pages.
- Create a new Worker.
- Open Edit Code.
- Paste the full Worker code.
- Click Save and Deploy.
Option 2: Wrangler CLI
npx wrangler init ip-security-analyzer
cd ip-security-analyzer
Paste the Worker code into:
src/index.js
Deploy:
npx wrangler deploy
Configuration
The Worker can run without external keys, but external intelligence is recommended.
IPinfo Lite
Create a free IPinfo token and add it as:
IPINFO_TOKEN
AbuseIPDB
Create an AbuseIPDB API key and add it as:
ABUSEIPDB_KEY
Cloudflare Dashboard Secrets
In Cloudflare Dashboard:
Worker → Settings → Variables and Secrets → Add
Add:
IPINFO_TOKEN = your_ipinfo_token
ABUSEIPDB_KEY = your_abuseipdb_key
Manual Fallback
If secrets are not available, fill these values at the top of the Worker file:
const MANUAL_IPINFO_TOKEN = "";
const MANUAL_ABUSEIPDB_KEY = "";
Using Cloudflare secrets is safer for production.
Custom Domain
You can attach a custom domain from the Cloudflare dashboard:
Workers & Pages → Your Worker → Settings → Triggers → Add Custom Domain
Example:
myip.example.com
Technical Methodology
1. Server-Side IP Detection
The Worker reads the IP address visible to Cloudflare using headers such as:
CF-Connecting-IPTrue-Client-IPX-Real-IPX-Forwarded-For
2. Cloudflare Metadata
Cloudflare Workers expose metadata through request.cf, including ASN, organization, country, city, region, colo, timezone, TLS version, and protocol data.
This data provides the base network identity.
3. External Enrichment
The Worker queries external APIs:
- IPinfo Lite for ASN and country enrichment
- AbuseIPDB for reputation, report count, Tor flag, usage type, and related abuse context
4. Heuristic Classification
The Worker uses conservative keyword matching to classify network names and domains. For example:
cloud,hosting,datacenter,transit→ infrastructure contextvpn,proxy,tor,privacy,tunnel→ higher-risk naming contextmobile,lte,5g, carrier names → mobile context- known consumer ISPs → residential-like context
5. Risk Model
Risk is calculated from evidence, not assumptions. The Worker applies penalties for:
- Tor
- Abuse score
- Abuse reports
- VPN/proxy/privacy naming
- Automation signatures
- Header inconsistency
- Low bot score
- WebRTC mismatch
points: 0.
6. WebRTC Candidate Analysis
The browser creates a temporary RTCPeerConnection and collects ICE candidates.
The Worker compares:
- HTTP IP seen by Cloudflare
- Public IPs exposed by WebRTC
- Local/private candidates
- mDNS candidates
7. Known Limitations
This project cannot reliably reveal the original ISP IP behind a correctly configured VPN or proxy.
It also cannot perform real DNS leak detection by itself, because a normal Worker cannot observe the visitor's DNS resolver. Real DNS leak testing requires unique subdomains and authoritative DNS query logs.
Security Notes
- Do not expose private API keys in public repositories.
- Prefer Cloudflare secrets over manual constants.
- Do not interpret hosting/datacenter as malicious by itself.
- Use findings and score together, not score alone.
- WebRTC results depend on browser settings and privacy protections.
- DNS leak detection requires a separate authoritative DNS logging system.
Use Cases
- Checking whether a VPN or proxy exposes browser-side WebRTC candidates
- Inspecting ASN and network ownership
- Viewing public IP reputation
- Building a simple edge-based IP intelligence dashboard
- Demonstrating Cloudflare Worker request metadata
- Comparing HTTP-visible IP with WebRTC-visible IP
- Learning how infrastructure classification differs from abuse scoring
Project Links
- Live Demo: myip.theazizi.ir
- GitHub: TheGreatAzizi/IP-Security-Analyzer-Cloudflare-Worker
- X / Twitter: @the_azzi
- Telegram: luluch_code
License
MIT License — free to use, modify, and deploy.
فارسی
تحلیلگر امنیت IP
داشبوردی سبک بر پایه Cloudflare Worker برای تحلیل هویت شبکه، اعتبار IP، بررسی WebRTC و نمایش شفاف سیگنالهای امنیتی.
معرفی
IP Security Analyzer یک پروژه تکفایلی برای Cloudflare Worker است که IP عمومی و مسیر شبکهای قابل مشاهده توسط سایت را تحلیل میکند.
این پروژه تلاش نمیکند اطلاعات مخفی یا غیرقابل مشاهده را حدس بزند. در عوض، دادههای قابل مشاهده را بررسی و با هم ترکیب میکند:
- متادیتای Cloudflare
- اطلاعات ASN و کشور از IPinfo Lite
- اعتبار و سابقه سوءاستفاده از AbuseIPDB
- بررسی سازگاری هدرهای درخواست
- تست WebRTC در مرورگر
ویژگیها
تشخیص IP و هویت شبکه
پروژه اطلاعات زیر را نمایش میدهد:
- IP عمومی
- IPv4 یا IPv6
- ASN
- نام ISP یا سازمان شبکه
- کشور، شهر و منطقه
- Cloudflare colo
- نسخه TLS
- پروتکل HTTP
- Ray ID
دستهبندی شبکه
اتصال میتواند در دستههایی مثل موارد زیر قرار بگیرد:
- دیتاسنتر / هاستینگ
- موبایل / سلولار
- سازمانی / شرکتی
- آموزشی
- شبیه Residential
- VPN / Proxy / Privacy name match
- ناشناخته
IPinfo Lite
IPinfo Lite اطلاعات پایهای مثل موارد زیر را اضافه میکند:
- ASN
- نام AS
- دامنه AS
- کشور
- قاره
is_vpn، is_proxy، is_tor یا is_hosting ندارد. بنابراین پروژه از IPinfo Lite فقط برای زمینهسازی و شناسایی بهتر شبکه استفاده میکند، نه برای ادعای قطعی VPN بودن.
AbuseIPDB
AbuseIPDB اطلاعات اعتبار و سوءاستفاده IP را فراهم میکند:
- Abuse confidence score
- تعداد گزارشها
- تعداد کاربران گزارشدهنده
- وضعیت Tor
- نوع استفاده شبکه
- ISP
- دامنه
- Hostnameها
- آخرین زمان گزارش
اگر AbuseIPDB فقط بگوید IP از نوع Data Center/Web Hosting/Transit است، این مورد فقط به عنوان اطلاعات شبکه نمایش داده میشود و به تنهایی نمره کم نمیکند.
مدل امتیازدهی
امتیاز از ۱۰۰ شروع میشود.
امتیاز فقط برای موارد معنادار کم میشود:
| سیگنال | اثر | |---|---:| | Tor بودن IP | جریمه زیاد | | Abuse score بالا | جریمه زیاد | | گزارشهای AbuseIPDB | جریمه بسته به تعداد گزارش | | کلمات مرتبط با VPN / Proxy / Privacy | جریمه | | User-Agent مشکوک یا خودکار | جریمه | | Bot score پایین در Cloudflare | جریمه | | WebRTC public IP mismatch | جریمه | | افشای IP محلی در WebRTC | جریمه کم |
موارد زیر به تنهایی جریمه ندارند:
- دیتاسنتر
- هاستینگ
- CDN
- Cloud
- Transit
- Mobile carrier
WebRTC Leak Test
تست WebRTC در مرورگر اجرا میشود. مرورگر یک اتصال موقت RTCPeerConnection میسازد و ICE candidateها را جمعآوری میکند.
سپس Worker بررسی میکند:
- IP دیدهشده توسط HTTP / Cloudflare چیست
- WebRTC چه IPهایی را نشان داده است
- آیا IP عمومی متفاوتی لو رفته است
- آیا IP خصوصی یا local دیده شده است
- آیا مرورگر از mDNS masking استفاده کرده است
محدودیتها
این پروژه نمیتواند به طور قطعی IP اصلی پشت یک VPN یا Proxy درست پیکربندیشده را پیدا کند.
همچنین یک Cloudflare Worker معمولی نمیتواند DNS resolver کاربر را ببیند. برای DNS leak واقعی باید دامنههای تصادفی و لاگ authoritative DNS داشته باشید.
Endpointها
| مسیر | متد | توضیح |
|---|---:|---|
| / | GET | داشبورد HTML |
| /json | GET | خروجی کامل JSON |
| /api | GET | معادل /json |
| /report | POST | دریافت گزارش WebRTC از مرورگر |
| /health | GET | وضعیت پایه سرویس |
نصب و راهاندازی
از طریق Cloudflare Dashboard
- وارد Cloudflare Dashboard شوید.
- به بخش Workers & Pages بروید.
- یک Worker جدید بسازید.
- وارد Edit Code شوید.
- کد Worker را جایگذاری کنید.
- روی Save and Deploy کلیک کنید.
از طریق Wrangler
npx wrangler init ip-security-analyzer
cd ip-security-analyzer
کد را در فایل زیر قرار دهید:
src/index.js
سپس Deploy کنید:
npx wrangler deploy
تنظیم کلیدها
برای نتیجه بهتر، این دو کلید را در Cloudflare Worker Secrets قرار دهید:
IPINFO_TOKEN
ABUSEIPDB_KEY
اگر به Secrets دسترسی ندارید، میتوانید مقدارها را در ابتدای فایل Worker وارد کنید:
const MANUAL_IPINFO_TOKEN = "";
const MANUAL_ABUSEIPDB_KEY = "";
برای محیط عمومی، استفاده از Secret امنتر است.
کاربردها
- بررسی WebRTC leak هنگام استفاده از VPN
- مشاهده مالکیت ASN و شبکه
- بررسی reputation و گزارشهای AbuseIPDB
- ساخت داشبورد IP intelligence روی Cloudflare Worker
- مقایسه IP قابل مشاهده از HTTP با IP قابل مشاهده از WebRTC
- آموزش تفاوت classification و risk scoring
لینکها
- دمو: myip.theazizi.ir
- گیتهاب: TheGreatAzizi/IP-Security-Analyzer-Cloudflare-Worker
- ایکس / توییتر: @the_azzi
- تلگرام: luluch_code
لایسنس
MIT License — استفاده، تغییر و انتشار آزاد است.