AI-Powered JavaScript Security Audit Tool
π Crawl Β· π€ Analyze Β· π Report Β· π¬ Chat
Let AI uncover the gold in your JS files β quietly and efficiently.
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
| πΈοΈ 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 |
# Clone
git clone https://github.com/riteshekbote/Js-Scanner.git
cd Js-Scanner
# Dependencies
pip install -r requirements.txt
playwright install chromiumCreate 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 = falseInteractive mode (recommended):
python src/main.pySingle scan:
python src/main.py https://example.com| 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) |
| 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 |
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
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
Build a standalone Windows EXE:
python build_exe.pyOutput: dist/API_Agent.exe β no Python environment required.
β οΈ The target machine still needs Playwright browsers. Runplaywright install chromiumon it.
π΄ 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_keyinconfig.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.
- Custom rules β edit the
promptandis_likely_placeholder()inai_analyzer.py - Truncation β change
max_charsinai_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
| Component | Library |
|---|---|
| π€ AI Client | openai |
| πΈοΈ Headless Browser | playwright |
| π Report Engine | jinja2 |
| π HTTP Client | requests |
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.
MIT Β© riteshekbote
β Found this useful? Give it a star!