Skip to content

Repository files navigation

πŸ•΅οΈ Js-Scanner

AI-Powered JavaScript Security Audit Tool



πŸ” Crawl Β· πŸ€– Analyze Β· πŸ“„ Report Β· πŸ’¬ Chat

Let AI uncover the gold in your JS files β€” quietly and efficiently.


πŸ“‹ Overview

Js-Scanner automates the nightmare of manually digging through JavaScript files for API endpoints, hardcoded secrets, JWTs, and sensitive data. It crawls every JS file on a target site, runs them through AI (DeepSeek / OpenAI / local models), and produces a beautiful interactive HTML report β€” then lets you keep asking questions in a chat-like dialog.

flowchart LR
    A[🌐 Target URL] --> B[πŸ•ΈοΈ Crawl JS Files]
    B --> C[πŸ’Ύ Download Locally]
    C --> D[πŸ€– AI Analysis]
    D --> E[πŸ“„ HTML Report]
    D --> F[πŸ’¬ Dialog Mode]
    F -->|New URL| B
Loading

✨ Features

πŸ•ΈοΈ Headless Crawler Automatically discovers every JS file using Playwright, bypasses SSL errors
πŸ€– Multi-Model AI Supports DeepSeek, OpenAI, and local Ollama models
πŸ” Deep Scan Finds API endpoints, hardcoded keys, JWT tokens, secrets, PII, internal IPs
πŸ–₯️ Interactive Report Expand/collapse files, one-click copy all findings or just API endpoints
πŸ’¬ Chat Mode Ask follow-up questions about findings β€” or paste a new URL to scan
πŸ“¦ Portable EXE Package as a single-file Windows executable with no Python needed

πŸš€ Quick Start

1. Install

# Clone
git clone https://github.com/riteshekbote/Js-Scanner.git
cd Js-Scanner

# Dependencies
pip install -r requirements.txt
playwright install chromium

2. Configure

Create config.ini in the project root:

[AI]
api_base = https://api.deepseek.com
api_key = sk-your-actual-key
model = deepseek-chat
temperature = 0.1
max_tokens = 8192
min_confidence = 0.0

[App]
report_dir = reports
cache_dir = js_cache
auto_open_report = false

3. Run 🎯

Interactive mode (recommended):

python src/main.py

Single scan:

python src/main.py https://example.com

βš™οΈ Configuration Reference

Config Values Description
api_base URL OpenAI-compatible API endpoint
api_key string Your API key
model string Model name (deepseek-chat, gpt-4o-mini, llama3, etc.)
temperature 0.0 – 1.0 Lower = more deterministic output (audit: 0.1)
max_tokens int Max tokens per AI response
min_confidence 0.0 – 1.0 Filters findings below this threshold (0.0 = keep all)
report_dir path Where HTML reports are saved
cache_dir path Where downloaded JS files are cached
auto_open_report true / false Auto-open report in browser (Windows)

AI Provider Examples

Provider api_base api_key model
DeepSeek https://api.deepseek.com Your DeepSeek key deepseek-chat
OpenAI https://api.openai.com/v1 Your OpenAI key gpt-4o-mini
Ollama (local) http://localhost:11434/v1 Any string (ollama) llama3 / your model

πŸ“Š Report Preview

