0

因此,对于我的工作,我被要求为 McAfee 学习 Python……无论如何,我找不到任何像样的文档,所以我想我会在这里添加我的笔记,看看任何人都可以改进我的解决方案。

无论如何,我一直收到以下错误:

    Error/reason: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)>

我的代码在下面,删除了私人信息

    import mcafee

    mc = mcafee.client("172.16.153.194", "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:
        #The below file contains EPOComputerProperties
        #the file is in the for loop to all each device to produce results 
    for each property
        file = open('C:/.../.../.../myquery.txt')
        for i in file:
            id = system[i.rstrip('\n')]
            print id
        print ""
        file.close()
4

1 回答 1

0

所以我的解决方案是在我的工作顶部使用以下代码使用猴子补丁(一个不明智的猴子补丁......):

    import ssl

    ssl._create_default_https_context = ssl._create_unverified_context

如果您能找到更好的方法来实现连接,而无需为我的 ePO 服务器提供有效证书,请告诉我。

于 2018-08-27T03:13:11.083 回答