This repo contains the source code for the clamd/flask based antivirus rest API.
Host: localhost
Port: 8433
API Key: helloworld
Change directory into the repo root directory.
cd restingclam
Run the stack.
docker-compose up -d
Execute a test request to ensure the API is functioning.
It takes a while for clamd to start, during this time a 502 will be returned
curl -k -H 'X-API-Key: helloworld' https://localhost:8433/heartbeat
The response should be 200 status code.
Nice file:
curl -X POST --form "data=@testfiles/good.txt" -k -H 'X-Api-Key: helloworld' https://localhost:8433/scan
Bad file:
curl -X POST --form "data=@testfiles/bad.txt" -k -H 'X-Api-Key: helloworld' https://localhost:8433/scan
Example output:
{"task_id":"a7c716d5-6823-444b-9346-cde7b632a568"}
curl -s -k -H 'X-Api-Key: helloworld' https://localhost:8433/task?id=a7c716d5-6823-444b-9346-cde7b632a568 | jq -r '.task_result'
An OK task result means the file has been flagged as clean. A NOTOK task result means the file has been flagged as a virus.
Content type
Image
Digest
sha256:00da5c042…
Size
289 MB
Last updated
over 3 years ago
docker pull encircle/restingclam