After a scan, you get an interactive HTML report that looks like this:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ”’ JS Security Audit Report                                β”‚
β”‚  Target: https://example.com                                β”‚
β”‚  Generated: 2025-01-15 14:30:22                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Files Scanned  β”‚   Findings     β”‚ Critical Riskβ”‚  High Risk β”‚
β”‚      12        β”‚      47        β”‚      3       β”‚     11     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Leak Type Distribution                                      β”‚
β”‚  api_endpoint: 24   hardcoded_secret: 8   jwt_token: 6     β”‚
β”‚  phone_number: 5    internal_ip: 3        email: 1          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ πŸ“ Detailed Analysis Results                                β”‚
β”‚                                                             β”‚
β”‚ πŸ“„ app.bundle.js                          ⚠️ 8 findings     β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚ β”‚  Type   β”‚ Leaked Content     β”‚ Code Context     β”‚ Risk   β”‚β”‚
β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”‚
β”‚ β”‚ api_ep  β”‚ /api/admin/users   β”‚ line 142: url:   β”‚ HIGH   β”‚β”‚
β”‚ β”‚ hardc…  β”‚ sk_live_xxxxxxxx   β”‚ line 67: secret  β”‚ CRIT   β”‚β”‚
β”‚ β”‚ jwt_t…  β”‚ eyJhbGciOiJIUzI1… β”‚ line 203: token  β”‚ HIGH   β”‚β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β”‚                                                             β”‚
β”‚ πŸ“„ config.js                            ⚠️ 3 findings       β”‚
β”‚ ...                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The report includes:

  • πŸ“Š Stats cards β€” files scanned, total findings, critical & high-risk counts
  • 🏷️ Type distribution β€” API endpoints, hardcoded secrets, PII, and more
  • πŸ” Per-file drilldown β€” type, leaked value, code context, risk level, fix suggestion, confidence %
  • πŸ“‹ One-click copy β€” all findings as TSV (paste into Excel) or just API endpoints

πŸ’¬ Dialog Mode

After an audit, you enter an interactive chat with the AI:

πŸ” You: what does the secret_key in config.js do?
πŸ€– AI: That looks like a Stripe API secret key starting with sk_live_. 
         It's a production key β€” anyone with access can charge real cards.

πŸ” You: https://another-site.com
πŸ”„ New URL detected, starting audit...
βœ… New audit complete, context updated.

Commands: exit / quit / help / clear / history


πŸ“¦ Packaging

Build a standalone Windows EXE:

python build_exe.py

Output: dist/API_Agent.exe β€” no Python environment required.

⚠️ The target machine still needs Playwright browsers. Run playwright install chromium on it.


❓ FAQ

πŸ”΄ SSL certificate errors?

The tool already ignores SSL errors (verify=False in both Playwright and requests). If it still fails, check that the target site is actually reachable.

βšͺ AI returns nothing / report is empty?
  • Verify api_key in config.ini
  • Try min_confidence = 0.0
  • Make sure your model supports OpenAI-compatible chat completions
🟑 Too many false positives?

Raise min_confidence (e.g. 0.7). You can also extend is_likely_placeholder() in ai_analyzer.py.

πŸ”„ Scan a new site mid-session?

Just paste the URL into the dialog β€” the agent detects it, scans, and updates context automatically.

πŸ” Analyze authenticated/logged-in sites?

No built-in auth yet. Modify crawler.py to inject cookies via page.context.add_cookies([...]).

πŸ“ Analyze local JS files?

Designed for live websites. For local files, enter a file path as the URL (not recommended) or extend the code yourself.


🧰 Advanced Customization

  • Custom rules β€” edit the prompt and is_likely_placeholder() in ai_analyzer.py
  • Truncation β€” change max_chars in ai_analyzer.py (default: 300,000 chars)
  • Batch scans β€” loop in a shell script:
    for url in $(cat targets.txt); do python src/main.py "$url"; done

🧯 Tech Stack

Component Library
πŸ€– AI Client openai
πŸ•ΈοΈ Headless Browser playwright
πŸ“„ Report Engine jinja2
🌐 HTTP Client requests

⚠️ Disclaimer

This tool is for authorized security testing and self code review only.
Do not use it on systems you do not own or have explicit permission to test.
AI analysis may produce false positives or miss real issues β€” always manually verify critical findings.


πŸ“„ License

MIT Β© riteshekbote


⭐ Found this useful? Give it a star!

Report Bug Β· Request Feature

About

AI-powered JavaScript security audit tool that crawls a site's JS, extracts endpoints/secrets/JWTs, and generates interactive reports.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages