Skip to main content

JS/Map NPM package recon tool — dependency confusion hunter

Project description

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 .js and .map files
  • Parses require() calls and node_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+
  • chardet
  • brotli (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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

npmghost-0.0.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

npmghost-0.0.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file npmghost-0.0.1.tar.gz.

File metadata

  • Download URL: npmghost-0.0.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for npmghost-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8293ce8432f7fdf0a1f46dc7c1451d0022981ffa202775294b4fd01db81ad814
MD5 15a20867bafb52e09a7566dd11c615cd
BLAKE2b-256 5184c80ba7b3ed6a023171f3d50ecde6d923fce7aeb3d91b7c792c4a0360c243

See more details on using hashes here.

File details

Details for the file npmghost-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: npmghost-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for npmghost-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3dbd5d2ee9eca15e0143112a0699a8affb971d163aaa8f0ac75bd4514f773f4b
MD5 73cf23922bf96d2aad4391d66e17c45c
BLAKE2b-256 97dab38256b84d205fc4c588a5ae30c17de1fad729e8a05e1052c146115f5a81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page