Scan a local file on the API Server

After starting the virtual machine, you can access the API Server using its IP address and the port 8080. For instance, if the IP address is 172.31.39.37, you can perform file scans by making requests to http://172.31.39.37:8080/api/clamav/scan/file.

curl -d '{"file": "/tmp/test.txt"}' -H 'Content-Type: application/json' http://172.31.39.37:8080/api/clamav/scan/file

The virus scan API Server is configured to listen on the local address 127.0.0.1:3000. To initiate a virus scan, you can send an HTTP request to http://127.0.0.1:3000/api/clamav/scan/file if the request originates from within the virus scan API server.

Response

A json format string will be returned. The possible return codes are 0, 1, 2, and 99.

  • Clean:
{"code":0,"message":"OK"}
  • Infected: For example, when Eicar-Signature is identified, the response would be
{"code":1,"message":"Eicar-Signature FOUND"}
  • Scan Errors: For example, when having file access error, the response would be
{"code":2,"message":"Can't access file /tmp/test/file"}
  • Other Errors: For example, when the API endpoint is not available , the response would be
{"code":99,"message":"Handler Not Found"}