3 Replies Latest reply on Jun 27, 2014 10:06 PM by DanGrover

    Displaying contents of productVersion type

    datasecanalyst

      I've got a basic website to display EEPC Agent & Provider version details using Python web API calls. Here's my queries:

       

      eeAgentVersion = mc.core.executeQuery(target="EPOProdPropsView_MCAFEE_EED", select='(select EPOProdPropsView_MCAFEE_EED.productversion)', where='(where ( eq EPOLeafNode.NodeName "%s"))' % machineName)

      eeProviderVersion = mc.core.executeQuery(target="EPOProdPropsView_MCAFEE_EEPC", select='(select EPOProdPropsView_MCAFEE_EEPC.productversion)', where='(where ( eq EPOLeafNode.NodeName "%s"))' % machineName)

       

      When I run the command using the API explorer, I get a clean output like this:

       

      Product Version (Endpoint Encryption Agent): 7.0.3.413

       

      When I run the command using my Python code, which displays the contents of that query like this:

       

      print "<li>" + str(eeAgentVersion) + "</li>"

      print "<li>" + str(eeProviderVersion) + "</li>"

       

      I get an output like this:

       

      • [{u'EPOProdPropsView_MCAFEE_EED.productversion': u'7.0.3.413'}]
      • [{u'EPOProdPropsView_MCAFEE_EEPC.productversion': u'7.0.3.413'}]

       

      Any suggestions for how to make that ugly output more like what I see from API explorer? I'm thinking I'll have to just strip the version number from the end and then create my own string for the "Product Version (Endpoint...)" part of it, but I thought I'd see if anyone else has any experience and/or better ideas with this..

       

      Thanks ahead of time!

        • 1. Re: Displaying contents of productVersion type
          datasecanalyst

          Using Python strip commands can accomplish this, but it seems pretty hacky. Example below... and please still respond if you see a more graceful way of accomplishing this...

           

          eeAgentVersion = str(eeAgentVersion).lstrip("[{u'EPOProdPropsView_MCAFEE_EED.productversion': u'")

          eeAgentVersion = eeAgentVersion.rstrip("'}]")

          • 2. Re: Displaying contents of productVersion type
            datasecanalyst

            Okay, so in case anyone else out there tries to do the same, here's what my final product looks like... returns easy, clean output of just the version number...

             

            eeAgentVersion = mc.core.executeQuery(target="EPOProdPropsView_MCAFEE_EED", where='(where ( eq EPOLeafNode.NodeName "%s"))' % machineName)

            eeAgentVersion = eeAgentVersion[0].get('EPOProdPropsView_MCAFEE_EED.productversion')

             

            eeProviderVersion = mc.core.executeQuery(target="EPOProdPropsView_MCAFEE_EEPC", where='(where ( eq EPOLeafNode.NodeName "%s"))' % machineName)

            eeProviderVersion = eeProviderVersion[0].get('EPOProdPropsView_MCAFEE_EEPC.productversion')

             

            Message was edited by: datasecanalyst on 6/27/14 3:44:12 PM CDT
            • 3. Re: Displaying contents of productVersion type
              DanGrover

              As you probably know, you can see the details of that table like so:

               

              eepc_name = "EPOProdPropsView_MCAFEE_EEPC"

              eed_name = "EPOProdPropsView_MCAFEE_EED"

              eed_table = mc.core.listTables(table=eed_name)

              print eed_table['columns']

               

              Output:

               

                  Name                Type           Select? Condition? GroupBy? Order? Number?

                  ------------------- -------------- ------- ---------- -------- ------ -------

                  LeafNodeID          int            false   false      false    true   true

                  ProductPropertiesID int            false   false      false    true   true

                  ProductFamily       string         false   false      false    true   false

                  FamilyDispName      string         false   false      false    true   false

                  ProductCode         string         false   false      false    true   false

                  productversion      productVersion true    true       true     true   false

               

              The output from the EEPC table is identical. So, the only column available to select from those tables is the "productversion", which you're already getting. You could open a request to the EEPC team to ask that the "FamilyDispName" be available for select, which would let you get the display name of the product, just as the API explorer does. Why it's not available already is a question for that team.

               

              Finally, you might try something like this, for ease of use. It's a bit longer, but somewhat more clear, and adds a little validity checking.

               

              def get_version(table_name, machine_name):

                  column = '%s.productversion' % table_name

                  select = '(select %s)' % column

                  where = '(where (eq EPOLeafNode.NodeName "%s"))' % machine_name

                  result = mc.core.executeQuery(target=table_name, select=select, where=where)

                  version = result[0].get(column, None)

                  return version

               

              eeAgentVer = get_version("EPOProdPropsView_MCAFEE_EEPC", machineName)

              eeProviderVersion = get_version("EPOProdPropsView_MCAFEE_EED", machineName)

               

              print "Endpoint Encryption Agent version: " + eeAgentVer

               

              Output:

               

              Endpoint Encryption Agent version: 7.0.3.413

               

              Dan