diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e5ccbaf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM php:8.2-cli + +# Install dependencies +RUN apt-get update && apt-get install -y \ + git \ + unzip \ + libzip-dev \ + && docker-php-ext-install zip + +WORKDIR /scanner +COPY . . +RUN chmod +x scan + +ENTRYPOINT ["./scan"] +CMD ["/code"] \ No newline at end of file diff --git a/README.md b/README.md index b90b44a..10574fa 100644 --- a/README.md +++ b/README.md @@ -146,3 +146,37 @@ Licensing --------- PHP malware scanner is [licensed](https://github.com/scr34m/php-malware-scanner/blob/master/LICENSE.txt) under the GNU General Public License v3. + +Docker Usage +----------- + +You can also run the scanner using Docker: + +1. Build the image: +```bash +docker build -t php-malware-scanner . +``` + +2. Scan a directory: +```bash +docker run -v /path/to/scan:/code php-malware-scanner -d /code +``` + +For example, to scan a WordPress installation: +```bash +docker run -v /var/www/html:/code php-malware-scanner -d /code -j 6.4.1 +``` + +Common usage with flags: +```bash +# Show only infected files (hide OK status) +docker run -v /path/to/scan:/code php-malware-scanner -d /code -k + +# Show comments for matched patterns +docker run -v /path/to/scan:/code php-malware-scanner -d /code -c + +# Show MD5 hashes and continue after first match +docker run -v /path/to/scan:/code php-malware-scanner -d /code -m -s +``` + +The `/code` directory inside the container is where your files will be mounted for scanning.