Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Status Node Tests License

🌐 NetUtils

⚑ Network Diagnostic Toolkit β€” Zero Dependencies ⚑

IP Geolocation Β· DNS Multi-Resolver Β· HTTP Headers Β· Port Scanner Β· SSL/TLS Audit Β· WHOIS/RDAP Β· CT Subdomains Β· Batch Jobs

Features β€’ API β€’ Environment β€’ Deploy β€’ Testing β€’ Structure


πŸ“– Overview

NetUtils is a lightweight, serverless network diagnostic toolkit built entirely on native Node.js modules β€” no third-party dependencies required. It bundles five essential networking tools behind a clean web UI and a simple JSON API, and deploys to Vercel in minutes.

Tip

Every endpoint returns a consistent { status, message, data } JSON shape, so it's easy to script against or plug into your own dashboard.


✨ Features

# Tool Description API Endpoint
🌐 IP Info Geolocation, ISP, ASN, proxy/VPN flags, multi-provider failover (ip-api β†’ ipwho.is β†’ ipinfo) GET /api/ip
πŸ“‘ DNS Lookup A/AAAA/MX/TXT/NS/CNAME/SOA/SRV across 3 DoH resolvers (Cloudflare/Google/Quad9), DNSSEC status, resolver diff (hijack detection) GET /api/dns
πŸ“‹ HTTP Headers Header analysis, redirect chain, security score GET /api/headers
πŸ”Œ Port Scanner Concurrent engine (32 workers), custom ranges, banners, SSE live progress GET /api/portscan
πŸ”’ SSL Audit Chain walk, OCSP best-effort, TLS 1.0–1.3 matrix, cipher probe, score 0–100 + grade GET /api/ssl
🏒 WHOIS/RDAP RDAP-first (IANA bootstrap) with raw whois:43 fallback, domain/IP/ASN GET /api/whois
🧾 Cert Transparency Subdomain discovery via crt.sh + certspotter, issuance timeline GET /api/ct
βš™οΈ Batch Scan Async jobs (200 items, concurrency 5, retry, webhook on complete) POST /api/scan
πŸ”— Share Links 8-char Crockford codes, owner delete, SVG OG cards POST /api/share
πŸ€– AI Reports Streaming diagnostic summaries (OpenAI-compatible, optional, opt-in) GET /api/ai

Platform: i18n (EN/ID/ZH), dark mode + system sync, ⌘K command palette, geo map (zero-dep canvas), lookup history + CSV/JSON export, PWA (offline shell + last-result cache), shareable results, webhooks (HMAC-SHA256), structured logs with request IDs.

πŸ›‘οΈ Security

  • SSRF guard (lib/netguard.js): IP classification (RFC1918, loopback, link-local, CGNAT, cloud metadata 169.254.169.254, IPv6 ULA…), DNS rebinding detection (double resolve, 500ms apart), port allowlist, 5-hop redirect cap, punycode normalization, homograph/IDN-lookalike flags.
  • Rate limiting (lib/ratelimit.js): sliding window per-IP per-endpoint (default 30 req/min, burst 5), token bucket, Retry-After + X-RateLimit-* headers, optional Upstash Redis backend.
  • Headers (vercel.json): strict CSP, HSTS preload, X-Frame-Options: DENY, nosniff, Referrer-Policy, Permissions-Policy, COOP.
  • Webhooks: HMAC-SHA256 signature (X-Webhook-Signature), 3 retries with 1s/5s/30s backoff.
  • AI guardrails: daily USD budget (hard stop), 24h response cache, prompt-injection hardened.
  • Uniform error contract: { status: "error", code, message, data } β€” codes: BAD_REQUEST, INVALID_TARGET, BLOCKED_TARGET, REBINDING_DETECTED, UNRESOLVABLE, NOT_FOUND, RATE_LIMITED, UPSTREAM_ERROR, SERVICE_UNAVAILABLE, BUDGET_EXHAUSTED.

πŸ–ΌοΈ Screenshots

Dashboard Api docs

πŸ› οΈ Tech Stack

