Skip to content

Repository files navigation

Pentest Analyzer v6.2

⚠️ Authorized Use Only

This tool is for authorized security testing only. Use it only against systems you own, or for which you hold explicit written permission to test.

Unauthorized access to computer systems is a criminal offence in most jurisdictions. Being publicly reachable on the internet is not permission. You are solely responsible for obtaining valid authorization and for complying with all applicable laws, contracts, NDAs, and bug bounty program rules.

Provided as is, without warranty of any kind. The author accepts no liability for any damage, loss, or legal consequence arising from use or misuse of this tool.

By using this software you accept the full Disclaimer and Acceptable Use Policy. If you do not agree, do not use it.


Local enumeration + AI-assisted security review for pentesters and bug bounty hunters. Runs on localhost:3000 only — no remote server, no telemetry.

Takes cURL commands, Burp XML exports, HAR files, JS source, or raw HTTP and produces:

  • Endpoints, parameters, subdomains, paths
  • S3 bucket and cloud resource discovery (AWS / Azure / GCP / Heroku / Vercel / Netlify / Cloudflare / DigitalOcean)
  • Hidden / internal URL flagging
  • Potential vulnerability sinks (parameter-name and code-pattern based)
  • Secret / credential scanning (AWS, GitHub, Slack, Stripe, Twilio, JWT, private keys, DB connection strings, ...)
  • GraphQL endpoint + introspection + batching detection
  • CORS misconfiguration detection (response-header analysis)
  • JWT decoding + alg-confusion / claim-tampering hints
  • JS source review snippets (auth flows, weak crypto, dangerous DOM sinks, deserialization, postMessage, etc.)
  • Diff against a saved baseline (track attack-surface drift / retesting)

Then optionally sends sanitized findings to Claude for deep review covering:

  • OWASP Web Top 10 (2021)
  • OWASP API Security Top 10 (2023)
  • OWASP LLM Top 10 (2025) — when LLM features are present
  • High-confidence CVE / known-vuln matching
  • JS source code review
  • Bug bounty submission angles + draft titles

What's new in v6.2 vs v6.1

