Skip to content

solita/npm-malwares

Repository files navigation

NPM malwares

Tool to find npm packages and package lists containing compromised npm packages.

Prerequisites

Install

cd ~/work
git clone https://github.com/solita/npm-malwares.git

Usage

Find compromised packages in your project

Inside the current directory find recursively compromised npm packages from some given package list

cd ~/work
./npm-malwares/find-npm-packages.sh ./npm-malwares/crowd-strike-packages.txt

For projects using pnpm, you can use find-pnpm-packages.sh instead.

Find used packages with any version (removes versions). This result does not mean you are infected, you are just using some version of infected package.

./npm-malwares/find-npm-packages.sh <(cat ./npm-malwares/crowd-strike-packages.txt | sed 's/@[0-9].*$//g' | sort -u)

Count the number of packages from a list

cat crowd-strike-packages.txt | sed 's/@[0-9].*$//g' | sort -u | wc -l

Find globally installed packages, and npx dependencies

If you have installed some npm tool globally (with -g option), or if you are using npx to run some package without installing it permanently, you can check their dependencies with this script:

./npm-malwares/find-global-npm-packages.sh ./npm-malwares/crowd-strike-packages.txt

The script will scan all globally installed packages and their dependencies, and npx directories (usually ~/.npm/_npx).

Info:

Package list

A package list is an utf-8 text file containing npm package specifications as name@version-range (see npm help list) separated by new line \n characters.

Package lists and sources:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages