NPM Ghost
A fast, dependency confusion recon tool that crawls JavaScript and source map files to extract NPM package names and checks if they exist on the public registry.
What it does
- Crawls a target URL and extracts all linked
.jsand.mapfiles - Parses
require()calls andnode_modules/references to extract package names - Checks each package against the NPM registry
- Flags packages that do not exist — potential dependency confusion targets
- Handles gzip, deflate, and brotli compressed responses
- Follows chunked transfer encoding
- Saves results to structured JSON and plain text output files
Modes
| Mode | Description |
|---|---|
| Wildcard Domain | Runs subfinder to enumerate subdomains, then crawls all of them |
| Single URL | Direct crawl of a single target URL |
| Subdomain List | Batch scan from a .txt file of subdomains |
| JS / Map List | Direct scan of a .txt file of JS or map file URLs |
Output Files
| File | Content |
|---|---|
all_packages.txt |
All extracted package names, one per line |
all_urls.txt |
All discovered .js and .map URLs, one per line |
all_urls.json |
Same URLs in structured JSON format |
npm_ghost_results.json |
Full scan results with package name, version, status, and source URL |
Installation
pip install npm-ghost
Or from source:
https://github.com/alonebeast002/npmghost.git
cd npmghost
pip install -r requirements.txt
python setup.py install
Run
npmghost
Requirements
- Python 3.8+
chardetbrotli(optional, enables brotli decompression)subfinder(optional, required for wildcard mode — installed automatically if Go is available)
Use Case
Dependency confusion is a supply chain attack where a public package with the same name as a private internal package gets installed instead. This tool helps security researchers identify internal package names exposed in client-side JavaScript that do not exist on the public NPM registry.
Use only on targets you have permission to test.
Author
alonebeast002
Metadata
Release files for npmghost 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| npmghost-0.0.1.tar.gz | 13.2 kB | Without provenance | Details for npmghost-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| npmghost-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for npmghost-0.0.1-py3-none-any.whl |
Total release size: 25.4 kB
Release files / npmghost-0.0.1.tar.gz
| Download URL | npmghost-0.0.1.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8293ce8432f7fdf0a1f46dc7c1451d0022981ffa202775294b4fd01db81ad814
|
|
BLAKE2b-256 checksum How to use checksums |
5184c80ba7b3ed6a023171f3d50ecde6d923fce7aeb3d91b7c792c4a0360c243
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / npmghost-0.0.1-py3-none-any.whl
| Download URL | npmghost-0.0.1-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3dbd5d2ee9eca15e0143112a0699a8affb971d163aaa8f0ac75bd4514f773f4b
|
|
BLAKE2b-256 checksum How to use checksums |
97dab38256b84d205fc4c588a5ae30c17de1fad729e8a05e1052c146115f5a81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Security for npmghost 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.