mapxtractor is a lightweight offensive recon tool designed to discover exposed JavaScript SourceMaps (.js.map) on web applications and optionally extract original source code embedded inside them.
Please also see secretscanner in below.
Exposed SourceMaps can unintentionally reveal:
- Original (unminified) source code
- Internal API endpoints
- Application logic & routing
- Feature flags
- Secrets or hardcoded values
- Comments and developer notes
This tool automates the discovery and extraction process in a clean and scoped manner.
- 🔍 Automatically discovers JavaScript files from HTML
- 🧭 Scope-aware (avoids external CDN JS files)
- 🗺️ Detects valid SourceMap files
- 🧾 Logs discovered SourceMaps
- 📦 Dumps embedded
sourcesContentto disk (optional) - 🔄 Handles redirects & randomizes User-Agent
- ⏱️ Optional rate limiting
- 🌐 Optional scanning of common non-standard ports
# git clone https://github.com/ccelikanil/mapxtractor.git
# cd mapxtractor
# pip install -r requirements.txt
Basic scan:
# python3 mapxtractor.py example.com
Basic scan (multiple targets)
# python3 mapxtractor.py --list targets.txt
Dump embedded source code from SourceMaps
# python3 mapxtractor.py example.com --dump-sources
Enable rate limiting (seconds between requests)
# python3 mapxtractor.py example.com --rate-limit <SECONDS>
Scan common non-standard ports
# python3 mapxtractor.py example.com --extra-ports
# python3 mapxtractor.py example.com --rate-limit 20 --dump-sources
░██ ░██
░██ ░██
░█████████████ ░██████ ░████████ ░██ ░██ ░████████ ░██░████ ░██████ ░███████ ░████████ ░███████ ░██░████
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░███ ░██ ░██ ░██ ░██ ░██ ░██ ░███
░██ ░██ ░██ ░███████ ░██ ░██ ░█████ ░██ ░██ ░███████ ░██ ░██ ░██ ░██ ░██
░██ ░██ ░██ ░██ ░██ ░███ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
░██ ░██ ░██ ░█████░██ ░██░█████ ░██ ░██ ░████ ░██ ░█████░██ ░███████ ░████ ░███████ ░██
░██
░██
# mapxtractor v1.0 | SourceMap Extractor by Anil Celik (@ccelikanil) #
============================================================
[URL: 1/1] example.com
============================================================
[!] JS file found: https://example.com/static/js/main.8f3a2c1e.js
[!] JS file found: https://example.com/static/js/vendor.2d91ab4f.js
[JS] https://example.com/static/js/main.8f3a2c1e.js
[FOUND] Sourcemap -> https://example.com/static/js/main.8f3a2c1e.js.map
[DUMP] sourcemaps/example.com/https_example.com_static_js_main.8f3a2c1e.js.map/src/app.ts
[DUMP] sourcemaps/example.com/https_example.com_static_js_main.8f3a2c1e.js.map/src/api/client.ts
[DUMP] sourcemaps/example.com/https_example.com_static_js_main.8f3a2c1e.js.map/src/config/env.ts
[JS] https://example.com/static/js/vendor.2d91ab4f.js
[INVALID] Not a sourcemap
[+] Scan completed
[+] Sourcemaps logged to sourcemaps.txt
sourcemaps/
└── example.com/
└── https_example.com_static_js_main.8f3a2c1e.js.map/
├── src/
│ ├── app.ts
│ ├── api/
│ │ └── client.ts
│ └── config/
│ └── env.ts
// src/config/env.ts
export const API_BASE_URL = "https://api.internal.example.com";
export const FEATURE_FLAGS = {
enableBetaAuth: true
};
-
Target normalization
- Automatically tries
httpandhttps - Optionally probes common non-standard web ports
- Automatically tries
-
JavaScript discovery
- Parses
<script src="">tags from HTML - Extracts
.jsreferences using regex patterns
- Parses
-
Scope filtering
- Only analyzes JavaScript files belonging to the same domain or its subdomains
- Skips third-party and CDN-hosted scripts
-
SourceMap detection
- Appends
.mapto each discovered JavaScript file - Validates SourceMap structure (
version,mappings,sources)
- Appends
-
Optional source dumping
- Extracts embedded
sourcesContentfrom SourceMaps - Reconstructs the original project structure locally
- Extracts embedded
.
├── sourcemaps.txt
└── sourcemaps/
└── example.com/
└── https_example.com_static_js_app.js.map/
├── src/
│ ├── app.js
│ ├── api/
│ │ └── client.js
│ └── config/
│ └── constants.js
- Web application penetration testing
- Bug bounty reconnaissance
- Red team reconnaissance phase
- Identifying leaked frontend logic
- Hunting exposed API endpoints
- Reverse engineering client-side applications
- SourceMaps are often unintentionally exposed in production environments.
- This tool does not bypass authentication or authorization.
- It only accesses publicly reachable resources.
secretscanner is a post-processing utility designed to work alongside mapxtractor. It recursively scans extracted SourceMap contents to identify hardcoded secrets, internal infrastructure references, and hidden API endpoints. This tool helps transform leaked frontend source code into actionable reconnaissance findings.
- 🔎 Recursive scanning of extracted SourceMap directories
- 🔐 Detection of common secrets:
- AWS Access & Secret Keys
- GitHub / Slack / Google API tokens
- OAuth client secrets
- JWT & Bearer tokens
- 🌐 Discovery of internal infrastructure:
- Private IP addresses (10.x, 172.16–31.x, 192.168.x)
- Localhost & internal service URLs
- Internal API and service endpoints
- 📍 Precise findings:
- File path
- Line number
- Code context
- 🟢 Colorized terminal output for confirmed findings
- 🧾 Automatic TXT report generation
- 🚫 Minified-code protection to reduce false positives
After running mapxtractor with source dumping enabled:
# python3 secretscanner.py sourcemaps/
__
______ ____ ___________ _____/ |_ ______ ____ _____ ____ ____ ___________
/ ___// __ \_/ ___\_ __ \_/ __ \ __\/ ___// ___\\__ \ / \ / \_/ __ \_ __ \
\___ \\ ___/\ \___| | \/\ ___/| | \___ \\ \___ / __ \| | \ | \ ___/| | \/
/____ >\___ >\___ >__| \___ >__| /____ >\___ >____ /___| /___| /\___ >__|
\/ \/ \/ \/ \/ \/ \/ \/ \/ \/
# secretscanner - secret scanning & extraction utility for mapxtractor #
[+] Scanning secrets, internal IPs & endpoints under: sourcemap_finding/sourcemaps
[FOUND] Internal Service URL
File : sourcemaps/example.com/src/config/env.ts
Line : 22
Code : const API_URL = "http://internal-api.corp:8080/v1/users";
...
------------------------------------------------------------
[+] Scan completed
[+] Results written to secrets_found.txt
This tool is intended for authorized security testing and educational purposes only.
The author is not responsible for misuse or any damage caused by this tool.
Always obtain proper authorization before testing any system.
Pull requests and improvements are welcome. Feel free to open an issue for bugs, ideas, or feature requests.
Before submitting a pull request:
- Ensure your code follows the existing style
- Keep changes focused and well-documented
- Test your changes against real targets (with authorization)
All contributions that improve stability, performance, or detection logic are appreciated.