marcocesarato / amwscan
AMWSCAN (Antimalware Scanner) is a php antimalware/antivirus scanner console script written in php for scan your project. This can work on php projects and a lot of others platform.
Installs: 13 002
Dependents: 1
Suggesters: 0
Security: 0
Stars: 651
Watchers: 33
Forks: 109
Open Issues: 44
Type:console
Requires
- php: >=5.5
- ext-fileinfo: *
- ext-json: *
- ext-mbstring: *
- ext-zlib: *
Requires (Dev)
- dev-master
- 0.14.0
- 0.10.4
- 0.10.3
- 0.10.2
- 0.10.1
- 0.10.0
- v0.9.1
- v0.9.0
- v0.8.3
- v0.8.2
- v0.8.1.241
- v0.8.1.236
- v0.8.0.234
- v0.7.5.177
- v0.7.4.147
- v0.7.3.133
- v0.7.2.125
- v0.7.2.123
- v0.7.1.113
- v0.7.0.110
- v0.6.0.109
- v0.6.0.107
- v0.5.3.93
- v0.5.2.75
- v0.5.1.72
- v0.5.0.71
- v0.5.0.70
- v0.5.0.69
- v0.5.0.68
- v0.5.0.67
- v0.5.0.62
- v0.4.0.60
- v0.4.0.58
- v0.4.0.53
- v0.4.0.50
- v0.4.0.39
- dev-renovate/friendsofphp-php-cs-fixer-3.x-lockfile
- dev-renovate/twitter-bootstrap-5.x
- dev-renovate/marcocesarato-php-conventional-changelog-1.x-lockfile
- dev-renovate/popper.js-2.x
- dev-renovate/docusaurus-monorepo
- dev-renovate/jquery-3.x
- dev-renovate/svgr-webpack-8.x
- dev-renovate/clsx-1.x-lockfile
- dev-renovate/mdx-monorepo
- dev-renovate/easyops-cn-docusaurus-search-local-0.x
- dev-dev
This package is auto-updated.
Last update: 2024-12-10 19:34:07 UTC
README
PHP Antimalware Scanner
If this project helped you out, please support us with a star ⭐
Description
PHP Antimalware Scanner is a free tool to scan PHP files and analyze your project to find any malicious code inside it.
It provides an interactive text terminal console interface to scan a file, or all files in a given directory (file paths
can also be managed using --filter-paths
or --ignore-paths
), and find PHP code files that seem to contain malicious
code. When a probable malware is detected, will be asked what action to take (like add to the whitelist, delete files, try
clean infected code, etc).
The package can also scan the PHP files in a report mode (--report|-r
), so without interacting and outputting anything to
the terminal console. In that case, the results will be stored in a report file in HTML (default) or text
format (--report-format <format>
).
This scanner can work on your own php projects and on a lot of other platforms using the right combination of
configurations (ex. using --lite|-l
flag can help to find less false positivity).
⚠️ Remember that you will be solely responsible for any damage to your computer system or loss of data that results from such activities. You are solely responsible for adequate protection and backup of the data before executing the scanner.
How to contribute
Have an idea? Found a bug? Please raise to ISSUES or PULL REQUEST. Contributions are welcome and are greatly appreciated! Every little bit helps.
📘 Requirements
- php 5.5+
- php-xml
- php-zip
- php-mbstring
- php-json
- php-common
- php-curl
- php-gd
📖 Install
Release
You can use one of these methods to install the scanner by downloading it from GitHub or directly from the console.
Download
Go to the GitHub page and press on the Releases tab or download the raw file from:
Console
-
Run this command from the console (the scanner will be downloaded to your current directory):
wget https://raw.githubusercontent.com/marcocesarato/PHP-Antimalware-Scanner/master/dist/scanner
-
Run the scanner:
php scanner ./dir-to-scan -l ...
-
(Optional) Install as bin command (Unix Bash)
Run this command:
wget https://raw.githubusercontent.com/marcocesarato/PHP-Antimalware-Scanner/master/dist/scanner -O /usr/bin/awscan.phar && \ printf "#!/bin/bash\nphp /usr/bin/awscan.phar \$@" > /usr/bin/awscan && \ chmod u+x,g+x /usr/bin/awscan.phar && \ chmod u+x,g+x /usr/bin/awscan && \ export PATH=$PATH":/usr/bin"
Now you can run the scanner simply with this command:
awscan ./dir-to-scan -l...
Source
Download
Click the GitHub page "Clone or download" or download from:
Git
- Install git
- Copy the command and link from below in your terminal:
git clone https://github.com/marcocesarato/PHP-Antimalware-Scanner
- Change directories to the new
~/PHP-Antimalware-Scanner
directory:cd ~/PHP-Antimalware-Scanner/
- To ensure that your master branch is up-to-date, use the pull command:
git pull https://github.com/marcocesarato/PHP-Antimalware-Scanner
- Enjoy
🐳 Docker
- Download the source
- Build command
docker build --tag amwscan-docker .
- Run command
docker run -it --rm amwscan-docker bash
🔎 Scanning mode
The first think you need to decide is the strength, you need to calibrate your scan to find less false positive as possible during scanning without miss for real malware. For this you can choose the aggression level.
The scanner permit to have some predefined modes:
💻 Usage
Command line
php amwscan ./mywebsite/http/ -l -s --only-exploits
php amwscan -s --max-filesize="5MB"
php amwscan -s -logs="/user/marco/scanner.log"
php amwscan --lite --only-exploits
php amwscan --exploits="double_var2" --functions="eval, str_replace"
php amwscan --ignore-paths="/my/path/*.log,/my/path/*/cache/*"
Doesn't work?
In case above command doesn't work, you can use script responsible for malware scan manually by executing:
php dist/scanner <path>
To check all options check the Documentation
Suggestions
If you are running the scanner on a Wordpress project or other popular platform use --only-signatures
or --lite
flag
to have check with less false positive but this could miss some dangerous exploits like nano
.
Programmatically
On programmatically silent mode and auto skip are automatically enabled.
use AMWScan\Scanner; $app = new Scanner(); $report = $app->setPathScan("my/path/to/scan") ->enableBackups() ->setPathBackups("/my/path/backups") ->enableLiteMode() ->setAutoClean() ->run();
Report Object
object(stdClass) (7) { ["scanned"] => int(0) ["detected"] => int(0) ["removed"] => array(0) {} ["ignored"] => array(0) {} ["edited"] => array(0) {} ["quarantine"] => array(0) {} ["whitelist"] => array(0) {} }
🎨 Screenshots
Report
HTML report format (
default
)