Syntax examples

March 5, 2024

ID 179885

This section contains examples of using a sample HTTP client application from the command line.

Scanning files and URLs

Use the default UNIX socket to scan one file by passing the file contents:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client eicar.txt

Use the default UNIX socket to scan one file by passing the path to the file:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f eicar.txt

Connect to Kaspersky Scan Engine over a TCP socket and scan two files by passing their contents:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -s 192.0.2.42:9999 eicar.txt test.sh

Connect to Kaspersky Scan Engine over a TCP socket and scan two files by passing their contents with a 10-second timeout:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -s 192.0.2.42:9999 -t 10000 eicar.txt test.sh

Connect to Kaspersky Scan Engine over a TCP socket and scan a file by passing the file path:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s 192.0.2.42:9999 /mnt/to_scan/eicar.txt

Connect to Kaspersky Scan Engine over a TCP socket and scan a URL:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -s 192.0.2.42:9999 -u http://example.com

Connect to Kaspersky Scan Engine over a TCP socket and scan a URL with the IP of the host referred to by the URL:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -s 192.0.2.42:9999 -i 233.252.0.1 -u http://bug.qainfo.ru/TesT/Aphish_w

Connect to Kaspersky Scan Engine over a TCP socket and request the release date of the anti-virus database:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client –b -s 192.0.2.42:9999

Scanning files and URLs after authorizing with an API token

Authorize using an API token, connect to Kaspersky Scan Engine over a TCP socket, and scan a file by passing the file path:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s https://192.0.2.42:443/mnt/to_scan/eicar.txt --auth-field --access-token Ab345-KAV

Authorize using an API token, connect to Kaspersky Scan Engine over a TCP socket, and scan a URL:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -s https://192.0.2.42:443 -u http://example.com --auth-field --access-token Ab345-KAV

Authorize using an API token and the Bearer authentication scheme, connect to Kaspersky Scan Engine over a TCP socket, and scan a file by passing the file path:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s https://192.0.2.42:443 /mnt/to_scan/eicar.txt --auth-field --add-bearer-prefix --access-token Ab345-KAV

Authorize using an API token and the Bearer authentication scheme, connect to Kaspersky Scan Engine over a TCP socket, and scan a URL:

user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -s https://192.0.2.42:443 -u http://example.com -auth-field --add-bearer-prefix --access-token Ab345-KAV

Scanning files and URLs, and checking the TLS certificate

In Linux, to use the --ca-path option, prepare the directory containing the certificates:

openssl rehash /mnt/your-cert-dir/

In Windows, to use the --ca-path option, you have to name the certificates files in the search directory as follows: <hash>.0, <hash>.1, <hash>.2, etc., where <hash> is the hash of the file (for example, d93f38c8.0).

To get the hash of a file, use the following command:

openssl.exe x509 -hash -noout -in "full path to the certificate file"

Scan a file and specify the full path to the certificate bundle:

  • In Windows:

    %service_dir%\bin\kavhttp_client -f -s https://127.0.0.1:443 C:\eicar.txt -j --ca-cert C:\your-cert-dir\CertificateFile.cert

  • In Linux:

    user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s https://127.0.0.1:443 /mnt/to_scan/eicar.txt --ca-cert /mnt/your-cert-dir/CertificateFile.cert

Scan a URL and specify the path to the folder that contains the certificate file:

  • In Windows:

    %service_dir%\bin\kavhttp_client -s https://127.0.0.1:443 –u https://example.com -j --ca-path C:\your-cert-dir\

  • In Linux:

    user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -s https://127.0.0.1:443 –u https://example.com --ca-path /mnt/your-cert-dir/

Scan a file and specify certificate checking options:

  • In Windows:

    %service_dir%\bin\kavhttp_client -f -s https://127.0.0.1:443 C:\eicar.txt -j --check-period

    %service_dir%\bin\kavhttp_client -f -s https://127.0.0.1:443 C:\eicar.txt -j --check-subject

    %service_dir%\bin\kavhttp_client -f -s https://127.0.0.1:443 C:\eicar.txt -j --check-chain

  • In Linux:

    user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s https://127.0.0.1:443 /mnt/to_scan/eicar.txt --check-period

    user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s https://127.0.0.1:443 /mnt/to_scan/eicar.txt --check-subject

    user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s https://127.0.0.1:443 /mnt/to_scan/eicar.txt --check-chain

Scan a file and specify certificate checking options within one command:

  • In Windows:

    %service_dir%\bin\kavhttp_client -f -s https://127.0.0.1:443 C:\eicar.txt -j --check-period --check-subject --check-chain --ca-path C:\your-cert-dir\

  • In Linux:

    user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s https://127.0.0.1:443 /mnt/to_scan/eicar.txt --check-period --check-subject --check-chain --ca-path /mnt/your-cert-dir/

Scan a file and check both the certificate bundle and the certificate file:

  • In Windows:

    %service_dir%\bin\kavhttp_client -f -s https://127.0.0.1:443 C:\eicar.txt -j --ca-path C:\your-cert-dir\ --ca-cert C:\your-cert-dir\CertificateFile.cert

  • In Linux:

    user@computer:/opt/kaspersky/ScanEngine/bin# ./kavhttp_client -f -s https://127.0.0.1:443 /mnt/to_scan/eicar.txt --ca-path /mnt/your-cert-dir/ --ca-cert /mnt/your-cert-dir/CertificateFile.cert

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.