Endpoint discovery upgrades (the main reason for v6.2)

  1. Domain attribution — every endpoint now carries its host. Output reads https://api.target.com/api/v1/users (from regex:burp) instead of just /api/v1/users. No more back-referencing the source request manually.

  2. Aggressive 3-layer JS extraction — replaces the v6.1 string-only matcher.

    • Layer A: explicit HTTP-call patterns — fetch, all axios.* methods including axios.create({baseURL}), jQuery $.ajax, XMLHttpRequest.open, useFetch, useSWR, ky, got, generic apiUrl/API_BASE config keys.
    • Layer B: template literals with same-file constant resolution — fetch(\${API_BASE}/users/${id}`)whereAPI_BASEis defined in the same file gets resolved to the actual URL. Unknown placeholders are kept as{var}` markers for visibility.
    • Layer C: bracket-balanced object extraction — const ROUTES = { getUsers: '/api/v1/users', ... } is fully walked. Catches route maps in config objects that pure regex misses.
  3. Logic-based endpoint expansion — pattern-based candidate generation per target type (web / API / mobile / GraphQL / cloud). For every /api/v1/users you give it, you get /api/v1/users/{id}, /me, /search, /export, /import, /count, /bulk, /admin/api/v1/users, /api/v2/users, /api/v3/users, etc. Auth-signal-aware (adds /oauth/token, /.well-known/jwks.json when JWT or auth endpoints detected). GraphQL-signal-aware. Cloud target type adds /actuator/*, /swagger.json, /_next/data/, /.git/config, /server-status, etc.

  4. Deep JSON URL extraction — recursive walker for nested JSON bodies. Pulls URLs and paths from any depth, including HATEOAS _links.self.href, OIDC discovery (jwks_uri, token_endpoint, authorization_endpoint), pagination (next, nextPageToken, nextLink), webhooks, callbacks, redirects. Recognizes 40+ URL-named keys plus value-shape detection (https://, s3://, wss://, mongodb://, etc.).

  5. AI endpoint predictor — separate /api/predict-endpoints route. Sends confirmed endpoints + detected hosts + tech-stack hints + target types to Claude with a focused predictor prompt. Returns confidence-tiered Markdown (HIGH / MEDIUM / BRUTEFORCE / CLOUD / GRAPHQL) where every prediction must cite the observed pattern that justifies it. Separate from the main AI analysis call so you control the cost.

AI control upgrade

  1. Custom instructions for AI analysis — collapsible textarea in the AI panel (max 2000 chars) that injects tester-specific guidance into every AI call. 11 built-in templates ("focus on IDOR", "stack: laravel", "compliance: pci-dss + hipaa", "output in Hindi", etc.) loadable via dropdown. Custom instructions:
    • Are sanitized before sending (matches the findings-sanitization treatment)
    • Are included in the cache key so different instructions don't collide on cached results
    • Have a precedence rule in the system prompt: they can narrow focus / add stack context / change tone, but cannot disable safety tags, bypass scope guard, or request actual exploitation execution

UI changes

  • Endpoints panel now has three tabs: confirmed / inferred / ai-predicted, each with its own count.
  • New "hosts" result section listing all distinct hosts attributed across the scan.
  • New "deep json url extraction" section showing what was found in nested JSON bodies (with key path and kind).
  • New "graphql operations in js" section listing gql\...`` tagged-template operations found in JS source.
  • Target-type checkboxes on the input panel (web / api / mobile / graphql / cloud) drive expansion rules.
  • Optional "JS source URL" field — supplying it gives proper host attribution for uploaded JS files.
  • Custom instructions textarea with live character counter and template dropdown.
  • "predict endpoints (ai)" button alongside the existing "send to claude" button.

Backward compatibility

  • The legacy endpoints string list is still emitted alongside the new endpoint_records structured list — exporters (Burp XML, Nuclei templates, wordlists, Markdown report) keep working without changes.
  • All v6.1 detectors and routes are unchanged.
  • Cache key format changed (now includes custom_instructions). After upgrading, first AI call will be a cold call regardless of whether you used the same prompts in v6.1. This is intentional — you don't want to accidentally serve a v6.1-prompt result for a v6.2 scan.

What's new in v6.1 vs v6.0

Bug fixes

  • Fixed broken Claude model name (claude-opus-4-20250805 didn't exist → 404). Now claude-haiku-4-5 default with claude-sonnet-4-6 and claude-opus-4-7 selectable.
  • Anthropic SDK pin updated from 0.7.0 (years stale) to >=0.40.0.
  • prompts.py is now actually imported and wired up — was dead code in v6.0.
  • DeduplicationEngine is actually used now (caches AI results).
  • Subdomain detection uses tldextract (proper public-suffix-list aware) — fixes multi-level TLDs and stops false-positives on filenames like jquery.min.js.
  • S3 bucket regex allows dots and validates length (3–63 chars).
  • JSON body parser uses JSONDecoder.raw_decode() (no greedy \{.*\} match), with recursion-depth limit.
  • Endpoint patterns have word boundaries.
  • HiddenURLDetector keyword list deduplicated.

Security hardening

  • Self-XSS in the UI eliminated — frontend uses textContent / createElement exclusively, never innerHTML.
  • CSRF token on all state-changing routes.
  • Strict Content-Security-Policy, plus X-Frame-Options: DENY, nosniff, Referrer-Policy: no-referrer, Permissions-Policy.
  • MAX_CONTENT_LENGTH = 50 MB (DoS via huge body).
  • JSON parser depth-limited to 50 levels.
  • ANTHROPIC_API_KEY env-var support so the key never touches the form/POST body.

Detection quality

  • Vulnerability "detections" reframed as potential sinks with LOW/MEDIUM/HIGH severity and explicit next_step guidance — no fake CRITICAL flags or invented bounty estimates.
  • Code-pattern detector added (innerHTML, eval, dangerouslySetInnerHTML, weak crypto, etc.).

10 new features

  1. Secret scanning — AWS, GCP, GitHub (ghp_/gho_/ghu_/ghs_/ghr_), Slack, Stripe, Twilio, SendGrid, Mailgun, JWTs, private keys, DB connection strings.
  2. GraphQL detection — endpoints, introspection queries, batching, mutations, subscriptions.
  3. CORS misconfiguration* + credentials, null-origin, origin reflection, dev-origin leakage, permissive methods.
  4. JWT analyzer — decode header/payload, flag alg=none, alg-confusion hints, missing exp, admin-ish claims.
  5. HAR file support — Chrome DevTools / Firefox / Charles export. Synthesizes raw-HTTP shape so all detectors work.
  6. Burp XML export — push discovered endpoints back into Burp Site Map / Repeater.
  7. Nuclei template generation — auto-builds basic discovery templates (zipped) plus a specific graphql-introspection template when applicable.
  8. Markdown report export — clean report with summary tables, OWASP coverage, AI section, submission scaffold.
  9. Wordlist generationpaths.txt, segments.txt, parameters.txt, subdomains.txt, endpoints.txt for ffuf/wfuzz/dirsearch.
  10. Diff mode — save current scan as baseline, diff next scan against it (find new endpoints, removed surface, etc.).

Cost-effective AI

  • Three-tier model routing with dropdown. Default is Haiku (~5× cheaper than Sonnet, ~75× cheaper than Opus). Sonnet for balanced. Opus 4.7 your call when depth matters.
  • Prompt caching — the methodology system prompt is marked cache_control: ephemeral, giving 90% input-token discount on repeat calls inside the cache window.
  • Local result cache — SHA-256 hash of canonicalized findings + mode + model is stored in SQLite. Repeat runs return cached result instantly. Force-refresh checkbox to override.
  • Token-aware truncationAI_TRUNCATION budgets in config.py keep payload sane on giant scans (50 endpoints, 50 params, 30 subdomains, etc.).
  • Cost preview button — shows estimated USD before you call.
  • SanitizationAuthorization, Cookie, JWT bodies, AWS/GH/Slack/Stripe tokens redacted before findings leave your machine.

Install

cd pentest_analyzer_v6.2
python3 -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\activate
pip install -r requirements.txt

Set your Claude API key (preferred — never travels in form data):

export ANTHROPIC_API_KEY="sk-ant-..."

Or paste it in the UI when running. Env var takes precedence.

Run

python3 app.py

Open http://127.0.0.1:3000. The app binds localhost only and runs with debug=False.


Usage

  1. Paste cURL commands, raw HTTP, or JS source into the textarea — or click Upload to load a Burp XML, HAR, or .js file. Format auto-detected.
  2. Click analyze — local enumeration runs first, results appear in the right panel.
  3. (Optional) Pick a model and mode, click preview cost to see the bill, then send to claude for AI deep review.
  4. Use the export buttons to get Burp XML / Nuclei zip / Markdown / wordlists.
  5. save as baseline stores the current scan in browser local storage; diff vs baseline compares the next scan against it.

Modes

  • Combined — full review across OWASP Web/API/LLM Top 10, secrets, CORS, JWT, etc.
  • JS source review — focused review of code snippets pulled from JS files.
  • LLM review — OWASP LLM Top 10 framing (use when you see /chat, /completion, /agent, OpenAI/Anthropic SDK calls, etc.).
  • Bug bounty — submission strategy: top issues, draft titles, repro steps, expected payout tier.

Cost expectations (USD per call, approximate)

Using prompt caching + small typical payload (~5k input tokens after truncation, ~2k output tokens):

Model Fresh cost Cached cost (after first call)
Haiku 4.5 ~$0.015 ~$0.013
Sonnet 4.6 ~$0.045 ~$0.040
Opus 4.7 ~$0.225 ~$0.200

Numbers shift with payload size — the cost preview button shows the actual estimate for your current findings.


Security notes

  • Localhost-only — server binds 127.0.0.1, no remote access.
  • No telemetry — only outbound network call is to api.anthropic.com (when you click AI analysis).
  • Findings sanitizationAuthorization / Cookie headers, JWT bodies, AWS/GH/Slack/Stripe tokens redacted before sending to Claude. Subdomains, endpoints, parameter names are sent (this is the target's surface, fair game in pentest scope).
  • Result cache — SQLite file pentest_cache.db in working directory. Contains AI responses keyed by hashed findings. Delete the file to wipe.
  • API key handling — preferred via ANTHROPIC_API_KEY env var. UI fallback is supported but key is POSTed to local backend then forwarded to Anthropic. Set the env var when you can.

Tests

python3 -m pytest tests/ -v

Files

app.py                   Main Flask app, routes
config.py                Constants, regex patterns, model pricing
prompts.py               Claude prompts (system + user templates per mode)
detectors/               Local enumeration logic (basic, vuln_sinks, secrets,
                          graphql, cors, jwt, js_review)
parsers/                 Burp XML, HAR, cURL parsers
ai/                      Claude client, sanitizer, cost estimator
exporters/               Burp/Nuclei/Markdown/Wordlist/Diff exporters
cache/                   SQLite-backed AI result cache
templates/index.html     UI page (Jinja-rendered, CSP-compliant)
static/css/style.css     Styles
static/js/app.js         Frontend logic (no innerHTML)
tests/                   pytest unit tests

Author

Built by Hasan Ali (@hackatwo) — Application Security Engineer and penetration tester.

Issues and pull requests are welcome. For security concerns with this tool itself, please open a GitHub issue.

Legal

Authorized use only. Use this tool solely against systems you own or have explicit written permission to test. Verbal or implied permission is not sufficient. Public reachability is not permission.

The tool performs heuristic analysis: it produces false positives and misses real issues. Findings are advisory and require manual verification. Do not rely on its output for compliance, audit, or contractual purposes.

The optional AI review sends data to the Anthropic API using your own API key. Automated redaction of credentials is applied but is best-effort and not guaranteed. Do not submit material you are not authorized to disclose to a third party — if in doubt, run local-only and leave AI analysis disabled.

Provided as is, without warranty of any kind. The author accepts no liability for any damage, loss, or legal consequence arising from use or misuse.

Full terms: DISCLAIMER.md — read this before use.

License

Released under the MIT License. The MIT License governs copyright permissions only; it does not authorize unlawful use. See DISCLAIMER.md for acceptable use terms.

About

Local-first enumeration and AI-assisted security review for pentesters and bug bounty hunters — parses Burp XML, HAR, cURL and JS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages