Вирусдай.Сервер

Вирусдай.Сервер - это серверный антивирус, предназначенный для установки на сервера хостинг-провайдеров. Антивирус эффективен в качестве автоматического средства для поиска и уничтожения вредоносного кода (шелы, бэкдоры, спамботы, редиректоры, трояны и пр.) в HTML, PHP, JS и других файлах (включая tar архивы) на серверах провайдеров.

Вирусдай.Сервер совместим с: CentOS 6, CentOS 7, Debian 7, Debian 8, Debian 9, Ubuntu

Условия использования Вирусдай.Сервер :: История версий

Краткий обзор по установке и запуску

Использование сканера

Команда для запуска сканера: /usr/local/vdserver/scan (или просто vdscan, если создана ссылка). По этой команде будет показана подробная инструкция по использованию и параметрам командной строки.

Параметры запуска сканера

vdscan [-flags] < files... | @listfile | @ >

-h, --help:     Print help text and exit
-v, --version:  Print program version and exit
-c, --config:   Print config file contents and exit
-r, --remove:   Cleanup files automatically (if supported by this build)
-d, --nodelete: Do not delete files if they should be deleted with -r
-j, --json:     Print detailed JSON scan results on STDOUT
-z, --unpack:   Unpack and scan archived/packed files (tar/gzip/bzip2/xz/lzma)
-a, --allfiles: Scan all types of files, do not filter file names by extension
-t, --nobin:    Auto detect and skip binary files, scan only text files
-e, --echo:     Print response to STDERR for every item in the list (see below)
-x, --exclude <filename>
  Exclude files/folders listed in file <filename>.
  The file should contain absolute path names, folders should end with '/'.
--dump <dumpfile>
  Create a scan report including copies of malicious files in '<dumpfile>.tar.gz'.
  Available patterns in <dumpfile>:
    {N} - Base name of the first scanned directory/file
    {T} - Current UNIX timestamp
    {D} - Current date in YYYY-MM-DD-hh-mm-ss form
--noemptydump
  Do not store the report if there are no threats found (used with --dump)
--domain <hostname>
  The domain name the scanned files belongs to.
  Required to detect external redirects.
--reloadvdb, --updatevdb
  Force virus database update
--homepath <path>
  Set alternative path to home directory
--configfile <file>
  Load alternative configuration from file <file>
--threads, --limitcpu <number of parallel scanner threads / CPU cores>
  Set the number of parallel scanner threads and the number of CPU cores to use.
  All available CPU cores will be used by default (when --threads < 1).
  See also 'threads' config option.
--vdbid <N>
  Use alternative virus database. The default databse ID is '0' (zero).
  See also 'vdbID' config option.
--maxage <age>
  Scan only files that are newer than the specified age.
  (Scanner started at - File mod time < age).
  Modifiers are required in <age> (h, m, s): 8h, 2h30m, 1h == 60m == 3600s.
--maxsize <size>
  Limit the size of scanned files. Ignore files larger than <size> bytes.
  Modifiers are allowed in <size> (k, m, g): 50k, 2m512k, 2k512, etc.
  Note there is 1 MB hard limit on the maximum file size.
--update <channel>
  Check for updates and exit, lookup the specified update <channel>:
    stable: Stable versions, production use
    latest: Latest versions, pre-production testing
  The list of channels is available on downloads page.
  If there is no update available then exit with non-zero exit status code:
  vdscan --update stable && ./update_script.sh
--sendfile <file>
  Send suspicious file for analysis and exit.
  If failed then exit with non-zero exit status code.

files:     Scanned directories, files (glob patterns allowed)
@listfile: Scan files listed in the file <listfile>
@:         Read file list to scan from STDIN (pipe or keyboard (interactive mode))

Any file name passed as argument can appear in "B64:..." form (base64 encoded).
This also applied to names in the list files. (vdscan B64:YWJjZGU= file2.js).

About list files ("@listfile" or "@"), interactive mode:

  The file name prefixed with '@' will be treated as list file only in case it
  is a single element in the list of files in the command line.
  List files can not contain directories, only files. Directories will be ignored.
  If --echo (-e) flag is set then results in form ":message:filepath" will be
  printed on STDERR after scanning of every file from the list. There "message" is
  the one of: ignored, excluded, error, scanned. Try "echo file|vdscan @ -e".
  File names listed in list files can not start with a colon (':xxx'). Such names
  are treated as commands. They are especially used in interactive mode to change
  the options, control scan process state, retrieve information during scan.
  Unknown/empty commands are silently ignored (like a comments). The result of
  the command will be printed on STDERR in form ":command:result".

