Дерево страниц

Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.
Комментарий: Published by Scroll Versions from space TMAG and version 7.11
Sv translation
languageru

Версия API: 1.8 и выше

Метод: GET

Ресурс: /event/verdict

Описание:

Метод возвращает вердикт события по ID документа:

  • Разрешено (Allowed);
  • Помещено на карантин (Quarantined);
  • Заблокировано (Forbidden).

Кроме того, вывод метода содержит поля:

  • OBJECT_ID, integer – уникальный идентификатор объекта;
  • TBS_ID, number – идентификатор табличного пространства для секционирования.

Параметры:

  • documentId – идентификатор перехваченного документа;
  • date – дата перехвата в формате ГГГГ-ММ-ДД по UTC+0:00.

Пример:

Блок кода
titleЗапрос
curl -X 'GET' \
  'https://server.company.ru/xapi/event/verdict?documentId=b042cae7-cd7f-4ff3-9af7-5ed41ec0dc23&date=2024-01-15' \
  -H 'X-API-Version: 1.8'
Блок кода
titleОтвет
{
  "data": [
    {
      "VERDICT": "Allowed",
      "DOCUMENT_ID": "string",
      "OBJECT_ID": 0,
      "TBS_ID": 0
    }
  ]
}

Для быстрого получения вердиктов по событиям рекомендуется делать запрос сразу по нескольким documentID:

Блок кода
titleЗапрос
https://server.infowatch.ru/xapi/event/verdict?documentId=ID1,ID2ID3,ID4,ID5,ID6,IDnnn&date=DATE2'

Отслеживание вердикта по документу

Если требуется проверить набор файлов из внешней системы, и при условии срабатывания политик и на основании решения пользователя по событию, предпринять какие-либо действия, то необходимо:

  1. Отправить файлы для проверки в ТМ.
  2. Получить и сохранить информацию о событии ТМ.
  3. Отслеживать статус события.

Отправка файлов для проверки в ТМ

В системе сохраняется информация о ходе проверки файлов. Она имеет следующую структуру:

  • file_path – путь или полное имя файла, отправляемого на анализ;
  • document_id – GUID события, сгенерированный при отправке файла на анализ;
  • object_id – идентификатор события, созданного ТМ в результате анализа;
  • tbs_id – идентификатор табличного пространства;
  • verdict – вердикт, проставленный в результате анализа;
  • user_decision –  решение пользователя после помещения события на карантин

  Отправка файла осуществляется путем выполнения запроса PushAPI:

Блок кода
languagebash
titleПример запроса для отправки файла на анализ в TM
pushapi-util --host 127.0.0.1 --token 8iwivt0cmirlcceuu12l --id IW --class fileexch --service im_vk --evtattr event_name:"vkontakte Event" --sender "vkontakte:sender1111:'{\"display_name\":\"Врбт Тестер\",\"url\":\"https://www.facebook.com/100006160150433\",\"login\":\"new_login\"}'" --receiver vkontakte:vkontakteressivier1 --receiver "vkontakte:11111123:'{\"url\":\"https://vk.com/vrbttester\",\"login\":\"some_login\"}'" --data file:file.txt,filename:file.txt
Блок кода
languagebash
titleПример ответа с получением document_id события
Object database GUID: df5f046e-0555-46e1-be48-8da33f41b9bb

Данную операцию необходимо повторить для каждого файла и сохранить все полученные GUID. Они будут использоваться далее для отслеживания состояния анализа и изменения решения пользователя.

Получение событий из ТМ

Это действие необходимо для того, чтобы получить информацию о сработавших политиках и вынесенном вердикте по событию в ТМ по результатам анализа содержимого файлов. Помимо этого на данном этапе требуется получить идентификаторы событий OBJECT_ID и идентификаторы табличных пространств TBS_ID на основе их GUID (document_id).

Для этого необходимо выполнить запрос Public API  вида:

Блок кода
titleПример запроса
https://server.infowatch.ru/xapi/event?filter[document_id]={GUID_1},{GUID_2},...,{GUID_N}&filter[date][from]={START_TIME}&filter[date][to]={END_TIME}

Где {GUID_i} - GUID(document_id) файла, полученный при отправке на анализ.

Результатом данного запроса будет массив, элементами которого являются события ТМ. Сопоставляя document_id, сохраненные в результате отправки файлов на анализ, с document_id события, полученного на этом шаге, сохраняем OBJECT_ID и TBS_ID, а также параметры, необходимые для принятия дальнейшего решения по проверяемым файлам (например, вердикт).

На обработку событий в ТМ может потребоваться некоторое время, поэтому возможно, что в результат выполнения API-запроса попадет информация не обо всех событиях, document_id которых был передан. Следовательно, для тех document_id, события по которым не были получены, необходимо повторное выполнение запроса к public API до тех пор, пока они все не будут обработаны.

Отслеживание статуса события

