3 Replies Latest reply on Jun 19, 2017 11:36 PM by redcode

    Update on McAfee ePO Python Module Code?


      I am trying to learn how to use Python to write scripts for McAfee ePO. The problem is the code I found uses the mcafee package is out of date and I can only find the mcafee-epo 1.0.1 (mcafee_epo) package. When using the new package, a lot of the modules are incompatible and trigger errors on execution. Are there any resources that I can be referred to that uses the newer mcafee_epo package or has the McAfee resources been updated for it yet?


      PS. I'm currently running Python 3.6

        • 1. Re: Update on McAfee ePO Python Module Code?

          I too am learning python to do stuff in ePO.  In the script below, I'm able to pull some basic information including the Agent Version and Last Communication time from ePO.  Its python 2.7 but the changes should be minor.

          sys.path[:0] = ('/mcafee/') # Use if the mcafee api folder is a subfolder of where you're running this.
          import mcafee
          import requests.packages.urllib3
          user = raw_input("Enter Your Username: ")
          passwd = getpass.getpass("Enter Your Password: ")
          ips = raw_input('Enter an IP address to search: ')
          payload = {"searchText": ips}
          r = requests.get('https://INSERT YOUR URL HERE:8443/remote/system.find?', params=payload, verify=False, auth=(user,passwd))
            epoAgentVer = re.findall('Agent Version \(deprecated\): (\d.*$)', r.text, re.MULTILINE)[0]
            print ('ePO Agent Version: %s') % epoAgentVer
          except IndexError:
            print ('Unable to find agent version.')
            epoLastComm = re.findall('Last Communication: (.*) EDT', r.text, re.MULTILINE)[0]
            print ('Last Communication: %s EDT') % epoLastComm
          except IndexError:
            print ('Unable to determine last communication time. \nDevice may not be managed or agent is not installed.')
          • 2. Re: Update on McAfee ePO Python Module Code?

            Thread moved from Community Support to Business --> ePO for attention

            • 3. Re: Update on McAfee ePO Python Module Code?

              I thought the changes would be minor but it looks like with the new ePO package for Python has some significant changes. The more I'm adapting the code for the new package, the more errors I get, and using the new package on the code that you provided gives a lot of errors immediately. But it's not just the syntax difference, it's mainly the package itself. You're using import mcafee

              but that package for Python 3.6 is obsolete and I cannot find it anywhere. The new package is import mcafee_epo and it differs significantly from the earlier package. So that's why I want to see if there's any documentation on the new package.