The list of currently supported interactive commands:

  :echo     [1|0] # Change the --echo (-e) switch
  :remove   [1|0] # Change the --remove (-r) switch
  :nodelete [1|0] # Change the --nodelete (-d) switch
  :unpack   [1|0] # Change the --unpack (-z) switch
  :nobin    [1|0] # Change the --nobin (-t) switch
  :maxage   [age] # Set the --maxage value
  :maxsize [size] # Set the --maxsize value
  :stats          # Show the current scan statistics
  :help or :?     # Print the list of commands
  :exit or :q     # Close all scan threads and exit

About flags:

  It is possible to combine several short flags into one:
    '-rjx file' is equal to '-r -j -x file'
  To specify the value for the flag the equal sign (=) may also be used:
    '-rx=file --dump=www' is equal to '-r -x file --dump www'
  Add '--' to skip parsing of remaining flags. Useful if some positional arguments
  are started with a dash (vdscan -r -- -file).

Examples:

  vdscan -rx ignored.txt www/ --dump /tmp/vdscan.{N}.{D}
  vdscan -a *.js *.php dir1/ dir2/ -j --maxsize 150k --maxage 2h30m
  # Use list file:
  vdscan -rj -d @list.txt
  # Read file names to scan from STDIN:
  echo file.js | vdscan @ -r
  cat list.txt | vdscan @ -az
  vdscan @ < list.txt
  # Read file names directly from the keyboard (interactive mode):
  vdscan @ --echo

Example output (Plain text format, default):

  www/
  www/sub/path/to/file1 : 123 : Trojan  : I : D : -
  www/sub/path/to/file2 : 456 : Spambot :   :   : R
  www/sub/path/to/file2 :     :         :   :   : EW

Example output (JSON format, -j, --json):

  [
   ["www/sub/path/to/file1", "123", "Trojan",  1, 1,  0, "B64="]
  ,["www/sub/path/to/file2", "456", "Spambot", 0, 0,  1, "B64="]
  ,["www/sub/path/to/file2", "",    "",        0, 0, -2, null]
  ]

Результаты сканирования

При сканировании результаты (список зараженных файлов с информацией по заражениям) выводятся на стандартный вывод. В зависимости от параметров запуска, сканер может выводить только обзорные данные по сканированию или подробные данные в формате JSON для последующего разбора.

По умолчанию (без флага -j) результаты выводятся в таком формате:

Путь до файла : ID угрозы : Название угрозы : Возможность лечения : Тип угрозы : Результат лечения
...

Если сканирование запущено с флагом -j (вывод в формате JSON), то результатом будет JSON массив такого вида:

[
["Путь до файла", "ID угрозы", "Название угрозы", Возможность лечения, Тип угрозы, Результат лечения, "Фрагмент кода"]
, ...
]

Отчеты сканера

В результате сканирования при указании параметра --dump создается отчет. Это tar.gz архив, его содержимое будет таким:

Файл/Папка Описание
files/ Зараженные файлы (до лечения) с сохранением оригинальных путей.
cmd Папка и полный набор параметров с которыми был запущен сканер.
target Список проверяемых объектов из командной строки.
scan.json Полный лог сканирования в формате JSON, содержащий так же вредоносные коды, найденные в каждом файле.
scan.log Краткий лог сканирования (обзорные данные).
stats.json Статистика по сканированию (время начала, длительность, количество проверенных, зараженных, вылеченных файлов, количество ошибок при чтении файлов, количество найденных угроз, количество излечимых угроз, количество вылеченных угроз).

В логах содержится информация, описанная в разделе Результаты сканирования.

Работа в режиме сервиса

Вы можете использовать любой привычный планировщик, например CRON, и настраивать расписание сканирования любым удобным способом.

Коды завершения процесса

Процесс сканера возвращает код возврата при завершении. При нормальном завершении код возврата устанавливается в 0. При ошибках возвращается ненулевой код.

Под термином основная команда/операция здесь подразумевается одно из: Нормальное сканирование; запуск с ключом –help; –version; –config; –update; –sendfile.

Коды 4 и 5 возвращаются в случае ошибок при создании/чтении/записи файлов журналов / дамп-файла / файла списка / файла исключений / домашней папки. Сканер продолжает работу в случае ошибок чтения/записи при сканировании пользовательских файлов, такие ошибки отражаются в журналах.

Код 7 возвращается в случае ошибок, возникающих при взаимодействии с удаленными сервисами (обновление антивирусной базы, проверка обновлений по флагу –update, отправка файлов на анализ по флагу –sendfile, и т.д.).


Наверх