首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >深层安全内部应用控制中一台计算机的维护模式

深层安全内部应用控制中一台计算机的维护模式
EN

Stack Overflow用户
提问于 2020-03-26 13:46:59
回答 1查看 146关注 0票数 0

我试图通过API使用这个Python脚本将一台计算机置于DeepSecurity12内部的应用程序控制模块中的维护模式中:

代码语言:javascript
复制
#

import deepsecurity as api
from deepsecurity.rest import ApiException as api_exception
import time, sys, warnings, pprint
import urllib3
urllib3.disable_warnings()

# Setup
configuration = api.Configuration()
configuration.host = 'https://xxxxxxxxxxxx.xxxxxxx.com:4119/api'

# Authentication
configuration.api_key['api-secret-key'] = 'xxxxxxxxxxxxxxxxxxx'

#Initialization
computer_id = "989"
api_version = 'v1'

def turn_on_maintenance_mode():

  # Create and configure an ApplicationControlComputerExtesnion object
  application_control = api.ApplicationControlComputerExtension()
  application_control.maintenance_mode_status = "on"
  application_control.maintenance_mode_duration = "0"

  # Add the ApplicationControlComputerExtension to a Computer object
  computer = api.Computer()
  computer.application_control_computer_extension = application_control

  try: 
    # Update the computer
    computers_api = api.ComputersApi(api.ApiClient(configuration))
    return computers_api.modify_computer(computer_id, computer, api_version)

  except api_exception as e:
    return "Exception: " + str(e)

if __name__ == '__main__':
  turn_on_maintenance_mode()

脚本执行时没有任何错误,计算机接收策略更改(因此与API和这台计算机的通信是正常的),但是计算机没有将自己置于维护模式中。

对发生了什么事有什么想法吗?

提前感谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-27 19:46:22

computer.application_control_computer_extension = application_control

应:

computer.application_control = application_control

因此,自动化中心文章中的示例python代码似乎是不正确的。应该很快就会更新。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60868763

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档