Passa al contenuto principale
Versione: v0.18

CLI reference

Run php scanner --help to see the options supported by your installed version.

php scanner [path] [options]

path accepts a file, directory, wildcard, or one FTP or FTPS URL. When omitted, the scanner uses the current directory.

Detection

OptionPurpose
--lite, -lReduce common false positives while retaining broad detection
--only-signatures, -sScan for malware signatures only
--only-exploits, -eScan for exploit patterns only
--only-functions, -fScan for dangerous PHP functions only
--exploits=<names>Include selected exploit definitions, separated by commas
--ignore-exploits=<names>Exclude selected exploit definitions, separated by commas
--functions=<names>Scan for selected PHP functions, separated by commas
--scan-all, --allInspect files regardless of extension
--scan-archivesInspect ZIP entries within safety limits
--scan-wordpress-dbRun read only checks against a local WordPress database
--max-filesize=<size>Skip files larger than the given size

Scope and progress

OptionPurpose
--ignore-paths=<patterns>Exclude comma separated paths or wildcards
--filter-paths=<patterns>Include only matching paths or wildcards
--offset=<number>Start at a position in the candidate file list
--limit=<number>Limit the number of mapped files
--checkpoint=<path>Save resumable scan progress in a private JSON file
--resumeContinue a checkpoint when its files and settings still match
--disable-cache, --no-cacheIgnore cached scan results
php scanner /var/www/example --lite --report \
--ignore-paths="*/cache/*,*/logs/*" \
--max-filesize=5MB

Reports and output

OptionPurposeDefault
--report, -rDisable interactive actions and write a reportOff
--report-format=<format>Select html, txt, json, or sarifhtml
--path-report=<path>Set the report file path./scanner-report.html
--log=<path>Write a scan logOff
--path-logs=<path>Set the scanner log path./scanner.log
--silentHide terminal output and promptsOff in CLI
--disable-report, --no-reportPrevent report generationOff in CLI
--disable-colors, --no-colors, --no-colorRemove ANSI colorsOff
--debugDisplay all PHP errors and warningsOff

Text reports include scan totals, verification counts, severity totals, infected file metadata, and matched finding details. JSON and SARIF suit automated processing.

File actions

Automated actions can destroy data

Use automated cleaning or deletion only with current backups and a tested recovery plan. Start with --report on each new project.

OptionPurpose
--backup, -bBack up every file changed by the scanner
--auto-cleanRemove matched code without confirmation
--auto-clean-lineRemove the matched line without confirmation
--auto-deleteDelete detected files without confirmation
--auto-quarantineMove detected files to quarantine
--auto-skipLeave every finding unchanged
--auto-whitelistAdd every finding to the whitelist
--auto-prompt=<action>Apply one prompt response to every finding
--whitelist-only-pathMatch whitelist entries by path without line matching

Store backups, quarantine, reports, and whitelist data outside the public document root:

OptionPurpose
--path-backups=<path>Set the backup directory
--path-quarantine=<path>Set the quarantine directory
--path-whitelist=<path>Set the whitelist JSON file
--findings-store=<path>Set the canonical finding lifecycle JSON file
--path-deobfuscate=<path>Set the directory for deobfuscated files

Integrity and definitions

OptionPurpose
--disable-checksum, --no-checksum, --no-verifySkip platform and package checksum verification
--path-definitions=<path>Set the private Maltrail definition cache
--disable-definitions-updateUse the last verified Maltrail cache without an update request
--defsPrint exploit and function definitions
--defs-exploitsPrint exploit definitions
--defs-functionsPrint dangerous function definitions
--defs-functions-encodedPrint encoded function definitions

Built in signatures remain available offline. Platform checksums and Maltrail definition updates can require outbound HTTPS on the first scan.

Utility options

OptionPurpose
--ftp-user=<username>Set the FTP username, or use AMWSCAN_FTP_USER
--update, -uUpdate the standalone scanner file
--version, -vPrint the installed version
--help, -h, -?Print command help

FTP sources

Pass one ftp://host/path or ftps://host/path URL as the scan path. PHP needs the FTP extension, and FTPS needs ftp_ssl_connect.

Do not place credentials in the URL. Set the username with --ftp-user or AMWSCAN_FTP_USER. Set the password with AMWSCAN_FTP_PASSWORD. Prefer FTPS because FTP sends credentials and file contents without encryption.

AMWSCAN_FTP_USER=scanner \
AMWSCAN_FTP_PASSWORD=secret \
php scanner ftps://files.example.com/public_html --report

FTP scans use a temporary local mirror, force report mode, and remove the mirror after completion. One scan accepts one FTP source with limits of 10,000 files, 64 MiB per file, and 512 MiB total. FTP sources cannot use --scan-wordpress-db.

Platform checksum verification

Checksum verification supports WordPress, selected WordPress plugins, Drupal, Joomla, Magento Open Source, and public Composer packages. The scanner skips only files that match trusted release bytes. It scans modified, generated, and unknown files.

A first check for a platform version can require outbound HTTPS. Successful manifests remain in a local cache. Use --disable-checksum when the scan must make no checksum requests.

Coverage and resume

Reports separate discovered, eligible, scanned, cached, verified, and skipped files. Skip reasons include path filters, extensions, file size, unreadable files, and archive limits.

--checkpoint=<private-path> saves progress after each candidate. --resume continues only when the candidate list and scan settings still match.

ZIP scanning requires ext-zip. The scanner limits entry paths, symbolic links, entry count, file size, expanded size, compression ratio, and nesting depth. Reports mark content beyond those limits as incomplete coverage.

WordPress database scan

--scan-wordpress-db runs an optional read only phase against locally discovered WordPress installations. It checks database triggers, inventories primary site administrators, flags multiple administrators for review, and reports orphaned posts. It does not modify database content.

The option requires ext-mysqli. AMWScan reads literal database settings from wp-config.php without executing the file. Dynamic or ambiguous settings produce an incomplete coverage result.

Exit and automation guidance

Use JSON when another program will process detailed findings. Use SARIF for tools that understand the standard format. Keep reports as build artifacts, protect any local paths or code excerpts they contain, and test the scanner's exit behavior in your own continuous integration job before making it a release gate.