Skip to content

CLI reference ​

sh
malware-detector <command> [options]     # or the short alias: mdetect
malware-detector --version

scan ​

Scan source files and directories for malicious behaviour.

sh
malware-detector scan [path ...] [options]
Argument / optionDescription
path ...Files or directories to scan. Default: .. With --staged/--changed, the first path is the git repo.
--stagedScan only git-staged files (pre-commit).
--changedScan only files changed vs HEAD, plus untracked files (pre-push).
--include-depsAlso scan dependency/build directories that are skipped by default.
--with-malcontentAlso run malcontent (YARA). Needs the mal binary: brew install malcontent. Full scans only.

deps ​

Scan a package for supply-chain risk with GuardDog.

sh
malware-detector deps <path> [options]
Argument / optionDescription
pathPackage directory or archive.
--ecosystem {npm,pypi}Package ecosystem. Default: npm if package.json is present, else pypi.

Shared options ​

These options work with both scan and deps:

OptionDefaultDescription
--jsonOutput JSON. Can't be combined with --sarif.
--sarifOutput SARIF 2.1.0.
--min-severity {MEDIUM,HIGH,CRITICAL}MEDIUMOnly show findings at or above this level.
--fail-on {MEDIUM,HIGH,CRITICAL}MEDIUMExit 1 if any finding (shown or not) is at or above this level.
--ignore-file PATHautoSuppression file. Default: nearest .malware-detector-ignore.json upward.
--explainShow the detecting engine and matched source line for each finding.

Exit codes ​

CodeMeaning
0No findings at or above --fail-on
1Findings at or above --fail-on
2Usage error (bad flag, not a git repo, malformed ignore file)
3Engine error (engine missing or failed)