Jump to content

Danila

Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Reputation

1 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I wrote earlier that the API is terrible. Now I confirm - it is disgusting and the documentation for it is the same. I am writing an answer for my current question: How to get GatewayConnection.PrepareGatewayConnection to work Answer: After getting locationObj via CgwHelper.GetNagentLocation: { "PxgRetVal": { "GwLocHostId": "4f0737f2-9885-46f4-8437-3ba72e50103c", "GwLocIndirect": true, "GwLocLocation": "http://172.20.23.121:15000", "GwLocSignUdp": true, "GwLocTargetComponent": "1103;86;1.0.0.0;b736452e-8f9d-42b0-a6bc-251535210f7a", "GwLocUseCompression": true } } Call the GatewayConnection.PrepareGatewayConnection method with the following body: { "pLocations":[{ "type":"params", "value":{ "GwLocHostId": "4f0737f2-9885-46f4-8437-3ba72e50103c", "GwLocIndirect": true, "GwLocLocation": "http://172.20.23.121:15000", "GwLocSignUdp": true, "GwLocTargetComponent": "1103;86;1.0.0.0;b736452e-8f9d-42b0-a6bc-251535210f7a", "GwLocUseCompression": true } }] } That is not just sending: { "pLocations":[{ %DATA% }] }And forming a structure that is not written in the documentation: { "pLocations":[{ "type":"params", "value":{ %DATA% } }] }
  2. Ранее я написал, что API ужасное. Теперь я подтверждаю - оно отвратное и документация к нему такая же. Пишу ответ для своего текущего вопроса: Как заставить GatewayConnection.PrepareGatewayConnection работать Ответ: После получения locationObj через CgwHelper.GetNagentLocation: { "PxgRetVal": { "GwLocHostId": "4f0737f2-9885-46f4-8437-3ba72e50103c", "GwLocIndirect": true, "GwLocLocation": "http://172.20.23.121:15000", "GwLocSignUdp": true, "GwLocTargetComponent": "1103;86;1.0.0.0;b736452e-8f9d-42b0-a6bc-251535210f7a", "GwLocUseCompression": true } }Вызываем метод GatewayConnection.PrepareGatewayConnection со следующим телом: { "pLocations":[{ "type":"params", "value":{ "GwLocHostId": "4f0737f2-9885-46f4-8437-3ba72e50103c", "GwLocIndirect": true, "GwLocLocation": "http://172.20.23.121:15000", "GwLocSignUdp": true, "GwLocTargetComponent": "1103;86;1.0.0.0;b736452e-8f9d-42b0-a6bc-251535210f7a", "GwLocUseCompression": true } }] } Т.е. не просто отправляя { "pLocations":[{ %DATA% }] }А формируя структуру, которая не написана в документации: { "pLocations":[{ "type":"params", "value":{ %DATA% } }] }
  3. Я автоматизирую инфраструктуру и для скрипта мне нужно временно приостановить антивирус на хосте. Я нашел описание (ужасного) API и через два дня пришел к следующему: Использую Session.StartSession -> получаю «sessionID» С «sessionID» -> Использую HostGroup.FindHosts -> получаю «RequestID» С «sessionID», «RequestID» -> Использую ChunkAccessor.GetItemsChunk -> получаю «hostnameID» С «sessionID», «hostnameID» -> Использую CgwHelper.GetNagentLocation -> получаю «locationObj»: { "PxgRetVal": { "GwLocHostId": "4f0737f2-9885-46f4-8437-3ba72e50103c", "GwLocIndirect": true, "GwLocLocation": "http://172.20.23.121:15000", "GwLocSignUdp": true, "GwLocTargetComponent": "1103;86;1.0.0.0;b736452e-8f9d-42b0-a6bc-251535210f7a", "GwLocUseCompression": true } } С «locationObj» в качестве массива → пытаемся использовать GatewayConnection.PrepareGatewayConnection: { "pLocations": [{ "GwLocHostId": "4f0737f2-9885-46f4-8437-3ba72e50103c", "GwLocIndirect": true, "GwLocLocation": "http://172.20.23.121:15000", "GwLocSignUdp": true, "GwLocTargetComponent": "1103;86;1.0.0.0;b736452e-8f9d-42b0-a6bc-251535210f7a", "GwLocUseCompression": true }] } И я получаю ошибку: { "PxgError": { "code": 1192, "file": "c:\\a\\b\\a_6vlf7p9h\\s\\csadminkit\\development2\\kloapi\\contentstream\\sax_handler.cpp", "line": 314, "message": "Field 'type' is not found for the value with name: ", "module": "KLSTD", "subcode": 0 } } При этом ничего полезного в документации по этому поводу нет: Что делать?
  4. https://support.kaspersky.com/help/KSC/13/KSCAPI/annotated.html
  5. I am automating the infrastructure and for the script I need to temporarily suspend the antivirus on the host. I found a description of the (terrible) API and in two days I came to the following: Use Session.StartSession -> get “sessionID” With “sessionID” -> use HostGroup.FindHosts -> get “RequestID” With “sessionID”, “RequestID” -> use ChunkAccessor.GetItemsChunk -> get “hostnameID” With “sessionID”, “hostnameID” -> use CgwHelper.GetNagentLocation -> get “locationObj” : { "PxgRetVal": { "GwLocHostId": "4f0737f2-9885-46f4-8437-3ba72e50103c", "GwLocIndirect": true, "GwLocLocation": "http://172.20.23.121:15000", "GwLocSignUdp": true, "GwLocTargetComponent": "1103;86;1.0.0.0;b736452e-8f9d-42b0-a6bc-251535210f7a", "GwLocUseCompression": true } } With “locationObj” as array → trying to use GatewayConnection.PrepareGatewayConnection: { "pLocations": [{ "GwLocHostId": "4f0737f2-9885-46f4-8437-3ba72e50103c", "GwLocIndirect": true, "GwLocLocation": "http://172.20.23.121:15000", "GwLocSignUdp": true, "GwLocTargetComponent": "1103;86;1.0.0.0;b736452e-8f9d-42b0-a6bc-251535210f7a", "GwLocUseCompression": true }] } And I get the error: { "PxgError": { "code": 1192, "file": "c:\\a\\b\\a_6vlf7p9h\\s\\csadminkit\\development2\\kloapi\\contentstream\\sax_handler.cpp", "line": 314, "message": "Field 'type' is not found for the value with name: ", "module": "KLSTD", "subcode": 0 } } At the same time, there is nothing useful in the documentation in this regard: What to do?
×
×
  • Create New...