Layer Technology
Frontend HTML5 Β· CSS3 (dark theme) Β· Vanilla JavaScript
Backend Node.js (built-in dns, net, tls, http modules)
Hosting Vercel Edge Network + Serverless Functions
Dependencies Zero β€” no npm packages required

πŸš€ Getting Started

Prerequisites

Run Locally

# Clone the repository
git clone https://github.com/TheyanzXD/ip-track.git
cd ip-track

# Install the Vercel CLI
npm i -g vercel

# Start the local dev server
vercel dev

The app will be available at http://localhost:3000.


πŸ“¦ Deploy

Option A β€” Vercel CLI
npm i -g vercel
vercel login
vercel
# Framework Preset: Other
Option B β€” GitHub Import
  1. Push this repository to your own GitHub account
  2. Go to vercel.com/new
  3. Import the repo
  4. Set Framework Preset to Other
  5. Click Deploy βœ…

🌱 Environment

All optional β€” zero config runs in-memory.

Variable Purpose
UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKEN Shared rate limits + share links + scan cache (memory fallback otherwise)
IPINFO_TOKEN Enable ipinfo.io as third IP provider
AI_API_KEY / AI_BASE_URL / AI_MODEL AI reports (OpenAI-compatible API)
BUDGET_DAILY_USD Daily AI spend cap (default 1.00)
SHARE_SECRET HMAC key for share owner tokens (auto-generated per cold start otherwise)
LOG_LEVEL debug / info / warn / error (default info)

πŸ“‘ API Endpoints

All endpoints return JSON { status, message, data } (errors: { status: "error", code, message, data }). Full interactive spec: /docs (also /openapi.json β€” OpenAPI 3.1).

GET /api/ip

/api/ip                  β†’ your own IP info
/api/ip?data=8.8.8.8      β†’ lookup a specific IP
πŸ“¦ Example response
{
  "status": "success",
  "message": "IP information retrieved",
  "data": {
    "ip": "8.8.8.8",
    "country": "United States",
    "region": "California",
    "city": "Mountain View",
    "isp": "Google LLC",
    "asn": "AS15169",
    "timezone": "America/Los_Angeles",
    "latitude": 37.4056,
    "longitude": -122.0775,
    "proxy": false,
    "hosting": true,
    "meta": { "provider": "ip-api", "cached": false, "elapsedMs": 42 }
  }
}

GET /api/dns

/api/dns?data=example.com          β†’ all records
/api/dns?data=example.com&type=MX  β†’ MX records only
πŸ“¦ Example response
{
  "status": "success",
  "message": "DNS records retrieved",
  "data": {
    "domain": "example.com",
    "records": {
      "A": ["93.184.216.34"],
      "MX": [{ "exchange": "mail.example.com", "priority": 10 }]
    },
    "dnssec": { "secure": true, "status": "validated" },
    "resolverDiff": []
  }
}

GET /api/headers

/api/headers?data=https://example.com

GET /api/portscan

/api/portscan?data=example.com
/api/portscan?data=example.com&ports=80,443,8000-8010   # max 50 ports
/api/portscan?data=example.com&stream=1                  # SSE live progress

GET /api/ssl

/api/ssl?data=google.com
/api/ssl?data=google.com&port=443

GET /api/whois

/api/whois?data=example.com      # domain
/api/whois?data=8.8.8.8          # IP range (inetnum)
/api/whois?data=AS15169          # autonomous system

GET /api/ct

/api/ct?data=example.com

POST /api/scan β€” batch jobs

{
  "tool": "dns",
  "items": ["example.com", "google.com", "cloudflare.com"],
  "webhookUrl": "https://your.app/hook",
  "webhookSecret": "optional-hmac-secret"
}

Poll GET /api/scan?jobId=..., stream GET /api/scan?jobId=...&stream=1, abort ?abort=1.

POST /api/share β€” share links

{ "payload": { "tool": "ssl", "query": "example.com", "result": { } } }

β†’ { code: "8CHARS", url: "/#/share/8CHARS", expiresAt } (TTL 7 days). Preview card: GET /api/og?code=....