Для отслеживания изменения пользовательского решения рекомендуется периодически выполнять запросы на получение аудита по событиям, где было изменено решение пользователя. Запрос может иметь следующий вид:

Блок кода
titleПример запроса
https://server.infowatch.ru/xapi/audit?filter[change_date][>]={START_TIME}&filter[entity_type][]=Object


Где {START_TIME} - unix timestamp момента, после последнего запроса на получение аудита (для первой итерации – момента после отправки первого файла на анализ).
После выполнения запроса все события аудита перебираются по очереди, в них поле ENTITY_ID сопоставляется с сохраненными ранее OBJECT_ID. Решение можно принимать на основе полей аудита OPERATION и PROPERTY_CHANGES.


Sv translation
languageen

API Version: 1.8 and later

Method: GET

Resource: /event/verdict

Description:

The method returns an event verdict based on the document ID:

  • Allowed;
  • Quarantined;
  • Forbidden.

Besides, the method's output includes the following fields:

  • OBJECT_ID, integer, is the unique object ID;
  • TBS_ID, number, is the tablespace ID for partitioning.

Parameters:

  • documentId is the ID of an intercepted document;
  • date is the interception date in the YYYY-MM-DD format (UTC+0:00).

Example:

Блок кода
titleQuery
curl -X 'GET' \
  'https://server.company.com/xapi/event/verdict?documentId=b042cae7-cd7f-4ff3-9af7-5ed41ec0dc23&date=2024-01-15' \
  -H 'X-API-Version: 1.8'
Блок кода
titleResponse
{
  "data": [
    {
      "VERDICT": "Allowed",
      "DOCUMENT_ID": "string",
      "OBJECT_ID": 0,
      "TBS_ID": 0
    }
  ]
}

Tracking verdict through the document

If you need to check a set of files of external system, and on condition that a policy is triggered when a user verdict is changed, you need to take actions, then:

  1. Send the files to TM for checking.
  2. Get and store the information about the event in TM.
  3. Track the event status.

Sending files to TM for checking

The system stores the information about the process of file checking. The information has the following structure:

  • file_path – path or the full name of the file to be sent to analysis;
  • document_id – GUID of event, generated during sending the file to analysis;
  • object_id – identifier of events, created in TM after analysis;
  • tbs_id – table space identifier;
  • verdict – verdict made after analysis;
  • user_decision –  user decision after placing the event to quarantine

  The file is sent via PushAPI query:

Блок кода
languagebash
titleExample of query for sending file to TM for analysis
pushapi-util --host 127.0.0.1 --token 8iwivt0cmirlcceuu12l --id IW --class fileexch --service im_vk --evtattr event_name:"vkontakte Event" --sender "vkontakte:sender1111:'{\"display_name\":\"Врбт Тестер\",\"url\":\"https://www.facebook.com/100006160150433\",\"login\":\"new_login\"}'" --receiver vkontakte:vkontakteressivier1 --receiver "vkontakte:11111123:'{\"url\":\"https://vk.com/vrbttester\",\"login\":\"some_login\"}'" --data file:file.txt,filename:file.txt
Блок кода
languagebash
titleExample of response with document_id of event
Object database GUID: df5f046e-0555-46e1-be48-8da33f41b9bb

The operation is to be repeated for each file and all GUID are to be stored. They are to be used to track the analysis status and to change the user verdict. 

Getting events from TM

The action is required to get the information about triggered policies and the verdict made for the TM event after the analysis of the file content. Furthermore, the step requires receiving the event identifiers OBJECT_ID and TBS_ID on the basis of their GUID (document_id).

For this, you need to complete Public API query as follows:

Блок кода
titleExample of query
https://server.infowatch.ru/xapi/event?filter[document_id]={GUID_1},{GUID_2},...,{GUID_N}&filter[date][from]={START_TIME}&filter[date][to]={END_TIME}

Where {GUID_i} - GUID(document_id) of file, gotten after sending the file to analysis.

The result of the query is an array which elements are the TM events. By matching the document_id, stored as a result of file sending to analysis, with document_idof the event, received at this step, OBJECT_ID and TBS_ID are stored, as well as the parameters, required for making further decision regarding the files being checked (for example, a verdict).

A certain anount of time is needed to process events in TM. So it is possible, that the result of API query does not contain the information about all the events which document_id have been transferred. Hence, you need to complete the public API query again for the document_id, for which the events are not received, untill all of them are processed.   

Tracking event status

To track the changes in user verdict, it is recommended to complete queries for audit of events for which the verdict was changed. The query can be this:

Блок кода
titleExample of query
https://server.infowatch.ru/xapi/audit?filter[change_date][>]={START_TIME}&filter[entity_type][]=Object

Where {START_TIME} – unix timestamp of the moment after the last query for audit (for the first iteration – moment after sending the first file to analysis).
After completing the query, all the audit events are processed one by one, the ENTITY_ID field in them is to be matched with the previously stored OBJECT_ID field. The verdict can be made on the basis of the OPERATION and PROPERTY_CHANGES fields.