唤醒代理Python 2.7 scrip

2024-06-08 09:44:54 发布

您现在位置:Python中文网/ 问答频道 /正文

因此,使用McAfee的书“epo\u 510\u rg\u Web API\u 0-00\u en-us”,我尝试实现了第22页的示例2唤醒代理的脚本。。。无论如何,我收到以下错误:

    C:\Users\Administrator\PycharmProjects\test\venv\Scripts\python.exe 
    C:/Users/Administrator/PycharmProjects/test/autoAgentWakeUp.py
    Traceback (most recent call last):
    File "C:/Users/Administrator/PycharmProjects/test/autoAgentWakeUp.py", line 14, in <module>
    result = mc.system.wakeupAgent(id)
    File "C:\Python27\Lib\mcafee.py", line 446, in __call__
    return self.invoker.invoke(self.prefix + '.' + self.name, argmap)
    File "C:\Python27\Lib\mcafee.py", line 271, in invoke
    if arg[:8] == 'file:///':
    TypeError: 'int' object has no attribute '__getitem__'

无论如何,下面是我的代码,我怀疑错误可能是由于使用ePO 5.3而不是ePO 5.1造成的:

    import mcafee
    import ssl
    ssl.match_hostname= lambda cert, hostname: True
    mc = mcafee.client("localhost", "8443","admin","password")


    #code specific to this task
    input = "mytag" #

    systems = mc.system.find(input)#Search text can be IP address, MAC address, user 
    name, agent GUID or tag
    #The above uses the System Tree for searching
    for system in systems:
    id = system['EPOComputerProperties.ParentID']
    result = mc.system.wakeupAgent(id)

无论如何,我会继续研究这个错误,看看我是否能找到答案


Tags: inpytestselfid错误linemc
1条回答
网友
1楼 · 发布于 2024-06-08 09:44:54

好吧,我在这里发帖后就解决了我自己的问题。无论如何,出于某种原因:

    EPOComputerProperties.ParentID

不会工作,所以我调用了设备的IP地址,是的,这是非常愚蠢的,但它的工作,所以我很高兴:

    id = system['EPOComputerProperties.ParentID']

因此,将上面的行替换为下面的行

    id = system['EPOComputerProperties.IPAddress']

相关问题 更多 >