GET /api/ai β€” AI report (SSE streaming)

/api/ai?tool=ssl&data=<urlencoded-json>&stream=1

Platform

GET /api/health    β†’ upstream reachability + memory + uptime (503 degraded)
GET /api/metrics   β†’ rate-limit stats, cache hits, error count

πŸ“– Full interactive docs at /docs Β· machine-readable spec at /openapi.json

πŸ§ͺ Testing

npm test          # node --test, 37 tests across 5 suites
npm run check     # syntax check on generator scripts

Coverage: netguard (SSRF classification, punycode, target parsing, port guard), ratelimit (window + burst semantics), validator (schema subset), scanner (port ranges), homograph (confusable detection). CI (.github/workflows/ci.yml) runs the suite on Node 18/20/22.

πŸ“ Project Structure

πŸ“¦ network-utils
β”œβ”€β”€ πŸ“„ index.html            # Main app (9 tools + palette + share modal)
β”œβ”€β”€ πŸ“„ docs.html             # Interactive API docs + playground
β”œβ”€β”€ πŸ“„ manifest.webmanifest  # PWA manifest
β”œβ”€β”€ πŸ“„ sw.js                 # Service worker (precache + offline snapshots)
β”œβ”€β”€ πŸ“„ openapi.json          # OpenAPI 3.1 spec (generated)
β”œβ”€β”€ πŸ“„ security.txt          # + .well-known/security.txt
β”œβ”€β”€ 🎨 css/style.css         # Light + dark theme (CSS tokens)
β”œβ”€β”€ ⚑ js/
β”‚   β”œβ”€β”€ main.js              # Frontend logic
β”‚   β”œβ”€β”€ theme.js             # light/dark/system sync
β”‚   β”œβ”€β”€ i18n.js              # EN/ID/ZH runtime
β”‚   β”œβ”€β”€ history.js           # localStorage history + export
β”‚   β”œβ”€β”€ palette.js           # ⌘K fuzzy command palette
β”‚   └── map.js               # Zero-dep canvas world map
β”œβ”€β”€ 🌐 locales/{en,id,zh}.json
β”œβ”€β”€ πŸ–₯️ api/
β”‚   β”œβ”€β”€ ip.js dns.js headers.js portscan.js ssl.js
β”‚   β”œβ”€β”€ whois.js ct.js scan.js share.js og.js ai.js
β”‚   └── health.js metrics.js
β”œβ”€β”€ πŸ“š lib/
β”‚   β”œβ”€β”€ netguard.js          # SSRF guard + input validation
β”‚   β”œβ”€β”€ ratelimit.js         # Sliding window + burst
β”‚   β”œβ”€β”€ http.js              # Shared handler wrapper + error contract
β”‚   β”œβ”€β”€ validator.js         # Zero-dep JSON-schema subset
β”‚   β”œβ”€β”€ schemas.js           # Response schema source of truth
β”‚   β”œβ”€β”€ ipintel.js doh.js dnscache.js        # DNS + IP engines
β”‚   β”œβ”€β”€ scanner.js scanstore.js jobs.js      # Scan engines
β”‚   β”œβ”€β”€ sslprobe.js rdap.js ct.js            # SSL/WHOIS/CT engines
β”‚   β”œβ”€β”€ kv.js webhooks.js ai.js homograph.js # Platform services
β”‚   └── logger.js            # Structured JSON logs + requestId
β”œβ”€β”€ πŸ§ͺ test/                 # node --test suites (37 tests)
β”œβ”€β”€ βš™οΈ .github/workflows/ci.yml
β”œβ”€β”€ πŸ“¦ package.json          # Zero dependencies
└── βš™οΈ vercel.json           # Security headers + rewrites

IP Grabber: Shows your own IP or domains you own. Not for tracking without consent. Port Scanner: Only scan systems you own or have written permission to test. Privacy: Lookups are ephemeral. Share links store only the payload you explicitly publish (TTL 7 days, owner-deletable). History, theme, and language stay in your browser's localStorage. AI reports are opt-in and cached server-side for 24h only.